From d0743dd466f0f0a419a2fdffc0fc2882316a0bb6 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Subject: [PATCH 30/39] separate out RUN-SOLVER to read from arbitrary streams --- src/lisp/solver.lisp | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/lisp/solver.lisp b/src/lisp/solver.lisp index bf2ab03..08471ad 100755 --- a/src/lisp/solver.lisp +++ b/src/lisp/solver.lisp @@ -107,12 +107,10 @@ ;; the letter is no longer in use (setf (letter-used ltr) nil))) -(defun run-solver-from-stdin () - "reads boards on stdin and solves them. A word per line is output. - An empty line separates the list of words for a board." +(defun run-solver (stream) (let* ((the-board (create-board - (board-from-stream *standard-input*))) + (board-from-stream stream))) (word (make-array 20 :initial-element #\Null :element-type 'character)) @@ -134,3 +132,8 @@ word 0 *dict-trie*))))))))) + +(defun run-solver-from-stdin () + "reads boards on stdin and solves them. A word per line is output. + An empty line separates the list of words for a board." + (run-solver *standard-input*)) -- 1.6.2