How I can draw grid ( square board 5x5) using Lisp?
Here is an example (I am sorry my drawing is very bad!!) .. (each cell has to be locked cells but I could not draw this here and I could not upload image that can explain everything)
The board should be consists of + (in corners) and - (in the edges) ( Plus and Minus)
+ - - - - -+- - - -- - -+- - - -- - - -+- - - - - - +- - - - - -+
+ - - - - -+- - -- - - -+- - - - - - -+- - - - - - +- - - - - -+
+ - - - - -+- - -- - - -+- - - - - - -+- - - - - - +- - - - - -+
+ - - - - -+- - -- - - -+- - - - - - -+- - - - - - +- - - - -- +
+ - - - - -+- - -- - - -+- - -- - - - -+- - - - - - +- - - -- - -+
+ - - - - -+- - -- - - -+- - - - - - -+- - - - - - +- - - - - -+
How to draw board
-
- Posts: 166
- Joined: Sun Nov 28, 2010 4:21 pm
Re: How to draw board
Use nested DOTIMES loops
-
- Posts: 43
- Joined: Mon Aug 26, 2013 9:24 pm
Re: How to draw board
Give this a try:
You could also modify this to draw vertical bars | on the sides but that isn't what your picture showed.
Code: Select all
(defun draw-board (num-across num-down square-width)
(dotimes (y num-down)
(dotimes (x num-across)
(princ "+")
(dotimes (z square-width)
(princ "-")))
(princ "+")
(format t "~%")))