diff --git a/min-steps.scm b/min-steps.scm index 9a7d148..8139795 100755 --- a/min-steps.scm +++ b/min-steps.scm @@ -35,7 +35,7 @@ (while (not (pq-empty? frontier)) (let-values ([(node cost) (pop!)]) (when (win? node) - (return node cost)) + (return cost node)) (for-each (lambda (neighbor) @@ -228,8 +228,7 @@ '(-1 1 0 0)))) (define (min-steps b) - (define-values (final-board steps) (ucs b board-succ board-won?)) - steps) + (ucs b board-succ board-won?)) ;; by David Buchweitz (define steaming-hot @@ -278,8 +277,8 @@ (define (main . args) - (format #t "~a\n" - (min-steps (string->board (get-string-all (current-input-port)))))) + (define-values (cost node) (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 ;; with super easy undo lol