Paper-rock-scissors—not working properly

I attempted to create a paper-rock-scissors situation, but something is not right. The scores change in a way that seems random. Can someone point out the bug, please?

"Paper Rock Scissors" by "Giannis G."

Section 1 - Rules of the game

Playing PRS is a truth state that varies.

The round count is a number that varies.

Hand is a kind of value. The hands are paper, rock, and scissors.

The opponent's hand is a hand that varies.

The player's score is a number that varies. The opponent's score is a number that varies.

Victory relates one hand to one hand. The verb to win means the victory relation.

Paper wins rock. Rock wins scissors. Scissors wins paper.

Drawing a hand is an action applying to one hand.

Understand "draw [hand]" or "show [hand]" or "play [hand]" or "[hand]" as drawing a hand when playing PRS is true.

Carry out drawing a hand:
	if the round count is 5:
		finish the game;
	else:
		let the opponent's hand be a random hand;
		if the hand understood wins the opponent's hand:
			increment the player's score;
		else if the opponent's hand wins the hand understood:
			increment the opponent's score;
		increment the round count.

Report drawing a hand:
	say "You draw [hand understood] and the Orc draws [opponent's hand]."
	
To start the game:
	now the round count is 1;
	now the opponent's score is 0;
	now the player's score is 0;
	now playing PRS is true;
	now the left hand status line is "You: [player's score]";
	now the right hand status line is "Orc: [opponent's score]".
	
To finish the game:
	say "OK, that's enough.";
	now playing PRS is false;
	now the left hand status line is "[the player's surroundings]";
	now the right hand status line is "".

Section 2 - Production design

White Dungeon is a room. The Orc is a man in the White Dungeon.

The wooden door is a door. It is north of the White Dungeon.

Instead of opening the wooden door:
	say "The Orc steps in front of you and says: 'You first beat me.' Oh-oh...[paragraph break]You count to three, simultaneously, ready to draw paper, rock, or scissors...";
	start the game.

The problem is the line

let the opponent's hand be a random hand;

which should be

now the opponent's hand is a random hand;

(You want to update the global variable, not create a local one.)

Oops! Yes, that makes sense!

And in honor of the Big Bang theory, here’s Rock, paper, scissors, lizard, Spock.

[code]playing rpsls is a truth state that varies.

The round count is a number that varies.

Hand is a kind of value. The hands are rock, paper, scissors, lizard and Spock.

The opponent’s hand is a hand that varies.

The player’s score is a number that varies. The opponent’s score is a number that varies.

Victory relates one hand to one hand. The verb to win means the victory relation.

Paper wins rock. Rock wins scissors. Scissors wins paper. Rock wins lizard. Lizard wins spock. Spock wins scissors. Scissors wins lizard. Lizard wins paper. Paper wins spock. Spock wins rock.

Drawing a hand is an action applying to one hand.

Understand “draw [hand]” or “show [hand]” or “play [hand]” or “[hand]” as drawing a hand when playing rpsls is true.

Carry out drawing a hand:
if the round count is 5:
finish the game;
else:
now the opponent’s hand is a random hand;
if the hand understood wins the opponent’s hand:
increment the player’s score;
else if the opponent’s hand wins the hand understood:
increment the opponent’s score;
increment the round count.

Report drawing a hand:
say “You draw [hand understood] and the Orc draws [opponent’s hand].”

To start the game:
now the round count is 1;
now the opponent’s score is 0;
now the player’s score is 0;
now playing rpsls is true;
now the left hand status line is “You: [player’s score]”;
now the right hand status line is “Sheldon: [opponent’s score]”.

To finish the game:
say “OK, that’s enough.”;
now playing rpsls is false;
now the left hand status line is “[the player’s surroundings]”;
now the right hand status line is “”.[/code]

This is brilliant! I actually had to draw this diagram to digest it.

And the scene can be watched here.