From: manuf
Subject: A chess game implemented in Lisp
Date: 
Message-ID: <gnv0nd$5o9$1@hefestos.uned.es>
Hi all,

First post here, so hi again :-)

For the shake of learning (and, of course, to amaze myself) I wrote a 
chess implementation in Lisp. No CLOS, just Common Lisp.

Searching around, I find that there are not so many implementations in 
this language, so I decided to put it in sourceforge.

I plan to improve it (at the moment, both interface and code are ugly, I 
must confess; I'm afraid that work, wife, etc. will not allow me to 
spend much time in it, but, anyway...)
So, if anybody want to have a look at it, it's at 
http://sourceforge.net/projects/miguedrez/

In fact, I would be so surprised by anyone looking at it, that I would 
make a decent translation to pure English (I'm a Spaniard, and some 
function names, among other things, are in Spanish)


Greetings.

From: Xah Lee
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <e1b57bbf-1fc4-4088-8b87-f50e93a142fa@q9g2000yqc.googlegroups.com>
On Feb 23, 12:14 pm, manuf <········@mixmail.com> wrote:
> Hi all,
>
> First post here, so hi again :-)
>
> For the shake of learning (and, of course, to amaze myself) I wrote a
> chess implementation in Lisp. No CLOS, just Common Lisp.
>
> Searching around, I find that there are not so many implementations in
> this language, so I decided to put it in sourceforge.
>
> I plan to improve it (at the moment, both interface and code are ugly, I
> must confess; I'm afraid that work, wife, etc. will not allow me to
> spend much time in it, but, anyway...)
> So, if anybody want to have a look at it, it's athttp://sourceforge.net/projects/miguedrez/
>
> In fact, I would be so surprised by anyone looking at it, that I would
> make a decent translation to pure English (I'm a Spaniard, and some
> function names, among other things, are in Spanish)
>
> Greetings.

there's a emacs lisp chess interface, seems very robust, you might be
interested too.

http://github.com/jwiegley/emacs-chess/tree/master

  Xah
∑ http://xahlee.org/

☄
From: Kaz Kylheku
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <20090302183243.282@gmail.com>
On 2009-02-23, manuf <········@mixmail.com> wrote:
> No CLOS, just Common Lisp.

CLOS is part of Common Lisp, not an addition to it.

The big hint are the letters CL in CLOS.

CLOS is not optional; if an implementation doesn't provide CLOS, it doesn't
implement Common Lisp.
From: William James
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <gnvdc51eid@enews2.newsguy.com>
Kaz Kylheku wrote:

> The big hint are the letters CL in CLOS.

C.L. = Commode Lord
From: manuf
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <go1o28$coq$1@hefestos.uned.es>
Kaz Kylheku wrote:
> On 2009-02-23, manuf <········@mixmail.com> wrote:
> CLOS is part of Common Lisp, not an addition to it.
Understood. I mean, then, that I didn't use any object.
Am I right now, or are there any implicit object in use in every CL 
implementation :-) ?
Thanks for the correction, btw.
From: Thomas A. Russ
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <ymiab8btnvk.fsf@blackcat.isi.edu>
manuf <········@mixmail.com> writes:

> Kaz Kylheku wrote:
> > On 2009-02-23, manuf <········@mixmail.com> wrote:
> > CLOS is part of Common Lisp, not an addition to it.
> Understood. I mean, then, that I didn't use any object.
> Am I right now, or are there any implicit object in use in every CL
> implementation :-) ?

Well, yes.

For example:   3

(defun show-type (object)
  (format t "The type of ~S is ~S~%" object (type-of object)))

-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: Thomas A. Russ
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <ymi7i3ftnul.fsf@blackcat.isi.edu>
manuf <········@mixmail.com> writes:

> Kaz Kylheku wrote:
> > On 2009-02-23, manuf <········@mixmail.com> wrote:
> > CLOS is part of Common Lisp, not an addition to it.
> Understood. I mean, then, that I didn't use any object.
> Am I right now, or are there any implicit object in use in every CL
> implementation :-) ?

Well, yes.

For example:   3

(defun show-type (object)
  (format t "The type of ~S is ~S~%" object (type-of object)))

