Skip to content

Instantly share code, notes, and snippets.

@fogus
Created August 11, 2011 20:32
Show Gist options
  • Save fogus/1140680 to your computer and use it in GitHub Desktop.
Save fogus/1140680 to your computer and use it in GitHub Desktop.
Function to chech if 2 chessboard squares are in the same diagonal
(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