Fix 2006/toledo3 + format fix README.md
The problem with the crash is that it relied on 32-bit sized ints. Some of these were changed to longs instead.
This commit is contained in:
1 parent
15af4f67e8
commit
54d9461d77
3 files changed
+47
-33
No files matched your search
+43
-30
@@ -1,10 +1,7 @@
|
||||
# Most Portable Chess Set
|
||||
|
||||
Oscar Toledo
|
||||
Av. Santa Cruz del Monte 9-304
|
||||
Ciudad Satelite. Edo. de Mexico
|
||||
CP. 53110
|
||||
Mexico
|
||||
Oscar Toledo
|
||||
Mexico
|
||||
|
||||
## To build:
|
||||
|
||||
@@ -18,12 +15,28 @@ make
|
||||
./toledo3 [1 | 2 | 3 [b]]
|
||||
```
|
||||
|
||||
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed a crash and a
|
||||
display problem in this entry so that it would work in modern (64-bit) systems.
|
||||
The problem was that it relied on 32-bits so some `int`s were changed to
|
||||
`long`s. At this time we don't have an easy way to test this theory but it might
|
||||
be that using `-m32` would let this work in 32-bit systems. Thank you Cody for
|
||||
your assistance!
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./toledo3 1
|
||||
```
|
||||
|
||||
### Alternate versions:
|
||||
|
||||
The author provided two additional versions, [toledo3-sbar.c](toledo3-sbar.c)
|
||||
and [toledo3-txt.c](toledo3-txt.c). Respectively these create a status bar and
|
||||
make the game text only. These are built by default.
|
||||
|
||||
Use `toledo3-sbar` and `toledo3-txt` as you would `toledo3` above.
|
||||
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
It's pretty obvious from looking at it what this program does,
|
||||
@@ -34,12 +47,11 @@ the code for Deep Blue.
|
||||
## Author's remarks:
|
||||
|
||||
There are so many text-based chess programs, what is that of
|
||||
A1, H5, C4, D5? The queen is really pointing to the king?
|
||||
`A1`, `H5`, `C4`, `D5`? The queen is really pointing to the king?
|
||||
|
||||
So I managed to do a graphical X11 chess program (WYSIAIE, or
|
||||
What You See Is An IOCCC Entry), point'n'click to move pieces
|
||||
is the only required action, and of course the command-line
|
||||
options:
|
||||
So I managed to do a graphical X11 chess program ('`WYSIAIE`', or 'What You See
|
||||
Is An IOCCC Entry'). Pointing and clicking to move pieces is the only required
|
||||
action, and of course the command-line options:
|
||||
|
||||
```sh
|
||||
./toledo3 # Two-players mode (useful if you don't have a board at hand)
|
||||
@@ -51,7 +63,7 @@ options:
|
||||
./toledo3 3 b # Human black - Computer white, level 3 (slow)
|
||||
```
|
||||
|
||||
The computer will check that your moves are legal, full legal
|
||||
The computer will check that your moves are legal. Full legal
|
||||
chess moves are allowed, except minor promotions on human side.
|
||||
|
||||
The game will continue up to its logical conclusion, you make
|
||||
@@ -59,37 +71,38 @@ a mistake and the computer surpasses you. ;)
|
||||
|
||||
### WHAT ABOUT THE ENGINE
|
||||
|
||||
Uses an alpha-beta search up to a depth of 3+level ply, extended
|
||||
with quiescence search, that helps playing strength, something
|
||||
around 1500 ELO (level 1) to 1700 ELO (level 3)
|
||||
Uses an [alpha-beta](https://en.wikipedia.org/wiki/Alpha_Beta) search up to a
|
||||
depth of 3+level [ply](https://en.wikipedia.org/wiki/Ply_(game_theory)),
|
||||
extended with quiescence search, that helps playing strength, something around
|
||||
1500 ELO (level 1) to 1700 ELO (level 3).
|
||||
|
||||
It searches the board and generates moves for each piece located,
|
||||
a lot of comparisons are used for empassant, castling and
|
||||
promotion. Would be faster with optimizations, but that
|
||||
It searches the board and generates moves for each piece located. A lot of
|
||||
comparisons are used for [en passant](https://en.wikipedia.org/wiki/En_passant),
|
||||
castling and promotion. Would be faster with optimizations, but that
|
||||
optimizations use valuable IOCCC characters.
|
||||
|
||||
It plays a different game every time, using the C library random
|
||||
number generator.
|
||||
|
||||
Because it is resource-hungry, I strongly recommend to compile it
|
||||
using maximum optimization, on GCC you can use:
|
||||
using maximum optimization. With GCC you can use:
|
||||
|
||||
```
|
||||
```sh
|
||||
gcc -O3 -fexpensive-optimizations prog.c -o prog -lX11
|
||||
```
|
||||
|
||||
### KNOWN "FEATURES"
|
||||
|
||||
1. Because this is my second X11 program (the first was
|
||||
point'n'click happy face), I added sentences everywhere
|
||||
point n click happy face), I added sentences everywhere
|
||||
until it worked. :)
|
||||
|
||||
2. It is portable to Wind*ws (using the supplied layer.c file)
|
||||
Change #include <X11/Xlib.h> to #include "layer.c" and
|
||||
use a Wind*ws compiler (only tested with Dev C/C++ 4.9.9.2)
|
||||
2. It is portable to Windows (using the supplied layer.c file)
|
||||
Change `#include <X11/Xlib.h> to #include "layer.c"` and
|
||||
use a Windows compiler (only tested with Dev C/C++ 4.9.9.2)
|
||||
The play level is fixed, though you can change it easily.
|
||||
Of course, this is an example of an obfuscated Wind*ws
|
||||
program (there exists another way of write them?)
|
||||
Of course, this is an example of an obfuscated Windows
|
||||
program (there exists another way of write them?).
|
||||
|
||||
3. It will give warnings on compilation, so you can be sure
|
||||
that your compiler works.
|
||||
@@ -97,13 +110,13 @@ gcc -O3 -fexpensive-optimizations prog.c -o prog -lX11
|
||||
4. It will not update the window while it is "thinking"
|
||||
|
||||
5. The space character has many useful applications, specially
|
||||
when it comes about the character limit. 8)
|
||||
when it comes to the character limit (8).
|
||||
|
||||
6. I still don't understand what to do after semicolons. :P
|
||||
|
||||
### CHALLENGES
|
||||
|
||||
It is possible to convert this code into Javascript with a
|
||||
It is possible to convert this code into JavaScript with a
|
||||
graphical interface. Can you do it?
|
||||
|
||||
Can the evaluation function be enhanced to make the program
|
||||
@@ -111,10 +124,10 @@ play stronger?
|
||||
|
||||
### UPGRADES
|
||||
|
||||
Using toledo3-sbar.c (which is too large for this IOCCC size
|
||||
rules) creates a status display about gameplay on the window title bar,
|
||||
Using [toledo3-sbar.c](toledo3-sbar.c) (which is too large for this IOCCC size
|
||||
rules) creates a status display about gameplay on the window title bar.
|
||||
|
||||
Using toledo3-txt.c turns this into being purely text based.
|
||||
Using [toledo3-txt.c](toledo3-txt.c) turns this into being purely text based.
|
||||
|
||||
## Copyright and CC BY-SA 4.0 License:
|
||||
|
||||
|
||||
@@ -10,11 +10,11 @@ Plane(d, r[I[A]+7+14*(i+b>>6&1)+28*(A==z)],w,C,0,0,64,64,b,i,1); XFlush(d);
|
||||
#define a X(0,0,0,
|
||||
#define H while(
|
||||
#define D ;if(
|
||||
|
||||
long
|
||||
I[304],b,i,z;main(x,W) char**W; { Display *d =
|
||||
XOpenDisplay(""); Window w = XCreateSimpleWindow
|
||||
(d, DefaultRootWindow(d), 64,64,512,512,2,G(Black)
|
||||
,G(Black)); XGCValues g; XButtonEvent e; int A,r
|
||||
,G(Black)); XGCValues g; XButtonEvent e; long A,r
|
||||
[56],Z,* m = I , C ,Y; XSelectInput(d,w,32772);
|
||||
XMapWindow( d, w); g. foreground = G(White);
|
||||
C=XCreateGC(d,w,4,&g); F+=48; H f=I,i=0,z<56){
|
||||
|
||||
@@ -11,10 +11,11 @@ Plane(d, r[I[A]+7+14*(i+b>>6&1)+28*(A==z)],w,C,0,0,64,64,b,i,1); XFlush(d);
|
||||
#define H while(
|
||||
#define D ;if(
|
||||
|
||||
long
|
||||
I[304],b,i,z;main(x,W) char**W; { Display *d =
|
||||
XOpenDisplay(""); Window w = XCreateSimpleWindow
|
||||
(d, DefaultRootWindow(d), 64,64,512,512,2,G(Black)
|
||||
,G(Black)); XGCValues g; XButtonEvent e; int A,r
|
||||
,G(Black)); XGCValues g; XButtonEvent e; long A,r
|
||||
[56],Z,* m = I , C ,Y; XSelectInput(d,w,32772);
|
||||
XMapWindow( d, w); g. foreground = G(White);
|
||||
C=XCreateGC(d,w,4,&g); F+=48; H f=I,i=0,z<56){
|
||||
|
||||
Reference in new issue
Block a user