ASSIGNMENT 5: The Snake Game DEPARTMENT AND COURSE NUMBER COMP 1010 3
Question 1: Simple Snake [4 marks Start anew program. Define
ROWS,
COLS, and
SQ_SIZE, and use the correct values in the
sizecommand, as in Phase 0.
Add your drawCirclesand
fillArrayfunctions from Phase 0. Use global partially-full arrays to store the (x,y) coordinates of all of the circles that form the snake (as grid coordinates, not pixels. This includes a variable to control the
current length of the snake. Make the arrays big enough to store a snake that fills the entire
canvas which will never happen, but it will give you plenty of room. Define a variable
Share with your friends: