Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Symbolic: The KBNK recognizer

Author: Robert Hyatt

Date: 10:02:24 02/23/04

Go up one level in this thread


On February 23, 2004 at 12:30:47, Steven Edwards wrote:

>Heres some example code from Symbolic, the KBNK endgame class recognizer:
>
>(defun IsKBNK? (MyPos)
>    "Return White if KBNK, Black if KBNK reversed, nil otherwise"
>    (cond
>        ((and
>            (= (CountByColorPos White MyPos) 3)
>            (= (CountByColorPos Black MyPos) 1)
>            (= (CountByManPos WhiteBishop MyPos) 1)
>            (= (CountByManPos WhiteKnight MyPos) 1)) White)
>        ((and
>            (= (CountByColorPos Black MyPos) 3)
>            (= (CountByColorPos White MyPos) 1)
>            (= (CountByManPos BlackBishop MyPos) 1)
>            (= (CountByManPos BlackKnight MyPos) 1)) Black)
>        (t nil)))
>
>Comments:
>
>1. Does anyone really think that Lisp is hard to read?

Yes.  No change there, IMHO.  :)

Of course _any_ program can be _made_ hard to read.

>
>2. While the above could have been done in the C++ code of the underlying
>tookit, it wouldn't have been that much faster.
>
>3. The above code, like all of ChessLisp, is typesafe.  This means that a
>function that expects a color checks for a color value, one that expects a
>position symbol checks for a position symbol, etc.

That's ok for a "beginner" IMHO.  But "checks for a xxx" is a performance issue
that I don't want to deal with.  IE I generally know what I am doing, and while
I do make mistakes, I don't mind finding them myself rather than having the
system itself help.  This is only true when performance is the main issue, of
course, but for chess, performance is a major part of the equation.


>
>4. Further work on KBNK will help with the design and implementation of the
>pattern recognition and planning facilities.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.