Permalink
Browse files

Add winner function

  • Loading branch information...
1 parent c610ddf commit f3cd717db07d05a62e0f4e624301a875e81e6297 @reiddraper committed Apr 15, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/crosscram/core.clj
View
@@ -84,6 +84,10 @@
:horizontal (not (can-play-horizontal? (:board game)))
:vertical (not (can-play-vertical? (:board game)))))
+(defn winner [game]
+ (when (over? game)
+ (:player (last (:history game)))))
+
(defn play-piece [game pos-a pos-b]
(cond
;; is the game already over?

0 comments on commit f3cd717

Please sign in to comment.