Rock paper scissors Spock lizard

Rock paper scissors Spock lizard#

You must have played Rock paper scissors in your childhood. In this problem, we will implement a variation with Spock and lizard shapes which we refer to as RPSSL.

https://upload.wikimedia.org/wikipedia/commons/b/b4/Roshambo-Laos.jpg

Fig. 12 Children in Laos playing rock paper scissors
CC BY-SA 3.0. By Thomas Schoch. Source: Wikimedia Commons
#

RPSSL shapes are resolved as in Fig. 13.

https://upload.wikimedia.org/wikipedia/commons/a/ad/Pierre_ciseaux_feuille_l%C3%A9zard_spock_aligned.svg

Fig. 13 RPSSL resolution diagram. ️a->b means a wins against b.
CC BY-SA 3.0. By DMacks (talk). Source: Wikimedia Commons
#

Example run:

Welcome to πŸͺ¨  βœ‚οΈ  πŸ—’οΈ  πŸ––  🦎 !
(s) Single player
(e) Exit
Select an item: s
Starting game πŸŽ‰

Select a shape:
0πŸͺ¨  || 1🦎  || 2βœ‚οΈ  || 3πŸ—’οΈ  || 4πŸ–– : 90
❌ Shape key 9 does not exist. Try again.

Select a shape:
0πŸͺ¨  || 1🦎  || 2βœ‚οΈ  || 3πŸ—’οΈ  || 4πŸ–– : 0
Agent: 2
πŸ‘«:πŸ€–  1:0

Select a shape:
0πŸͺ¨  || 1🦎  || 2βœ‚οΈ  || 3πŸ—’οΈ  || 4πŸ–– : 2
Agent: 2
πŸ‘«:πŸ€–  1:0

Select a shape:
0πŸͺ¨  || 1🦎  || 2βœ‚οΈ  || 3πŸ—’οΈ  || 4πŸ–– : 0
Agent: 4
πŸ‘«:πŸ€–  1:1

...

Select a shape:
0πŸͺ¨  || 1🦎  || 2βœ‚οΈ  || 3πŸ—’οΈ  || 4πŸ–– : 1
Agent: 0
πŸ‘«:πŸ€–  2:5
πŸ€– Agent won!

Expectations:

  • has an entry menu

  • the agent can play randomly

  • shows score after each shape comparison

  • can handle wrong input both in the menu and gameplay, e.g., by showing an error message

    • in case you know EOF: you don’t have to handle it

  • if a player reaches the WINNING_SCORE

    • then this player wins

    • the program exits.

Important

Applies to all problems: you may override expectations and be creative, as long as your design decisions make sense to you and you can explain it.

Activity 21 (Flowchart v1 – overview)

Draw a flowchart for the problem. First focus on the menu and leave the details of a game round (until someone wins) out. In other words, represent a game round with a single process.

Activity 22 (Needed language syntax)

Break the flowchart down into language components. Which syntax from C can we use?