Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active March 1, 2017 20:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deque-blog/fe2ec1188e63de25c4f4d9bf57e2204e to your computer and use it in GitHub Desktop.
Save deque-blog/fe2ec1188e63de25c4f4d9bf57e2204e to your computer and use it in GitHub Desktop.
(def winning-diags
[(filter #(= (first %) (second %)) board/coordinates)
(filter #(= (dec board/size) (reduce + %)) board/coordinates)])
(def winning-rows (partition board/size board/coordinates))
(def winning-lines (algo/transpose winning-rows))
(def winning-cell-sets (concat winning-rows winning-lines winning-diags))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment