This commit is contained in:
2025-11-01 10:02:09 -07:00
parent 53fdd24093
commit aa1749559c

View File

@@ -1,5 +1,17 @@
# Minimax
TODO:
- refactor
- good agent
- branding
- pretty errors (compile + runtime)
- save + load scripts
- choose bulk run opponent + count
- docs
- Bad state: 9614807523\_
- Bad state: zero division
- Build docs
## Rules
@@ -9,28 +21,8 @@ On Red's board (i.e, duing the first round), Red's job is to maximize the value
Players take turns placing the fourteen symbols `0123456789+-×÷` on the board, with the maximizing player taking the first move.
A board's syntax must always be valid. Namely, the following rules are enforced:
- Each symbol may only be used once
- The binary operators `+-×÷` may not be next to one another, and may not be at the end slots.
- The unary operator `-` (negative) must have a number as an argument. Therefore, it cannot be left of an operator (like `-×`), and it may not be in the rightmost slot.
- `0` may not follow `÷`. This prevents most cases of zero-division, but isn't perfect. `÷-0` will break the game, and `÷0_+` is forbidden despite being valid syntax once the empty slot is filled (for example, with `÷03+`). This is done to simplyify game logic, and might be improved later.
## Building & Running
As always, run this project with `cargo run`. The app takes one argument by default: the name of the blue player. This can be any of the following:
- `human`: Play against a human
- `random`: Play against a random agent (very easy)
- `chase`: Play against a simple extremum-chasing agent (easy)
- `diffuse`: Play against a slightly more intellegent extremum chaser (medium)
- `brutus`: Play against a simple brute-force agent (hard)
For example, `cargo run -- random` will start a game against a random player. Use your arrow keys and space bar to play.
Additional options are available, see `cargo run -- --help`.
Win rates against random are as follows:
- `human`: ~100%
- `random`: ~50%
- `chase`: ~70%
- `diffuse`: ~76%
- `brutus`: ~90%
- Each symbol may only be used once
- The binary operators `+-×÷` may not be next to one another, and may not be at the end slots.
- The unary operator `-` (negative) must have a number as an argument. Therefore, it cannot be left of an operator (like `-×`), and it may not be in the rightmost slot.
- `0` may not follow `÷`. This prevents most cases of zero-division, but isn't perfect. `÷-0` will break the game, and `÷0_+` is forbidden despite being valid syntax once the empty slot is filled (for example, with `÷03+`). This is done to simplyify game logic, and might be improved later.