Homework 3 Information, ECS50 Summer 2008
- All parts of the assignment are due by noon on Wednesday, September 10th
Assignment:
Snake
The purpose of this assignment is to learn more about the use of interrupts,
and to write a larger program in assembly language. Both are skills that can
come in handy in the future. In order to develop these skills, you are going
to design a game similar to the QBasic Nibbles game; it’s also known as Snakes.
There are
specifications which everyone's games must follow, and a list of options of
which you must complete (2). You can complete additional options for extra
credit.
Game Description:
In this game you are a snake which collects items (the numbers 1 – 9) in each
level. Each number is generated after the previous is collected (e.g. 3 is
collected by the snake and then 4 is generated), and the numbers are
randomly placed on the game board (but not where the snake currently resides.)
The head of the snake will be represented by a capital ‘S’, while the body is
made of small letter s's. As each number is collected the
snake will grow in length by one ASCII character. Further, the snake is
continually moving, and cannot touch itself, or the edge of the game board.
The edge of the game board will be represented by an ‘*’ - this character
represents a solid barrier that the snake cannot go through. The snake will be
moved via the following keys: • • •
•
I – Up K – Down J – Left L – Right
If you attempt to reverse direction (e.g. you are going up and you press ‘K’)
you essentially run into yourself and die. In other words you are only allowed
to make 90 degree turns. After collecting all numbers 1 – 9 the player wins the
game/level.
Here is a very crude asci drawing of what your screen might look like during
play.
*************************
* *
* ssssss *
* s *
* ssS 4 *
* *
* *
*************************
In essence you are doing the version of the game in the bottom right hand of
the welcome screen at http://www.snakegame.net/, and then adding as many cool
new things as you want.
Here are the specifications that are required:
- Screen must be drawn correctly
- Border of screen and all obstacles must be made of '*'
- The Snake must be able to change directions
- The Snake moves at a constant pace
- The snake must die if it encounters any obstacle (wall, itself, etc.)
- Items to collect must appear in random places in order (1-9) after they
have been consumed
- The snake must increase in length by one after each item is ingested
- The head of the snake should be an 'S', and the body built out of 's'
- Upon collecting the last number (9) the level is won, the next level will
start and the Snakes speed will increase by 10% from the previous level.
Here are the options which you need to choose two or more:
- Increase the speed of the Snakes movements by 50% when an 'I' is run over
- Decrease the speed of the Snakes movements by 50% when a 'D' is run over
- Warp the Snake to a random point on the screen when a 'W' is run over
- Shrink the Snake by one ASCII character when an 'X' is run over
(The I, D, W, and/or X should appear randomly on the screen after a random
amount of time ranging from 20 to 30 seconds, and then disappear after 5
seconds. These effects cease after a level is won.)
- Point system - the faster you beat a level the more points you get,
until you die and/or you try to pick up additional items for points.
- Additional levels (must look different, you can use the '*' character to
generate obstacles)
- Think of your own option and check if it will be okay.