fours 0.1.0

Four in a row in your terminal, with three levels of opponent.
Documentation
# fours

[![CI](https://github.com/cazeth/fours/actions/workflows/ci.yml/badge.svg)](https://github.com/cazeth/fours/actions/workflows/ci.yml)
[![Crates.io](https://img.shields.io/crates/v/fours.svg)](https://crates.io/crates/fours)
[![Documentation](https://docs.rs/fours/badge.svg)](https://docs.rs/fours)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Rust 1.88+](https://img.shields.io/badge/rust-1.88%2B-orange.svg)](#minimum-supported-rust-version)
[![Built with ratatui](https://img.shields.io/badge/built%20with-ratatui-d79921.svg)](https://ratatui.rs)
[![Built with tudi](https://img.shields.io/badge/built%20with-tudi-458588.svg)](https://crates.io/crates/tudi)

Four in a row in your terminal, against an opponent you can change mid-game.

![A game against the hard opponent](https://raw.githubusercontent.com/cazeth/fours/main/demo.gif)

## 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.

| Key                  | What it does                      |
| -------------------- | --------------------------------- |
| `←` `→`, `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.

| Level  | How the opponent plays                                                             |
| ------ | ---------------------------------------------------------------------------------- |
| 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).