Created
March 16, 2016 20:31
-
-
Save u6f6o/279dddeb75ff9096c661 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defn init | |
| [board start-idx] | |
| (if-not (started? board) | |
| (init-game board start-idx) | |
| board)) | |
| (defn explore | |
| [board idx] | |
| (if-not (or (pos? (nth (:flags board) idx)) | |
| (pos? (nth (:explored board) idx)) | |
| (won? board) | |
| (lost? board)) | |
| (explore-cell board idx) | |
| board)) | |
| (defn flag | |
| [board idx] | |
| (if-not (or (pos? (nth (:explored board) idx)) | |
| (not (started? board)) | |
| (won? board) | |
| (lost? board)) | |
| (toggle-flag board idx) | |
| board)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment