Dots game in Lisp
Dots game in Lisp
does anyone has link to a project of this game implemented in lisp?
or knows where I can find some useful info for this?
here is the game http://en.wikipedia.org/wiki/Dots_and_Boxes
or knows where I can find some useful info for this?
here is the game http://en.wikipedia.org/wiki/Dots_and_Boxes
Re: Dots game in Lisp
I haven't seen such. What is your need? Are you wanting to play with a friend, read some AI code, write your own AI, borrow a GUI, ...
-
- Posts: 406
- Joined: Sat Mar 07, 2009 6:17 pm
- Location: Brazil
- Contact:
Re: Dots game in Lisp
I guess you will need to implement it yourself, if you want. You can take a look at Lisp Games Wiki and use Lispbuilder-SDL to create the game.
Good luck
Good luck

Re: Dots game in Lisp
I'll check these links now,thanks.
I want to find implementation example of this game in lisp and learn from it.
GUI should be simple ascii in console in alegro.
I want to find implementation example of this game in lisp and learn from it.
GUI should be simple ascii in console in alegro.
Re: Dots game in Lisp
Here's a simple way of drawing the board in a console. I think a "normal" GUI might be easier for playing; but I played a cursor-driven version many years ago. The cursor on this board is denoted by an X.
Code: Select all
+-+-+-+-+
|A| | | |
+-+-+-+-+
| X | |
+-+-+-+-+
| | | | |
+-+-+-+-+
Re: Dots game in Lisp
yes,thats it
do you have function that draws NxN grid?
do you have function that draws NxN grid?
Re: Dots game in Lisp
Here's some code I wrote quickly to get you started.
Here's sample output. I inserted two "."s because the forum wasn't showing a single leading space properly.
Code: Select all
(defstruct box top left owner)
(defun make-random-boxes (rows cols)
(let ((b (make-array (list rows cols))))
(dotimes (i rows)
(dotimes (j cols)
(setf (aref b i j)
(make-box
:top (> (random 100) 50)
:left (> (random 100) 50)
:owner (and (> (random 100) 50) "A")))))
b))
(defun print-boxes (boxes)
"Print the boxes array to *standard-output*"
(let ((rows (array-dimension boxes 0))
(cols (array-dimension boxes 1)))
(dotimes (r rows)
;; print tops then sides
(dotimes (c cols)
(with-slots (top) (aref boxes r c)
(princ "+")
(if (< (1+ c) cols)
(princ (if top
"-"
" "))
(princ #\Newline))))
(when (< (1+ r) rows)
(dotimes (c cols)
(with-slots (left owner) (aref boxes r c)
(princ (if left "|" " "))
(if (< (1+ c) cols)
(princ (or owner " "))
(princ #\Newline))))))))
Code: Select all
(print-boxes (make-random-boxes 4 4))
+-+ + +
.A A A
+ + +-+
|A|A|
+-+-+-+
.A|A|A
+ + +-+
Last edited by nuntius on Wed Mar 30, 2011 10:14 am, edited 1 time in total.
Reason: untabify the code
Reason: untabify the code
Re: Dots game in Lisp
thank you
I'll study it.
I need to add some seeking algorithm, some kind of AI to it.
I'll study it.
I need to add some seeking algorithm, some kind of AI to it.
Re: Dots game in Lisp
Maybe this could be of interest:
- http://cs.hiram.edu/~walkerel/cs386/hw2.doc - Introduction to Artificial Intelligence, Project 2, Dots, by Ellen Walker
- http://cs.hiram.edu/~walkerel/cs386/dots.lisp - Lisp code of the Dots game, by Ellen Walker
- http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/search/minimax/minimax.cl - alpha-beta minimax algorithm, by Mark Kantrowitz
- http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/search/minimax/ttt.cl - Tic-Tac-Toe using alpha-beta search, by Marco Zagha
Re: Dots game in Lisp
Edgar thank you very much!
I will study those examples.
I will study those examples.