Pseudocode for Snake Game:
- Main script function “snake” that includes all of the code. This is called when the file is run in MATLAB
- Clear all the windows and variables
- Load the highscore file into a matrix to be read
- Load the audio files into memory
- Declare all the variables necessary for the project
- Create the main figure called disp
- Set the properties of disp
- Display the mainMenu prompt
- Set the initial snake_body positions and properties
- Plot the egg on the graph
- While currently =1
- Run countDown function
- While running=1
- Move the snake positions, draw the new snake in position, check for collisions, and then pause in order to establish a frame rate.
- While this entire program is running, check for the user input and if certain keys are pressed, either end the current game or rotate the snake
- End running loop once a collision is detected with itself, if collision with egg, add to score and move egg to new position while increasing snake length.
- Close Menu prompt (if you want to play again, and high scores)
- Reset the game
- End currently loop if the user prompts too, if not, reset and play again.
- Close all windows
- End
Pseudocode for Tron Game:
- Main script function “tron” that includes all of the code. This is called when the file is run in MATLAB
- Clear all the windows and variables
- Declare all the variables necessary for the project
- Create the main figure called disp
- Set the properties of disp
- Display the mainMenu prompt
- Set the initial player positions and properties
- While this entire program is running, check for the user input and if certain keys are pressed, either end the current game or rotate the appropriate player
- While neither player’s score is above 3
- If the player’s score is less than 3, run countDown and set up game and start
- Else, closeMenu prompt
- While there is no collision detected
- Move the players positions, draw the players in position, check for collisions, and then pause in order to establish a frame rate.
- End loop once a collision is detected with itself or with others, then add to the appropriate player’s score
- Close Menu prompt (if you want to play again, and high scores)
- Reset the game
- End currently loop if the user prompts too
- Close all windows
- End