# fours
[](https://github.com/cazeth/fours/actions/workflows/ci.yml)
[](https://crates.io/crates/fours)
[](https://docs.rs/fours)
[](LICENSE)
[](#minimum-supported-rust-version)
[](https://ratatui.rs)
[](https://crates.io/crates/tudi)
Four in a row in your terminal, against an opponent you can change mid-game.

## Install
```sh
cargo install fours
```
## Play
```sh
fours
```
You are red and you move first. The opponent answers straight away, and the board is drawn a little
larger when the window has room for it.
| `←` `→`, `h` `l` | Move between columns |
| `1` … `9` | Point at a column |
| `⏎`, space, `↓`, `j` | Place a disc |
| `d` | Next level, easy again after hard |
| `r` | Start a new game |
| `q`, `esc`, `ctrl-c` | Leave |
Changing the level swaps the opponent and leaves the board alone, so you can finish a game against
someone else.
| Easy | Places discs anywhere legal. |
| Medium | Takes a win when it has one, avoids handing you one, and plays towards the middle. |
| Hard | Searches ahead with alpha beta pruning and judges what it cannot see the end of. |
## Options
```text
--difficulty <name> Play against easy, medium or hard [default: medium]
--columns <number> Columns of the board [default: 7]
--rows <number> Rows of the board [default: 6]
--seed <number> Seed of the opponent, for a reproducible game
-h, --help Show the help text
-V, --version Show the version
```
## Minimum supported Rust version
Rust 1.88. Raising it is a breaking change and comes with a minor version bump. The version is
checked on every push, next to the test suite on Linux, macOS and Windows.
## Contributing
Contributions are welcome!
## License
[MIT](LICENSE).