Skip to content

Instantly share code, notes, and snippets.

Last active Mar 1, 2017
What would you like to do?
(defn get-owner-at
"Get the owner associated to the cell"
[board coord]
{:pre [(coordinates? coord)]}
(get board coord))
(defn has-owner?
"Check whether the coord has an owner associated to it"
[board coord]
{:pre [(coordinates? coord)]}
(not= (get-owner-at board coord) :owner/none))
(defn convert-cell
"Assign the cell [x y] to a new player"
[board player coord]
{:pre [(coordinates? coord)
(not (has-owner? board coord))]}
(assoc board coord player))
(defn full-board?
"Verifies whether the board has any empty cell left"
(not-any? #{:owner/none} (vals board)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment