Created
August 11, 2011 20:32
-
-
Save fogus/1140680 to your computer and use it in GitHub Desktop.
Function to chech if 2 chessboard squares are in the same diagonal
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
(define (in-same-diagonal cell1 cell2) | |
(let((diff (map (compose abs -) cell1 cell2))) | |
(and (not (zero? (cadr diff))) | |
(= 1 (apply quotient diff)) | |
(= 0 (apply modulo diff))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment