Created
March 26, 2011 22:17
-
-
Save spratt/888690 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun ttt-print (board) | |
"Prints a tic-tac-toe board." | |
(let* ((symbol nil) | |
(nl (string #\Newline)) | |
(str (concatenate 'string | |
"S|S|S" nl | |
"-|-|-" nl | |
"S|S|S" nl | |
"-|-|-" nl | |
"S|S|S" nl))) | |
(loop for i from 0 below (length str) do | |
(when (equal #\S (char str i)) | |
(progn | |
(setq symbol (pop board)) | |
(if (equal nil symbol) | |
(setf (char str i) #\Space) | |
(setf (char str i) (char (symbol-name symbol) 0)))))) | |
(format t str))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment