Index of values


A
all_pairs [Ps1]
all_pairs xs returns the cartesian product of the list xs with itself.
always_plays [Ps1]
always_plays x returns a player that always plays the move x
always_rock [Ps1]
The always_rock player always returns Rock.

B
beats_last [Ps1]
The player represented by beats_last always plays the move that beats the previous move made by the opponent.

P
pair_filter [Ps1]
pair_filter compare xs breaks xs into adjacent pairs and applies compare to the components of each pair.

R
rps_game [Ps1]
rps_game a b repeatedly runs rock-paper-scissors rounds until either a or b wins.
rps_round [Ps1]
rps_round a b accepts two symbols, a and b, and determines the winner.
rps_round_enum [Ps1]
The function rps_round_enum adheres to the specification of rps_round but using the move and result types rather than string and int.
rps_round_nested_match [Ps1]
An alternate implementation of the rps_round_enum specification
rps_round_single_match [Ps1]
An alternate implementation of the rps_round_enum specification
rps_round_with_helper [Ps1]
An alternate implementation of the rps_round_enum specification

T
test_all_rps [Ps1]
test_all_rps fs returns true if List.mem f fs and List.mem g fs implies that for all pairs move1, move2 of type move
f move1 move2 = g move1 move2
test_rps_eq [Ps1]
The test_rps_eq function takes two variant implementations of rps_round and returns true if they agree on all possible inputs.
tournament [Ps1]
tournament compare l repeatedly applies pair_filter compare to l until only a single element remains.