show final board
This commit is contained in:
parent
a7ddb0ff78
commit
e5615419b1
1 changed files with 4 additions and 5 deletions
|
|
@ -35,7 +35,7 @@
|
||||||
(while (not (pq-empty? frontier))
|
(while (not (pq-empty? frontier))
|
||||||
(let-values ([(node cost) (pop!)])
|
(let-values ([(node cost) (pop!)])
|
||||||
(when (win? node)
|
(when (win? node)
|
||||||
(return node cost))
|
(return cost node))
|
||||||
|
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (neighbor)
|
(lambda (neighbor)
|
||||||
|
|
@ -228,8 +228,7 @@
|
||||||
'(-1 1 0 0))))
|
'(-1 1 0 0))))
|
||||||
|
|
||||||
(define (min-steps b)
|
(define (min-steps b)
|
||||||
(define-values (final-board steps) (ucs b board-succ board-won?))
|
(ucs b board-succ board-won?))
|
||||||
steps)
|
|
||||||
|
|
||||||
;; by David Buchweitz
|
;; by David Buchweitz
|
||||||
(define steaming-hot
|
(define steaming-hot
|
||||||
|
|
@ -278,8 +277,8 @@
|
||||||
|
|
||||||
|
|
||||||
(define (main . args)
|
(define (main . args)
|
||||||
(format #t "~a\n"
|
(define-values (cost node) (min-steps (string->board (get-string-all (current-input-port)))))
|
||||||
(min-steps (string->board (get-string-all (current-input-port))))))
|
(format #t "~a\n~a\n" cost node))
|
||||||
|
|
||||||
;; TODO: lol i have immutable board movement, so just make this actually playable
|
;; TODO: lol i have immutable board movement, so just make this actually playable
|
||||||
;; with super easy undo lol
|
;; with super easy undo lol
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue