described here

HW#4: Overview (1)
• You must develop a game that uses the LCD
display on the MCB1700 board and the
keyboard of the host PC.
• On the screen, starting initially from the center
of the screen and moving up initially, a “snake”
moves at constant speed.
• The snake movement is controlled by the user
via the host-PC keyboard’s arrow keys.
• The goal of the user is to control the snake’s
movement and bring it to the location on the
screen where a “mouse” has been generated.
HW#4: Overview (2)
• The mouse is generated at a random location by
the program and is displayed until the snake “eats”
the mouse (which is the moment when the
moving snake touches or hits the mouse).
• Once a mouse gets eaten, a new mouse must be
generated at another random location on the
screen. At the same time, the length of the snake
must be increased with “one square”.
• The snake has initially three lives. A life is lost each
time the snake hits any edge of the screen. A new
life is earned after eating three mice consecutively.
The game ends when the snake loses all its lives or
it reaches 5 lives.
1
Details – initial scenario
320 pixels
240 pixels
Snake initially
moves upward
(has the size of a
“square”)
Mouse
generated at
random location
(has the size of a
“square”)
Details – snake size after eating 6 mice
Snake length
increases as mice
are eaten; its
body follows the
path dictated by
how the keyboard
arrows are
pressed
Mouse
generated at
random location
2
Requirements
• Movement of snake is updated periodically. The period of
update must be set through Timer 0 interrupt.
• Choose a period that makes your code efficient and the
display mimics the movement nicely.
• The “square” size should contain a number of pixels that
makes your game look good. Do not use just one pixel as
the square.
• On the left-top side of the LCD screen you should print the
number of current lives. More exactly, initially you should
print “Lives: 3” and then update the number accordingly.
• Optional (the implementation of each of these can earn you
up to 2.5% of the final grade in this course):
– Implement “levels” of difficulty. For example, the period of Timer
0 can be used to increase the speed of the snake and thus
increase the level of difficulty.
– Use the speaker on the board to generate different sounds when
a life is earned or lost.
Grading and due date
• The grade will be based on your demo and source
code only. No report is required.
• You must demo your implementation to Cris on
April 16 or 17 in the lab, when you will be asked to
provide a copy of the entire uVision project also.
Your code should be cleaned up (i.e., written neatly,
with nice indentation, and comments that describe
your code). You will lose points if your code is messy
and hard to read.
• You can work individually or as a team with your lab
partner only. However, if you work as a team and
decide to implement the features for extra credit,
the extra credit will be split equally between the two
team members.
3