(show-type 3)
(show-type ())
(show-type '(a b c))
(show-type 'b)


-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: manuf
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <go484i$gk3$1@hefestos.uned.es>
Thomas A. Russ wrote:
> Well, yes.
> (defun show-type (object)
>   (format t "The type of ~S is ~S~%" object (type-of object)))

Arghhh!
You know, just thinking a bit about it could have been enough to 
enlighten my mind, but, again...

Thanks!
From: Pascal J. Bourguignon
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <877i3gbp8i.fsf@galatea.local>
manuf <········@mixmail.com> writes:

> Hi all,
>
> First post here, so hi again :-)
>
> For the shake of learning (and, of course, to amaze myself) I wrote a
> chess implementation in Lisp. No CLOS, just Common Lisp.
>
> Searching around, I find that there are not so many implementations in
> this language, so I decided to put it in sourceforge.
>
> I plan to improve it (at the moment, both interface and code are ugly,
> I must confess; I'm afraid that work, wife, etc. will not allow me to
> spend much time in it, but, anyway...)
> So, if anybody want to have a look at it, it's at
> http://sourceforge.net/projects/miguedrez/
>
> In fact, I would be so surprised by anyone looking at it, that I would
> make a decent translation to pure English (I'm a Spaniard, and some
> function names, among other things, are in Spanish)


It seems your files are have a double utf-8 encoding.

[···@galatea :0.0 miguedrez_0.9]$ od  -t x1 -a datos.lisp.original|head -12
0000000    3b  3b  3b  0a  3b  3b  3b  20  64  61  74  6f  73  2e  6c  69
           ;   ;   ;  nl   ;   ;   ;  sp   d   a   t   o   s   .   l   i
0000020    73  70  0a  3b  3b  3b  20  44  65  66  69  6e  69  63  69  c3
           s   p  nl   ;   ;   ;  sp   D   e   f   i   n   i   c   i   �0000040    83  c2  b3  6e  20  64  65  20  64  61  74  6f  73  20  79  20
          83   �  �   n  sp   d   e  sp   d   a   t   o   s  sp   y  sp
0000060    66  75  6e  63  69  6f  6e  65  73  20  70  61  72  61  20  73
           f   u   n   c   i   o   n   e   s  sp   p   a   r   a  sp   s
0000100    75  20  6d  61  6e  69  70  75  6c  61  63  69  c3  83  c2  b3
           u  sp   m   a   n   i   p   u   l   a   c   i   � 83   �  �
0000120    6e  0a  3b  3b  3b  20  67  61  6d  61  6c  6c  6f  2c  20  31
           n  nl   ;   ;   ;  sp   g   a   m   a   l   l   o   ,  sp   1
[···@galatea :0.0 miguedrez_0.9]$ od  -t x1 -a datos.lisp|head -12
0000000    3b  3b  3b  3b  20  2d  2a  2d  20  63  6f  64  69  6e  67  3a
           ;   ;   ;   ;  sp   -   *   -  sp   c   o   d   i   n   g   :
0000020    75  74  66  2d  38  20  2d  2a  2d  0a  3b  3b  3b  0a  3b  3b
           u   t   f   -   8  sp   -   *   -  nl   ;   ;   ;  nl   ;   ;
0000040    3b  20  64  61  74  6f  73  2e  6c  69  73  70  0a  3b  3b  3b
           ;  sp   d   a   t   o   s   .   l   i   s   p  nl   ;   ;   ;
0000060    20  44  65  66  69  6e  69  63  69  c3  b3  6e  20  64  65  20
          sp   D   e   f   i   n   i   c   i   �  �   n  sp   d   e  sp
0000100    64  61  74  6f  73  20  79  20  66  75  6e  63  69  6f  6e  65
           d   a   t   o   s  sp   y  sp   f   u   n   c   i   o   n   e
0000120    73  20  70  61  72  61  20  73  75  20  6d  61  6e  69  70  75
           s  sp   p   a   r   a  sp   s   u  sp   m   a   n   i   p   u
[···@galatea :0.0 miguedrez_0.9]$ 


You can correct them with this bash script:

    for f in $(find . -type f -name \*.lisp) ; do 
        mv $f ${f}.original 
        ( echo ';;;; -*- coding:utf-8 -*-' ;\
          iconv -f utf-8 -t iso-8859-1 < ${f}.original ) > $f 
    done

(also correct manually some mixed encoding in comments!)


LEE-MOVIMIENTO is insupportable.  There are millenary conventions in
chess, the oldest game of the world.  Cells coordinates are in the
form <letter><digit>, with <letter> from A to H, and <digit> from 1 to
8, numbering rows from white to black, and columns from left to right. 

You could also implement the usual shortcuts consisting in giving the
name of the piece and the destination cell.


Try this:

;;; Presentamos el tablero al usuario
(defun muestra-tablero (tablero)
  (format t "~%     A    B    C    D    E    F    G    H ~%~%")
  (dotimes (fila 8)
    (format t " ~A   " (- 8 fila))
    (dotimes (columna 8)
      (format t "~2A   " (gethash (aref (tablero-tablero tablero) fila columna)
                                  piezas)))
    (format t "~A ~%~%" (- 8 fila)))
  (format t "     A    B    C    D    E    F    G    H ~%~%"))


;;; Solicitamos un movimiento y comprobamos que es válido sintácticamente
(DEFUN LEE-MOVIMIENTO ()
  (flet ((decode (movement)
           (when (member movement '(quit abort) :test (function string-equal))
             (throw 'ajz :abandoned))
           (let (column row)
             (assert (and (typep movement '(or symbol string))
                          (= 2 (length (string movement)))
                          (setf column (position (aref (string movement) 0) "ABCDEFGH"
                                                 :test (function string-equal)))
                          (setf row    (digit-char-p (aref (string movement) 1))))
                     (movement)
                     "~S is an invalid movement. A movement must be of the form A1"
                     movement)
             (values (1+ column) row))))
    (loop
       (FORMAT *QUERY-IO* "MOVIMIENTO: ")
       (ignore-errors
         (multiple-value-bind (desde-columna desde-fila) (decode (read *query-io*))
           (multiple-value-bind (hasta-columna hasta-fila) (decode (read *query-io*))
             (return-from lee-movimiento
               (make-movimiento :desde (make-posicion :fila    (- 8 desde-fila)
                                                      :columna (1- desde-columna))
                                :hasta (make-posicion :fila    (- 8 hasta-fila)
                                                      :columna (1- hasta-columna)))))))
       (format *query-io* "~%Invalid movement, try again~%"))))



You define constants with values that are not either number or
symbols, which give rise to warnings when reloading your sources.  You
should rather use DEFPARAMETER for these.


You may add:

    (defpackage "MIGUEDREZ"
      (:use "CL")
      (:export "AJZ"))
    (in-package "MIGUEDREZ")

at the beginning of miguedrez.lisp to put your code in your own
package.



I tried to play, but it was to slow to give the first move.  
Try to improve the reflection speed during the opennings.


C/USER[788]> (miguedrez:ajz)

     A    B    C    D    E    F    G    H 

 8   TN   CN   AN   DN   RN   AN   CN   TN   8 

 7   PN   PN   PN   PN   PN   PN   PN   PN   7 

 6   ..   ..   ..   ..   ..   ..   ..   ..   6 

 5   ..   ..   ..   ..   ..   ..   ..   ..   5 

 4   ..   ..   ..   ..   ..   ..   ..   ..   4 

 3   ..   ..   ..   ..   ..   ..   ..   ..   3 

 2   PB   PB   PB   PB   PB   PB   PB   PB   2 

 1   TB   CB   AB   DB   RB   AB   CB   TB   1 

     A    B    C    D    E    F    G    H 

MOVIMIENTO: c2 c4

     A    B    C    D    E    F    G    H 

 8   TN   CN   AN   DN   RN   AN   CN   TN   8 

 7   PN   PN   PN   PN   PN   PN   PN   PN   7 

 6   ..   ..   ..   ..   ..   ..   ..   ..   6 

 5   ..   ..   ..   ..   ..   ..   ..   ..   5 

 4   ..   ..   PB   ..   ..   ..   ..   ..   4 

 3   ..   ..   ..   ..   ..   ..   ..   ..   3 

 2   PB   PB   ..   PB   PB   PB   PB   PB   2 

 1   TB   CB   AB   DB   RB   AB   CB   TB   1 

     A    B    C    D    E    F    G    H 

  C-c C-c
** - Continuable Error
EVAL: User break
If you continue (by typing 'continue'): Continue execution
The following restarts are also available:
ABORT          :R1      Abort main loop
C/Break 1 USER[789]> :q
C/USER[790]> 

-- 
__Pascal Bourguignon__
From: William James
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <go175b01uj4@enews2.newsguy.com>
Pascal J. Bourguignon wrote:

> 
> Try this:
> 
> ;;; Presentamos el tablero al usuario
> (defun muestra-tablero (tablero)
>   (format t "~%     A    B    C    D    E    F    G    H ~%~%")
>   (dotimes (fila 8)
>     (format t " ~A   " (- 8 fila))
>     (dotimes (columna 8)
>       (format t "~2A   " (gethash (aref (tablero-tablero tablero)
> fila columna)                                   piezas)))
>     (format t "~A ~%~%" (- 8 fila)))
>   (format t "     A    B    C    D    E    F    G    H ~%~%"))

Clojure:

(defn draw-row [v side]
  (println side "|" (apply str (interpose " | " v)) "|" side))

(defn draw-board [board]
  (let [line #(println " " (apply str (replicate 33 "-") ))
        letters #(println "    A   B   C   D   E   F   G   H    ")]
    (do (letters) (line)
      (doseq [row (range 8 0 -1)]
        (draw-row (map #(or (board [% row]) " ") (range 1 9)) row)
        (line))
      (letters))))

(draw-board {[7 1] "K", [6 2] "P", [7 2] "P", [8 2] "P", [1 8] "k" })


    A   B   C   D   E   F   G   H
  ---------------------------------
8 | k |   |   |   |   |   |   |   | 8
  ---------------------------------
7 |   |   |   |   |   |   |   |   | 7
  ---------------------------------
6 |   |   |   |   |   |   |   |   | 6
  ---------------------------------
5 |   |   |   |   |   |   |   |   | 5
  ---------------------------------
4 |   |   |   |   |   |   |   |   | 4
  ---------------------------------
3 |   |   |   |   |   |   |   |   | 3
  ---------------------------------
2 |   |   |   |   |   | P | P | P | 2
  ---------------------------------
1 |   |   |   |   |   |   | K |   | 1
  ---------------------------------
    A   B   C   D   E   F   G   H
From: William James
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <go1fdv01t4u@enews5.newsguy.com>
William James wrote:

> Pascal J. Bourguignon wrote:
> 
> > 
> > Try this:
> > 
> > ;;; Presentamos el tablero al usuario
> > (defun muestra-tablero (tablero)
> >   (format t "~%     A    B    C    D    E    F    G    H ~%~%")
> >   (dotimes (fila 8)
> >     (format t " ~A   " (- 8 fila))
> >     (dotimes (columna 8)
> >       (format t "~2A   " (gethash (aref (tablero-tablero tablero)
> > fila columna)                                   piezas)))
> >     (format t "~A ~%~%" (- 8 fila)))
> >   (format t "     A    B    C    D    E    F    G    H ~%~%"))
> 
> Clojure:
> 
> (defn draw-row [v side]
>   (println side "|" (apply str (interpose " | " v)) "|" side))
> 
> (defn draw-board [board]
>   (let [line #(println " " (apply str (replicate 33 "-") ))
>         letters #(println "    A   B   C   D   E   F   G   H    ")]
>     (do (letters) (line)
>       (doseq [row (range 8 0 -1)]
>         (draw-row (map #(or (board [% row]) " ") (range 1 9)) row)
>         (line))
>       (letters))))

Superfluous "do".


(defn draw-board [board]
  (let [line #(println " " (apply str (replicate 33 "-") ))
        letters #(println "    A   B   C   D   E   F   G   H    ")]
    (letters) (line)
      (doseq [row (range 8 0 -1)]
        (draw-row (map #(or (board [% row]) " ") (range 1 9)) row)
        (line))
      (letters)))
From: =?UTF-8?B?QW5kcsOpIFRoaWVtZQ==?=
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <go1j1l$d93$1@news.motzarella.org>
William James schrieb:
> William James wrote:
> 
>> Pascal J. Bourguignon wrote:
>>
>>> Try this:
>>>
>>> ;;; Presentamos el tablero al usuario
>>> (defun muestra-tablero (tablero)
>>>   (format t "~%     A    B    C    D    E    F    G    H ~%~%")
>>>   (dotimes (fila 8)
>>>     (format t " ~A   " (- 8 fila))
>>>     (dotimes (columna 8)
>>>       (format t "~2A   " (gethash (aref (tablero-tablero tablero)
>>> fila columna)                                   piezas)))
>>>     (format t "~A ~%~%" (- 8 fila)))
>>>   (format t "     A    B    C    D    E    F    G    H ~%~%"))
>> Clojure:
>>
>> (defn draw-row [v side]
>>   (println side "|" (apply str (interpose " | " v)) "|" side))
>>
>> (defn draw-board [board]
>>   (let [line #(println " " (apply str (replicate 33 "-") ))
>>         letters #(println "    A   B   C   D   E   F   G   H    ")]
>>     (do (letters) (line)
>>       (doseq [row (range 8 0 -1)]
>>         (draw-row (map #(or (board [% row]) " ") (range 1 9)) row)
>>         (line))
>>       (letters))))
> 
> Superfluous "do".
> 
> 
> (defn draw-board [board]
>   (let [line #(println " " (apply str (replicate 33 "-") ))
>         letters #(println "    A   B   C   D   E   F   G   H    ")]
>     (letters) (line)
>       (doseq [row (range 8 0 -1)]
>         (draw-row (map #(or (board [% row]) " ") (range 1 9)) row)
>         (line))
>       (letters)))

Btw, you also have format from Java. It can not do all what CLs format
can, but it’s a good start. There is also a full implementation of CLs
format somewhere for Clojure.
But really, why making this a text based program? Install NetBeans and
click your gui together, or paint the Chessboard. You will have then a
program that can run on all major OSes and look much better.
Why don’t you check out this less-than-6-minutes video to see a little
demo of how building GUI apps feels?
http://www.netbeans.org/kb/60/java/swing-app-beans-binding-screencast.html


André
-- 
Lisp is not dead. It’s just the URL that has changed:
http://clojure.org/
From: Pascal J. Bourguignon
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <87zlgb88gb.fsf@galatea.local>
Andr� Thieme <······························@justmail.de> writes:
> But really, why making this a text based program? Install NetBeans and
> click your gui together, or paint the Chessboard. You will have then a
> program that can run on all major OSes and look much better.

Text based programs can run on ALL OSes, even minor or strange ones,
and can be used by everybody, even blind people.
Also they consume much less energy to display their output.

-- 
__Pascal Bourguignon__
From: André Thieme
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <go3vmf$jrf$1@news.motzarella.org>
Pascal J. Bourguignon schrieb:
> Andr� Thieme <······························@justmail.de> writes:
>> But really, why making this a text based program? Install NetBeans and
>> click your gui together, or paint the Chessboard. You will have then a
>> program that can run on all major OSes and look much better.
> 
> Text based programs can run on ALL OSes, even minor or strange ones,
> and can be used by everybody, even blind people.
> Also they consume much less energy to display their output.

Right. And they are a far worse user interface for humans, in general.
Some noticed that we are surrounded by visible objects, not texts.
It is obvious that graphical UIs are what people prefer. Otherwise
OSX, Windows and Desktop Linuxes and mobile phones would be textbased.


Andr�
-- 
Lisp is not dead. It�s just the URL that has changed:
http://clojure.org/
From: TomSW
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <d399609d-7100-42a9-b0a9-2bdef95c48c2@j35g2000yqh.googlegroups.com>
On Feb 25, 6:38 pm, André Thieme <address.good.until.
···········@justmail.de> wrote:
> Pascal J. Bourguignon schrieb:
>
> > André Thieme <······························@justmail.de> writes:
> >> But really, why making this a text based program? Install NetBeans and
> >> click your gui together, or paint the Chessboard. You will have then a
> >> program that can run on all major OSes and look much better.
>
> > Text based programs can run on ALL OSes, even minor or strange ones,
> > and can be used by everybody, even blind people.
> > Also they consume much less energy to display their output.
>
> Right. And they are a far worse user interface for humans, in general.
> Some noticed that we are surrounded by visible objects, not texts.

On the other hand, being surrounded by texts is what distinguishes us
from other animals.
From: Pascal J. Bourguignon
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <87bpsq8cph.fsf@galatea.local>
Andr� Thieme <······························@justmail.de> writes:

> Pascal J. Bourguignon schrieb:
>> Andr� Thieme <······························@justmail.de> writes:
>>> But really, why making this a text based program? Install NetBeans and
>>> click your gui together, or paint the Chessboard. You will have then a
>>> program that can run on all major OSes and look much better.
>> Text based programs can run on ALL OSes, even minor or strange ones,
>> and can be used by everybody, even blind people.
>> Also they consume much less energy to display their output.
>
> Right. And they are a far worse user interface for humans, in general.
> Some noticed that we are surrounded by visible objects, not texts.

This is wrong.  
Savages in the rainforest do live^W survive without text.

All the rest of the world lives only by the text, and have for the
whole HISTORY.

More, we can live without the view of the objects (eg blind people,
text adventures).  But we cannot live (as human) without the words we
use to designate them (here is what you get when you raise a human
without words:
http://www.metacafe.com/watch/250596/ukranian_girl_raised_by_dogs/
it's not the only example
http://en.wikipedia.org/wiki/Feral_child).


Remember, God is Verb, not Image.


> It is obvious that graphical UIs are what people prefer. Otherwise
> OSX, Windows and Desktop Linuxes and mobile phones would be textbased.

The purpose of Mac and MS-Windows is to sell to the bigger mass of
people.  For this, ther is only one way: to cater to the reptilian
brain.  That means, selling food or porn.  Pictures are just porn.

When you need to do anything meaningful, you must switch to the text,
and when you need to do anything productive, you must switch to
program.  GUI get in the way in both cases.


-- 
__Pascal Bourguignon__
From: TomSW
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <d49ba75f-a834-4fe3-b9f6-bbe8f7c03448@w9g2000yqa.googlegroups.com>
On Feb 25, 9:48 pm, ····@informatimago.com (Pascal J. Bourguignon)
wrote:

> The purpose of Mac and MS-Windows is to sell to the bigger mass of
> people.  For this, ther is only one way: to cater to the reptilian
> brain.  That means, selling food or porn.  Pictures are just porn.

There's no need to exaggerate. A visual proof of Pythagoras' theorem
isn't porn (for most people), the command line interface isn't an
effective interface for conducting brain surgery (medical robots
aren't that advanced yet) - or drawing, or other meaningful
activities...

The problem with GUIs is extensibility and adaptability. Not all
concepts and processes fit easily into a visual model, and even when
they have been so adapted, the next step (for more proficient or
demanding users), which is to represent the user's concepts and
processes about the original concepts & processes, is very hard. At
which point people start asking "how do I script this?"

Tom SW
From: André Thieme
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <go4fb8$k1f$1@news.motzarella.org>
Pascal J. Bourguignon schrieb:
> Andr� Thieme <······························@justmail.de> writes:
> 
>> Pascal J. Bourguignon schrieb:
>>> Andr� Thieme <······························@justmail.de> writes:
>>>> But really, why making this a text based program? Install NetBeans and
>>>> click your gui together, or paint the Chessboard. You will have then a
>>>> program that can run on all major OSes and look much better.
>>> Text based programs can run on ALL OSes, even minor or strange ones,
>>> and can be used by everybody, even blind people.
>>> Also they consume much less energy to display their output.
>> Right. And they are a far worse user interface for humans, in general.
>> Some noticed that we are surrounded by visible objects, not texts.
> 
> This is wrong.  
> Savages in the rainforest do live^W survive without text.
> 
> All the rest of the world lives only by the text, and have for the
> whole HISTORY.
> 
> More, we can live without the view of the objects (eg blind people,
> text adventures).  But we cannot live (as human) without the words we
> use to designate them (here is what you get when you raise a human
> without words:
> http://www.metacafe.com/watch/250596/ukranian_girl_raised_by_dogs/

Having a video as your reply just proves my point.


> Remember, God is Verb, not Image.

http://www.youtube.com/watch?v=x-slAgzJmdU&fmt=18
(less than 10 minutes, english language)


>> It is obvious that graphical UIs are what people prefer. Otherwise
>> OSX, Windows and Desktop Linuxes and mobile phones would be textbased.
> 
> The purpose of Mac and MS-Windows is to sell to the bigger mass of
> people.

Yes. The bigger mass of people enjoyes a visual GUI.
It must be so, because user interfaces went through an evolutionary
process. They started out as texts, but yet, all these inventors with
their great visions thought about something different. They like what
we have today.
It is nothing bad to be a member of the masses.


> When you need to do anything meaningful, you must switch to the text,
> and when you need to do anything productive, you must switch to
> program.  GUI get in the way in both cases.

I am not opposed to texts in any way, They are great.
They are just not the tool of choice for a chess program.
Just think about it. Why isn�t chess played since thousands of years
in the form of writing texts?
Why do you try to paint a chessboard in your CL program, instead of
just describing it.
When you have already taken the step of trying to paint it with some
ASCII, why should you then stop at that point?
There are libs out there for basically every major programming language
and they can support you to make a nice GUI for chess.


Andr�
-- 
Lisp is not dead. It�s just the URL that has changed:
http://clojure.org/
From: Rob Warnock
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <I4KdnYg00IJOZzjUnZ2dnUVZ_giWnZ2d@speakeasy.net>
Andr� Thieme  <······························@justmail.de> wrote:
+---------------
| Pascal J. Bourguignon schrieb:
| > When you need to do anything meaningful, you must switch to the text,
| > and when you need to do anything productive, you must switch to
| > program.  GUI get in the way in both cases.
| 
| I am not opposed to texts in any way, They are great.
| They are just not the tool of choice for a chess program.
| Just think about it. Why isn't chess played since thousands of years
| in the form of writing texts?
+---------------

Uh... It *has* been, Andr�!! E.g.:

    http://en.wikipedia.org/wiki/Descriptive_chess_notation
    ...
    White:  G. A. Anderssen
    Black:  J. Dufresne
    Opening:  Evans Gambit
    Location: Berlin, 1854
	White       Black
       -------     -------
     1. P-K4        P-K4
     2. Kt-KB3      Kt-QB3
     3. B-B4        B-B4
     4. P-QKt4      BxKtP
     5. P-B3        B-R4
     6. P-Q4        PxP
     7. O-O         P-Q6
     8. Q-Kt3       Q-B3
     9. P-K5        Q-Kt3
     ...

Although I will admit that this notation (which I learned as a child)
has been superceded lately amongst professionals by what is called
"algebraic chess notation", e.g.:

    http://en.wikipedia.org/wiki/Algebraic_chess_notation
    ...
    This is Kasparov versus The World, a game played by Garry
    Kasparov over the internet against the rest of the world
    ...
    1. e4 c5
    2. Nf3 d6
    3. Bb5+ Bd7
    4. Bxd7+ Qxd7
    5. c4 Nc6
    6. Nc3 Nf6
    7. O-O g6
    8. d4 cxd4
    9. Nxd4 Bg7
    10. Nde2 Qe6
    11. Nd5 Qxe4
    12. Nc7+ Kd7
    ...


-Rob

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: =?UTF-8?B?QW5kcsOpIFRoaWVtZQ==?=
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <go6rng$vis$1@reader.motzarella.org>
Rob Warnock schrieb:
> André Thieme  <······························@justmail.de> wrote:
> +---------------
> | Pascal J. Bourguignon schrieb:
> | > When you need to do anything meaningful, you must switch to the text,
> | > and when you need to do anything productive, you must switch to
> | > program.  GUI get in the way in both cases.
> | 
> | I am not opposed to texts in any way, They are great.
> | They are just not the tool of choice for a chess program.
> | Just think about it. Why isn't chess played since thousands of years
> | in the form of writing texts?
> +---------------
> 
> Uh... It *has* been, André!! E.g.:
> 
>     http://en.wikipedia.org/wiki/Descriptive_chess_notation
>     ...
>     White:  G. A. Anderssen
>     Black:  J. Dufresne
>     Opening:  Evans Gambit
>     Location: Berlin, 1854
> 	White       Black
>        -------     -------
>      1. P-K4        P-K4
>      2. Kt-KB3      Kt-QB3
>      3. B-B4        B-B4
>      4. P-QKt4      BxKtP
>      5. P-B3        B-R4
>      6. P-Q4        PxP
>      7. O-O         P-Q6
>      8. Q-Kt3       Q-B3
>      9. P-K5        Q-Kt3
>      ...

;-)

I think we all know that when people want to play chess they will get
their board and pieces and enjoy.
No normal chessplayer (so, not masters, grandmasters, ...) will take a
pencil and paper and just begin. I admit that there are players who can 
do this.
But those don’t even need this text interface. They can do it just
acustically, by telling each other how they want to move. That is again
closer to GUIs that also make sound. Why not add sound to the small
Clojure program?


André
-- 
Lisp is not dead. It’s just the URL that has changed:
http://clojure.org/
From: Thomas A. Russ
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <ymibpsoucht.fsf@blackcat.isi.edu>
Andr� Thieme <······························@justmail.de> writes:

> No normal chessplayer (so, not masters, grandmasters, ...) will take a
> pencil and paper and just begin. I admit that there are players who can
> do this.
> But those don't even need this text interface. They can do it just
> acustically, by telling each other how they want to move. That is again
> closer to GUIs that also make sound.

Hmmm.  Maybe that would make it an Auditory User Interface or AUI?
Sounds painful.

-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: Rob Warnock
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <F7qdndueZfASEDrUnZ2dnUVZ_jeWnZ2d@speakeasy.net>
André Thieme  <······························@justmail.de> wrote:
+---------------
| Rob Warnock schrieb:
| > André Thieme  <······························@justmail.de> wrote:
| > +---------------
| > | Just think about it. Why isn't chess played since thousands of years
| > | in the form of writing texts?
| > +---------------
| > 
| > Uh... It *has* been, André!! E.g.:
...
| >      1. P-K4        P-K4
| >      2. Kt-KB3      Kt-QB3
| >      3. B-B4        B-B4
...
| I think we all know that when people want to play chess they will get
| their board and pieces and enjoy.
| No normal chessplayer (so, not masters, grandmasters, ...) will take a
| pencil and paper and just begin. I admit that there are players who can 
| do this.
| But those don't even need this text interface. They can do it
| just acustically, by telling each other how they want to move.
+---------------

Hint: They might not be in the same room/city/country:

    http://en.wikipedia.org/wiki/Correspondence_chess

Correspondence chess is as old as the game itself.
It is played by rank amateurs as well as pros.
Correspondence players often have multiple games
going at once -- sometimes more than 100(!) --
which precludes keeping a physical board set up
continuously for each active game in progress.
The textual representation *is* "the game"; the
board, when used, is simply a transient aid to
visualization.


-Rob

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Pascal J. Bourguignon
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <87vdqw7ke6.fsf@galatea.local>
André Thieme <······························@justmail.de> writes:
> But those don’t even need this text interface. They can do it just
> acustically, by telling each other how they want to move. That is again
> closer to GUIs that also make sound. Why not add sound to the small
> Clojure program?

Speach is text, not image.  

-- 
__Pascal Bourguignon__
From: Pascal J. Bourguignon
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <7c4oyhwlpm.fsf@pbourguignon.anevia.com>
Andr� Thieme <······························@justmail.de> writes:
> When you have already taken the step of trying to paint it with some
> ASCII, why should you then stop at that point?

The point is that we have an AI to program, instead of just GUIing around.
It's a question of priority.

-- 
__Pascal Bourguignon__
From: John Thingstad
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <op.upzkjdg6ut4oq5@pandora.alfanett.no>
P� Wed, 25 Feb 2009 05:08:20 +0100, skrev Pascal J. Bourguignon  
<···@informatimago.com>:

> Andr� Thieme <······························@justmail.de> writes:
>> But really, why making this a text based program? Install NetBeans and
>> click your gui together, or paint the Chessboard. You will have then a
>> program that can run on all major OSes and look much better.
>
> Text based programs can run on ALL OSes, even minor or strange ones,
> and can be used by everybody, even blind people.
> Also they consume much less energy to display their output.
>

A better idea is to use the xboard GUI.
It acceps moves in the Portable Chess Format (PCF) defined at:  
http://www.tim-mann.org/Standard

--------------
John Thingstad
From: manuf
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <go4as7$i2m$1@hefestos.uned.es>
Andr� Thieme wrote:
> Btw, you also have format from Java. It can not do all what CLs format
> can, but it�s a good start. There is also a full implementation of CLs
> format somewhere for Clojure.
I'm completely clueless about Clojure, but promise to have look :-)

> Why don�t you check out this less-than-6-minutes video to see a little
> demo of how building GUI apps feels?
> http://www.netbeans.org/kb/60/java/swing-app-beans-binding-screencast.html
I did, and liked it so much. Last NetBeans I tried was 5.0. Otoh, I'm an 
Eclipse guy (all my professional work revolves around j2ee, zero-to-none 
swing...) but, again, promise to spend some time playing with it.

Bye.
From: William James
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <go2u1k08vv@enews2.newsguy.com>
William James wrote:

> Pascal J. Bourguignon wrote:
> 
> > 
> > Try this:
> > 
> > ;;; Presentamos el tablero al usuario
> > (defun muestra-tablero (tablero)
> >   (format t "~%     A    B    C    D    E    F    G    H ~%~%")
> >   (dotimes (fila 8)
> >     (format t " ~A   " (- 8 fila))
> >     (dotimes (columna 8)
> >       (format t "~2A   " (gethash (aref (tablero-tablero tablero)
> > fila columna)                                   piezas)))
> >     (format t "~A ~%~%" (- 8 fila)))
> >   (format t "     A    B    C    D    E    F    G    H ~%~%"))
> 
> Clojure:
> 
> (defn draw-row [v side]
>   (println side "|" (apply str (interpose " | " v)) "|" side))
> 
> (defn draw-board [board]
>   (let [line #(println " " (apply str (replicate 33 "-") ))
>         letters #(println "    A   B   C   D   E   F   G   H    ")]
>     (do (letters) (line)
>       (doseq [row (range 8 0 -1)]
>         (draw-row (map #(or (board [% row]) " ") (range 1 9)) row)
>         (line))
>       (letters))))
> 
> (draw-board {[7 1] "K", [6 2] "P", [7 2] "P", [8 2] "P", [1 8] "k" })
> 
> 
>     A   B   C   D   E   F   G   H
>   ---------------------------------
> 8 | k |   |   |   |   |   |   |   | 8
>   ---------------------------------
> 7 |   |   |   |   |   |   |   |   | 7
>   ---------------------------------
> 6 |   |   |   |   |   |   |   |   | 6
>   ---------------------------------
> 5 |   |   |   |   |   |   |   |   | 5
>   ---------------------------------
> 4 |   |   |   |   |   |   |   |   | 4
>   ---------------------------------
> 3 |   |   |   |   |   |   |   |   | 3
>   ---------------------------------
> 2 |   |   |   |   |   | P | P | P | 2
>   ---------------------------------
> 1 |   |   |   |   |   |   | K |   | 1
>   ---------------------------------
>     A   B   C   D   E   F   G   H


(defn draw-row [v side div]
  (println (str side div (apply str (interpose div v)) div side)))

(defn draw-board [board]
  (let [line #(println " " (apply str (replicate 33 "-") ))
        letters #(draw-row "ABCDEFGH" " " "   ") ]
    (letters) (line)
      (doseq [row (range 8 0 -1)]
        (draw-row (map #(or(board [% row]) " ")(range 1 9)) row " | ")
        (line))
      (letters)))

(draw-board {[7 1] "K", [6 2] "P", [7 2] "P", [8 2] "P", [1 8] "k" })
From: manuf
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <go1qr3$e4k$1@hefestos.uned.es>
Pascal J. Bourguignon wrote:
> It seems your files are have a double utf-8 encoding.

> You can correct them with this bash script:

> (also correct manually some mixed encoding in comments!)

> LEE-MOVIMIENTO is insupportable.
> Try this:

> You define constants with values that are not either number or
> symbols,
> You may add:

> I tried to play, but it was to slow to give the first move.  
> Try to improve the reflection speed during the opennings.

What a pile of things!
Sure, that was the stimulus I was needing. I'll apply this things right 
away.

Btw, what interpreter did you use to the test? Speed is not so bad with 
SBCL...

Greetings.
From: Pascal J. Bourguignon
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <87vdqz88c5.fsf@galatea.local>
manuf <········@mixmail.com> writes:

> Pascal J. Bourguignon wrote:
>> I tried to play, but it was to slow to give the first move.  Try to
>> improve the reflection speed during the opennings.
>
> Btw, what interpreter did you use to the test? Speed is not so bad
> with SBCL...


I tried it on clisp, both interpreted and compiled.  I didn't wait a
long time for it to play, openings should be fast.


-- 
__Pascal Bourguignon__
From: William James
Subject: Re: A chess game implemented in Lisp
Date: 
Message-ID: <go2qvn05a6@enews2.newsguy.com>
Pascal J. Bourguignon wrote:

> manuf <········@mixmail.com> writes:
> 
> > Pascal J. Bourguignon wrote:
> >> I tried to play, but it was to slow to give the first move.  Try to
> >> improve the reflection speed during the opennings.
> > 
> > Btw, what interpreter did you use to the test? Speed is not so bad
> > with SBCL...
> 
> 
> I tried it on clisp, both interpreted and compiled.  I didn't wait a
> long time for it to play, openings should be fast.

... if the program has a "book" of openings.