Rock Paper Scissors
Rules summary
| Min seats | 2 |
|---|---|
| Max seats | 2 |
| Base URI | http://volity.org/games/rps |
Rock Paper Scissors (a.k.a. RPS) is a very simple two-player game of luck, with a dash of bluffing skill thrown in. In real life, it is often used to quickly settle minor disputes between two parties (and, in the case of tied games, is played repeatedly until one player wins a bout).
Because of its very simple nature, it is the Volity core development team official testing game.
Setup
Each player must have the ability to "throw" a hand: one of rock, paper, or scissors. In UI terms, a set of three big buttons will suffice here.
Play
Each player "throws" his or her hand, which is sent secretly to the game server. When the server collects both hands, it reveals the game's result to both players, and ends the game.
Scissors beats paper, paper beats rock, and rock beats scissors. If both players throw the same hand type, the game is a draw.
Volity API
Notes
Among the arguments, hand refers to a character string identifying one of the regular three hand types, by name. Since each of these types happens to start with a unique letter -- r, p, or s -- it need only be that first letter, in lowercase. Extra characters can be ignored by the receiving party.
The basic flow of a single round of RPS simply involves the referee collecting choose_hand() RPCs from both players, and then revealing the choices by sending player_chose_hand() to both seats (and all spectators) simultaneously.
Referee-to-Client RPCs
Setup
If the argument is 1, this is a request that matched throws don't count, and require a rethrow by both players.
If the argument is 0, this requests that matched hands count as a tie (and therefore a win for both players).
Request to set the length of the game, in terms of the maximum number of throws (not counting ties, if used in conjunction with no_ties(1)). The argument must be a positive, odd integer. The game will end when either player achieves a number of wins exceeding one half of this number.
Play
The player wishes to throw the given hand.
Player-to-Referee RPCs
Setup
The seat with the given ID has declared that ties don't count and require a rethrow (if the argument is 1), or that they count as a two-way win (if the argument is 0).
The seat with the given ID has declared the the game to be a best-of-N competition.
Play
The seat with the given ID threw the given hand.
Seat IDs
No seats are required.
player1player2
Error codes
This ruleset does not specify any error or translation tokens.