Skip to content

Commit db79429

Browse files
committed
Update Rock-Paper-Scissors readme
1 parent 0c26690 commit db79429

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

Diff for: examples/rps/README.md

+27-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,36 @@
11

2-
## Rock-Paper-Scissors
2+
# Rock, Paper, Scissors (RPS) with Bitcoin Protocol
33

4-
Rock-Paper-Scissors is an interactive game between two players who lock some money into a UTXO, and then proceed to play the game; the winner will get the sats.
4+
This script implements the Rock, Paper, Scissors game based on a protocol described [here](https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2023-May/021599.html).
55

6-
Play as Alice:
76

8-
```console
9-
$ python rps.py --alice --rock
7+
## Prerequisites
8+
9+
After following the [root prerequisites](../..#prerequisites), make sure to install the additional requirements:
10+
11+
```bash
12+
$ pip install -r requirements.txt
1013
```
1114

12-
On a separate terminal, play as Bob:
15+
## How to Run:
1316

14-
```console
15-
$ python rps.py --alice --scissors
17+
The game can be played as either Alice or Bob, and you can specify your move (rock, paper, scissors). Additionally, other options like non-interactive mode and automatic mining can be set.
18+
19+
```bash
20+
python rps.py --alice/--bob [--rock/--paper/--scissors] [--non-interactive] [--mine-automatically] [--host HOST] [--port PORT]
1621
```
1722

18-
The two scripts will communicate via a socket in order to coordinate the initial UTXO creation; once the game is funded, they take turns to spend it according to the rules.
23+
In order to play a game, run `python rps.py --alice` on a shell, and `python rps.py --bob` on a separate shell.
24+
25+
The two scripts will establish a socket to communicate and negotiate a game UTXO.
26+
27+
Once the UTXO is funded (NOTE: it must be funded externally), the two scripts proceed to play the game.
28+
29+
### Arguments:
30+
31+
- `--alice` / `--bob`: Specify the player you want to play as.
32+
- `--rock` / `--paper` / `--scissors`: Specify your move. If ommitted, a random move is chosen.
33+
- `--non-interactive`: Run in non-interactive mode (if not enabled, the user has to confirm each action).
34+
- `--mine-automatically`: Enable automatic mining when transactions are broadcast.
35+
- `--host`: Specify the host address (default is `localhost`).
36+
- `--port`: Specify the port number (default is `12345`).

0 commit comments

Comments
 (0)