-
-
Save stevenleeg/89568e4ad9fcbb3025c0 to your computer and use it in GitHub Desktop.
This file contains 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
;; Finds the row with the least number of conflicts | |
(define (min-conflict-row board cx) | |
(min-conflict-row-r board cx 0 (+ (vector-length board) 1) 9)) | |
(define (min-conflict-row-r board cx cy mini row-conflicts) | |
(cond | |
[(>= cy (vector-length board)) | |
(vector-ref row-conflicts mini)] | |
[(< | |
(begin | |
(define new-board (vector-copy board)) | |
(vector-set! new-board cx cy) | |
(vector-set! | |
row-conflicts | |
cy | |
(vector-ref | |
(gen-conflicts-test new-board (make-vector (vector-length board) 0) cx 0 0) cx)) | |
(vector-ref row-conflicts cy)) | |
(vector-ref row-conflicts mini)) | |
(min-conflict-row-r board cx (+ cy 1) row-conflicts)] | |
[else | |
(min-conflict-row-r board cx (+ cy 1) mini row-conflicts)])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment