https://github.com/idabmat/yatzy
An implementation of the Yatzy game.
https://github.com/idabmat/yatzy
elixir game yatzy
Last synced: over 1 year ago
JSON representation
An implementation of the Yatzy game.
- Host: GitHub
- URL: https://github.com/idabmat/yatzy
- Owner: idabmat
- License: mit
- Created: 2020-04-15T03:03:24.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-03T02:50:27.000Z (about 6 years ago)
- Last Synced: 2025-01-24T11:44:34.294Z (over 1 year ago)
- Topics: elixir, game, yatzy
- Language: Elixir
- Homepage:
- Size: 60.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README

# Yatzy
An implementation of the Yatzy game.
## Installation
The package is [available in Hex](https://hex.pm/packages/yatzy), it can be installed
by adding `yatzy` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:yatzy, "~> 1.0.0"}
]
end
```
## Usage
Start a game with `Yatzy.new_game(["Alice", "Bob"])`. This return the game state. All subsequent
interactions are done by providing the game state:
- `Yatzy.roll(game_State, "Alice")` to roll all dice for a player.
- `Yatzy.roll(game_state, "Alice", reroll: [1, 2, 3])` to reroll only the 1st, 2nd and 3rd dice.
- `Yatzy.save(game_state, "Alice", :ones)` to save the current roll under a given line in the
player's score sheet. This also terminates that player's turn.
- `Yatzy.end_game(game_state)` to finish the game. The game state returned will include the final
result including the name of the winners and whether it was a clear win or a draw.
## Documentation
Documentation can be found at [https://hexdocs.pm/yatzy](https://hexdocs.pm/yatzy).