Created
May 3, 2020 00:02
-
-
Save jackcallister/42ac8ce0772d8ba0a31db11b33ddbfe5 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
(def puzzle [ 3 0 0 0 0 5 0 1 0 | |
0 7 0 0 0 6 0 3 0 | |
1 0 0 0 9 0 0 0 0 | |
7 0 8 0 0 0 0 9 0 | |
9 0 0 4 0 8 0 0 2 | |
0 6 0 0 0 0 5 0 1 | |
0 0 0 0 4 0 0 0 6 | |
0 4 0 7 0 0 0 2 0 | |
0 2 0 6 0 0 0 0 3 ]) | |
(defn index-of [pos] | |
(let [[file rank] pos | |
x (- (int file) (int \A)) | |
y (- (int rank) (int \0))] | |
(+ x (* 8 y)))) | |
(index-of "A0") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment