Created
February 12, 2011 23:50
-
-
Save naush/824251 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 suicide? [board point color size] | |
| (let [board (assoc board point color) | |
| enemy (find-enemy board point color size) | |
| ally (find-ally board point color size)] | |
| (and (reduce #(and %1 (> (count (find-liberty %2)) 0)) true enemy) | |
| (= (count (find-liberty ally)) 0)))) | |
| (defn legal? [board point color size ko] | |
| (and (not (= ko point)) | |
| (not (out-of-bound point size)) | |
| (gray? board point size) | |
| (not (suicide? board point color size)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment