Current world's smallest chess program

T

Tony M

Hi, I've recently published my personal web site
at http://nanochess.110mb.com/

It contains my four winning entries from the IOCCC,
and three previously-unreleased chess programs:

o Toledo Nanochess, a chess program in C that
occupies only 1274 non-blank characters, still
being smaller, it beats Micromax v1.6.
o Toledo Picochess, a chess program in C that
fits in 1K of source, but cannot play empassant,
castling or promotion to minor pieces.
o Toledo Javascript Chess, same as Toledo Nanochess
but in Javascript, 2258 bytes.

The three are the current world's smallest chess
programs, of course, until someone does it better.

I'm interested in knowing about any other small
chess programs in C or Javascript, particularly if
them are smaller than mine.

Enjoy it!

Regards,
Oscar Toledo G.

H.G. Muller, author of another tiny C chess program called MicroMax,
has written a special adapter so that Toledo Chess, and the stand
alone versions of MicroMax, can be played in a Winboard interface.
Compiled versions of Toledo and the adapter are available here:

http://www.mediafire.com/?4zu4yyzmymn

MicroMax's home page:

http://home.hccnet.nl/h.g.muller/dwnldpage.html

Tony
 
R

Richard Bos

Phil Carmody said:
Stupid analogy. French and English are, vocabulary-wise, very closely
related (and grammar-wise are very similar too).

Not nearly as much as most Anglophones believe, and most importantly,
the nuts and bolts of the languages are very different.
C and ML have no such relation. Change your question to "When was the
last time I found a C++ compiler that could understand some bits of C?"
and the answer would be "Today".

The relation of C++ to C is much more like that of Afrikaans to Dutch.
If you want to compare French to English, compare C to Javascript.

Richard
 
R

Richard Bos

Kaz Kylheku said:
Such chess implementations are broken.

Nope. Not by the FIDE laws of chess.
Proof: pit two such programs against each other.

One of them has to go first, and its move is that it resigns.

Nope. Resignation is not a move. You may resign at any moment, and this
ends the game there and then. Even if you pit one of those programs
against a human player, the human having white, this program will end
the game before the human has so much as touched a piece.
The other program fails to recognize that the game has ended, and also resigns.

That's no problem. The game has already ended; this second resignation
takes place outside the game, and changes nothing.
The way I see it, a minimal chess playing program must meet these requirements:

1. It must be aware, via some input parameter, whether whether it has the
first move.

Only if it intends to actually _move_.

Richard
 
D

Doug Miller

That's no longer minimal. Minimal programs don't have to be robust.

I contend that if a program (or person) is not capable of detecting when its
opponent has played an illegal move, then that program (or person) isn't
playing chess, but rather a vaguely similar game that happens to use the same
pieces and gameboard. The rules of chess do not permit illegal moves. Period.
If you're playing a game in which moves that are not legal chess moves are
permissible (either explicitly or implicitly by default), then that game is
not chess.

IMO, the criteria for a minimal chess-playing program are:
1. Determine whether it is the program's, or the opponent's, turn to move.
2. On its turn, play a legal move, offer a draw, or resign.
3. On the opponent's turn, ensure that the opponent's move is legal.
4. Determine when the game has ended, declare the outcome, and cease playing.
(Note that #2 covers the question of responding to the opponent's offer of a
draw: while the offer of a draw must be accepted explicitly, it may be
declined implicitly by simply playing a move.)
You can make a program smaller by trimming its ability to cope with bad input,
but you cannot legitimately make a program smaller by trimming its ability to
deal with correct input. I.e. we can negotiate robustness against size.

Example: I once wrote assembly language using an assembler that crashed when
faced with an invalid opcode. The assembler worked fine as a back end for a
compiler.



How can any of these events happen, when our minimal program is contrived to
resign at the first opportunity?

That's not playing chess, by any meaningful definition of the phrase.
 
U

user923005

I contend that if a program (or person) is not capable of detecting when its
opponent has played an illegal move, then that program (or person) isn't
playing chess, but rather a vaguely similar game that happens to use the same
pieces and gameboard. The rules of chess do not permit illegal moves. Period.
If you're playing a game in which moves that are not legal chess moves are
permissible (either explicitly or implicitly by default), then that game is
not chess.

Resigning is never an illegal move and is allowed at any point in the
game.
Some of the strongest chess programs in the world do not handle
underpromotion in their search.
Your contention is true if and only if that is a stated goal of the
program in question.
If the goal is to produce the smallest chess program that plays legal
chess, then the 'resign' program is it.

If the goal is to produce the smallest program that plays correctly,
that is another matter.
If the goal is to produce the smallest program that plays correctly
and uses a standard interface such as Xboard or UCI, then that is
another matter.
Along these lines: picoszachy, olithink, and microchess spring to
mind:
http://www.kalisz.mm.pl/~pic/nanochess/#pikoChess
http://www.mediafire.com/?2jptyjmtzxm
http://home.hccnet.nl/h.g.muller/dwnldpage.html

Olithink and MicroChess come with source (Olithink's source is quite
beautiful).

If you just want the strongest program that you don't have to pay
anything for, this is it:
http://www.rybkachess.com/index.php?auswahl=Demo+version
This is one of the programs I spoke about that will not try all legal
underpomotions.
Be that as it may, it will beat almost every other chess program in
the world, including some that you have to shell out over $100 for.

Here is a free GUI that allows you to play chess games with these
chess engines:
http://www.playwitharena.com/
IMO, the criteria for a minimal chess-playing program are:
1. Determine whether it is the program's, or the opponent's, turn to move..
2. On its turn, play a legal move, offer a draw, or resign.
3. On the opponent's turn, ensure that the opponent's move is legal.
4. Determine when the game has ended, declare the outcome, and cease playing.
(Note that #2 covers the question of responding to the opponent's offer of a
draw: while the offer of a draw must be accepted explicitly, it may be
declined implicitly by simply playing a move.)

That's fine, but it is not required by the rules of chess.
That's not playing chess, by any meaningful definition of the phrase.

Of course it is. It follows the rules of the game without mistake.

There are dozens of open source chess engines written in C. I guess
that none of them can play chess without any error (including the
IOCCC entry in this thread), though some are remarkably bug free. The
strongest open source chess engines are C++, though.
 
T

Tim Rentsch

user923005 said:
Resigning is never an illegal move and is allowed at any point in the
game.
Some of the strongest chess programs in the world do not handle
underpromotion in their search.
Your contention is true if and only if that is a stated goal of the
program in question.
If the goal is to produce the smallest chess program that plays legal
chess, then the 'resign' program is it.

This one is shorter:

int main(void){for(;;);}

Always loses on time as White; performance as Black only
slightly better. :)
 
O

Old Wolf

If the other side is willing to do the same, I'm happy to cease
all attacks on this newsgroup. There's actually evidence that,
with a single exception, everyone I attack has attacked me first.

The thing is, you consider just about any
post by Heathfield, Thompson etc. to be
an "attack". I remind you of how you described
Eric Sosman as "attacking" you merely for
mentioning to somebody else that he had you
killfiled.
 
U

user923005

This one is shorter:

   int main(void){for(;;);}

Always loses on time as White;  performance as Black only
slightly better. :)

Games do not require time limits. Time limits are optional.
 
T

Tim Rentsch

user923005 said:
Games do not require time limits. Time limits are optional.

Oh, that's even better. If there are no time limits then
my program will be /unbeatable/. :)
 
J

JosephKK

William Hughes said:
This can only play white, as playing black it has
no way of knowing if white's first move was legal.
(you could add a table of the 20 legal first moves,
or something similar to allow it to play black).
Thw question of what qualifies as the "world's smallest
chess program" clearly depends on the definition
of "chess program".

Indeed. The judging from the code cited elsethread, the
program does not 'play' chess itself, rather it allows
two humans to play chess, restricted to legal moves.
[Although I doubt it handles draw by tripple repitition.]

By that measure, Eric's program is not a Chess program
because it assumes that a game of Chess is simply the
act of White resigning. :)

There is also issue of 'smallest'. Whilst the OP is
using character count as the measure, I'd use the count
of non white-space tokens after translation phase 3.

The amount of presumptions about compilers involved in the assertion
is quite enormous. Quite to the point, white space is eliminated in
th first pass or even the in preprocessor before compilation and macro
expansion even begins.
 
K

karthikbalaguru

Hi, I've recently published my personal web site
athttp://nanochess.110mb.com/

It contains my four winning entries from the IOCCC,
and three previously-unreleased chess programs:

  o Toledo Nanochess, a chess program in C that
    occupies only 1274 non-blank characters, still
    being smaller, it beats Micromax v1.6.
  o Toledo Picochess, a chess program in C that
    fits in 1K of source, but cannot play empassant,
    castling or promotion to minor pieces.
  o Toledo Javascript Chess, same as Toledo Nanochess
    but in Javascript, 2258 bytes.

The three are the current world's smallest chess
programs, of course, until someone does it better.

:):) Coool info

Karthik Balaguru
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,781
Messages
2,569,619
Members
45,316
Latest member
naturesElixirCBDGummies

Latest Threads

Top