Snake Model - Gauge/snake GitHub Wiki
snake = [ [4,2], [4,1], [4,0] ];
snakeDirection = UP : DOWN : LEFT : RIGHT;
snakeSpeed = Milliseconds : Seconds?
apple = (6, 3);
appleEaten = (5, 5);
boardSize = 20;
gameState = PLAY : PAUSE : GAMEOVER
// create and place snake
// create and place an apple
// call render function
initGame();
// get keyboard input
// update game variables
// render graphics
render();
// draws the score
// draw boarder
drawGui();
// loop through the each seciton of the snake and draw on each coordinant
drawSnake();
// draw the apple at its location
drawApple();
// wall ditection
// move snake
// test for apple eaten
updateSnake();
// returns true if snake head is >= 0 and < 20
isValidMove();
// 1 generate random x and y coordinance
// 2 check to see if new location is occupied by the snake
// if it is go to 1 else return x and y
randomApple();
// get keyboard input
getKeyBoardInput();