So far, we have established that we would track several components in the game. These are listed here along with the variable name that we will use in our scripts:
- Number of Cucumber Beetles:
- numberOfCucumberBeetles
- Number of cucumbers:
- numberOfCucumbers
- Number of Cucumber Man lives:
- livesLeft
Based on what we decided earlier regarding the end-of-game condition, we can apply the following mathematical checks to determine if the game has ended and what the outcome is. Each end-of-game condition is listed in the following table along with the outcome:
Condition number | End-of-game condition | Outcome |
1 | numberOfCucumbers == 0 | Cucumber Beetles Win |
2 |
numberOfCucumberBeetles == 0 |
Cucumber Man Wins |
3 | livesLeft == ... |