Lesson 26 Capstone 4: Rock, Paper, Scissors, Lizard, Spock!
In this capstone, you will:
- Implement the main components of your game using case classes and case objects
- Manipulate immutable data using high order and pure functions
- Represent nullable values using Option
- Use tuples to group elements together
- Define unapply methods to pattern match on classes
In this capstone, you’ll implement an HTTP server to play a popular variation of the classic game “Paper, Rock, Scissors!”, called “Rock, Paper, Scissors, Lizard, Spock!”. Two players play the game by each picking a symbol randomly: the selected symbols determine who the winner is. The allowed moves are Paper, Rock, Scissors, Lizard, Spock and they interact as follows:
“Scissors cuts paper, paper covers rock, rock crushes lizard, lizard poisons Spock, Spock smashes scissors, scissors decapitates lizard, lizard eats paper, paper disproves Spock, Spock vaporizes rock, rock crushes scissors.”
If both players pick the same symbol, your application will not select a winner and declare the game a tie. Have a look at figure 26.1 for a visual representation of the rules for “Rock, Paper, Scissors, Lizard, Spock!”.
Figure 26.1: “Rock, Paper, Scissors, Lizard, Spock!” has five symbols: Scissors, Paper, Rock, Lizard, Spock. The diagram summarizes the interaction between the symbols: you will use them in your implementation to determine the winner (if any).
