-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadded-wrappers.lisp
30 lines (26 loc) · 1.02 KB
/
added-wrappers.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Base: 10 -*-
;;; Last Updated : 2011/12/22 19:52:52 tkych
(in-package :cl-sudoku)
;;--------------------------------------------------------------------
;; Wrappers for interface added by tkych
;;--------------------------------------------------------------------
;;; added by tkych
(defun make-puzzle (&optional (n 17))
(let ((grid (random-puzzle n)))
(if (solved? (solve grid))
(with-output-to-string (*standard-output*)
(display (grid-values grid)))
(make-puzzle n))))
;;; added by tkych
(defun solve-it (&optional (grid *))
(let* ((start (get-internal-run-time))
(values (solve grid))
(run-time (/ (- (get-internal-run-time) start)
internal-time-units-per-second
1.0)))
(if (null values)
(format t "Fail")
(progn
(display values)
(format t "~%(~,2F seconds)~%" run-time)))))
;;--------------------------------------------------------------------