This page includes the Pseudocode for the flow of Grass Simulator 2018.
Pseudocode for main:
- Start.
- Initialize Events class called events, includes functions used.
- Initialize variable used for the menus and playing the game.
- Display main menu.
- Wait for touch and release of screen
- Run the code for pressed option from the player (play game, instructions, options, statistics, credits, or quit).
- If “play game” pressed:
- Initialize any additional variables used for the game.
- Start gameplay.
- Display current state of grass and current day.
- Calculate random number.
- If random number in a certain interval, display that random event and its options.
- Wait for touch and release of screen.
- Display results of pressed option.
- Display in-game menu.
- Wait for touch and release of screen.
- If a grass tending option is pressed, display current grass, the animation, and then the updated grass.
- If “quit current run” option is chosen, display “game over” screen and return to main menu.
- If grassHealth = 0, demerits = x, or grassHeight > 35, display “game over” screen and return to main menu.
- Increment day counter and return to gameplay start.
- If “instructions” pressed:
- Display instructions for the game.
- Wait for touch and release of screen.
- Return to main menu.
- If “options” pressed:
- Display options menu.
- Wait for touch and release of screen.
- When an option is chosen, move the black block next to the chosen difficulty/option and adjust the variable/function associated with that difficulty/option.
- Stay on menu when an option is chosen.
- If “go back” is pressed, return to main menu.
- If “statistics” is pressed:
- Display current statistics.
- Wait for touch and release of screen.
- If “RESET STATS” pressed, set all stats to zero and return to main menu.
- If elsewhere pressed return to main menu.
- If “credits” pressed:
- Display credits including members, team name, and inspirations.
- Wait for touch and release of screen.
- Return to main menu.
- If “quit” pressed:
- Clear screen.
- Display end game screen.
- If anywhere else is pressed return to main menu
- Stop.