26 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 higher 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 each pick a symbol randomly, and the selected symbols determine who the winner is. The allowed moves are paper, rock, scissors, lizard, Spock, and they interact as follows:

Scissors cut paper, paper covers rock, rock crushes lizard, ...

Get Get Programming with Scala now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.