Outline
In this video
We move the HTML and functionality of the game grid into the new gamegrid child component
Assignment:
- Start the initial code to determine if the game is over.
- Create a new method that will be called by the selectTile method in the gamegrid component that will check for the end condition.
- Name this method checkForWinner.
- The end condition is if either both red or both blue tiles are selected, or if the assassin tile is selected.
- Determine if both blue or both red are selected by simply keeping count of when a blue or red tile is selected (in two different properties) and when either of those properties reaches 2, then the game is over.
- Name those properties blueTilesSelected and redTilesSelected. Default those properties to zero. Increment them when either a blue or red tile is selected.
- Just log out to the console that the game is over in any of the 3 cases.