An implementation of Yahtzee, in Clojure.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



This is a small implementation of the Yahtzee rules, implemented in Clojure.

There is a very basic single player UI, which can be used from a CLojure REPL.

Note the the ui is non-functional but the rest of the game (apart from rolling the dice) is purely functional.

Here’s an example session:

user> (use 'yahtzee.ui.repl)

user> (in-ns 'yahtzee.ui.repl)
#<Namespace yahtzee.ui.repl>

yahtzee.ui.repl> (new-game)
{:card {}, :dice nil, :rolls-left 3}

yahtzee.ui.repl> (roll)
{:card {}, :dice (4 1 2 2 5), :rolls-left 2}

yahtzee.ui.repl> (roll 2 3)
{:card {}, :dice (2 2 2 1 6), :rolls-left 1}

yahtzee.ui.repl> (roll 0 1 2)
{:card {}, :dice (2 2 2 6 1), :rolls-left 0}

yahtzee.ui.repl> (score :twos)
{:card {:twos 6}, :dice nil, :rolls-left 3}

yahtzee.ui.repl> (roll)
{:card {:twos 6}, :dice (6 5 5 2 6), :rolls-left 2}

yahtzee.ui.repl> (roll 0 1 2 4)
{:card {:twos 6}, :dice (6 5 5 6 6), :rolls-left 1}

yahtzee.ui.repl> (score :full-house)
{:card {:full-house 25, :twos 6}, :dice nil, :rolls-left 3}

The list of scoring keywords is:

  • :ones
  • :twos
  • :threes
  • :fours
  • :fives
  • :sixes
  • :three-of-a-kind
  • :four-of-a-kind
  • :full-house
  • :low-straight
  • :high-straight
  • :yahtzee
  • :chance

Bonuses are scored automatically.


This file is part of Andrew’s Yahtzee.

Andrew’s Yahtzee is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Andrew’s Yahtzee is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Andrew’s Yahtzee. If not, see