![]() StartingPoints Referenced by
|
The Code So Far - Ladder 1
Keywords: Tactics
This is the first problem in Lessons in the Fundmentals Of Go. What level is this problem? 15 kyu? Not that it matters, computers should be good at ladders. My code manages to solve this problem. Its initial answer, due to a bug in the print routine (print the longest winning line, not the min-max line,) produces a strange solution:
It's funny how hard even printing out the program's analysis can be. For now, I just print the longest line in which both players moves conform to the solution (killable ladders do actually get killed, and vice versa.) (defmethod make-pretty ((analyzer ladder-analyzer)) (let ((children (mapcar #'make-pretty (children analyzer)))) (if (null children) (cons 1 analyzer) (progn (setf children (sort children (lambda (a b) (let ((score-a (if (eq (current-goodness (cdr a)) (current-goodness analyzer)) 0 (car a))) (score-b (if (eq (current-goodness (cdr b)) (current-goodness analyzer)) 0 (car b)))) (> score-a score-b))))) (setf (children analyzer) (mapcar #'cdr children)) (setf (variations (game analyzer)) (mapcar #'game (children analyzer))) (cons (1+ (caar children)) analyzer) )))) This is a copy of the living page "The Code So Far - Ladder 1" at Sensei's Library. ![]() |