Created
October 23, 2015 04:42
-
-
Save lowellbander/684d3b3e82827c2c6d16 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
| (defun h204156534 (s) | |
| (cond | |
| ((null s) 0) | |
| (t (+ (delta (first s) 0 0) (h204156534 (rest s)))) | |
| ) | |
| ) | |
| ; DELTA returns the absolute value of the difference between the number of | |
| ; boxes and goals in ROW. BOXCARRY and GOALCARRY are both expected to have value | |
| ; 0 when DELTA is called by a function other than itself. | |
| (defun delta (row boxCarry goalCarry) | |
| (cond | |
| ((null row) (absolute (- boxCarry goalCarry))) | |
| ((isBox (first row)) (delta (rest row) (+ 1 boxCarry) goalCarry)) | |
| ((isStar (first row)) (delta (rest row) boxCarry (+ 1 goalCarry))) | |
| (t (delta (rest row) boxCarry goalCarry)) | |
| ) | |
| ) | |
| ; ABSOLUTE returns the absolute value of VALUE. | |
| (defun absolute (number) | |
| (cond | |
| ((< number 0) (- number)) | |
| (t number) | |
| ) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment