Hi everybody, I have uploaded a new version of Toledo Nanochess and it is 40% faster.
Also a version with integrated Winboard interface, the source and the optimized executables are downloadable as a pack. The source code sizes up at slightly less than 2 KB of C language. This is currently the smallest Winboard engine around.
Released Toledo Nanochess with Winboard interface
Moderators: hgm, Rebel, chrisw
-
- Posts: 64
- Joined: Thu Feb 19, 2009 5:34 pm
- Location: Mexico, Mexico
-
- Posts: 6442
- Joined: Tue Jan 09, 2007 12:31 am
- Location: PA USA
- Full name: Louis Zulli
Re: Released Toledo Nanochess with Winboard interface
Finally, an engine I can beat.
Nice programming by the way, although your code is a bit hard to read.
Nice programming by the way, although your code is a bit hard to read.
-
- Posts: 12540
- Joined: Wed Mar 08, 2006 8:57 pm
- Location: Redmond, WA USA
Re: Released Toledo Nanochess with Winboard interface
I must have bonked something when I was fooling around with the source code because I have never seen any engine play this crazy.
[/quote]
Code: Select all
[Event "Tw00"]
[Site "DCORBIT2008"]
[Date "2009.04.18"]
[Round "1"]
[White "Toledo_nanochess"]
[Black "Toledo_nanochess"]
[Result "0-1"]
[BlackElo "2200"]
[ECO "A27"]
[Opening "English"]
[Time "01:50:03"]
[Variation "Three Knights, 3...f5"]
[WhiteElo "2200"]
[TimeControl "300+5"]
[Termination "normal"]
[PlyCount "40"]
[WhiteType "program"]
[BlackType "program"]
1. c4 {(c2c4) -0.01/6 0} Nc6 {(b8c6) 0.00/6 0} 2. Nc3 {(b1c3) 0.00/6 0} e5
{(e7e5) -0.01/6 1} 3. e4 {(e2e4) +0.02/6 2} Bc5 {(f8c5) +0.11/6 1} 4. d3
{(d2d3) 0.00/6 4} Bxf2+ {(c5f2) +0.79/6 9} 5. Kxf2 {(e1f2) +2.82/6 4} d5
{(d7d5) +0.14/6 10} 6. cxd5 {(c4d5) +1.02/6 1} Nce7 {(c6e7) -0.07/6 16} 7.
d4 {(d3d4) +0.06/6 4} c6 {(c7c6) +0.04/6 6} 8. dxe5 {(d4e5) +0.83/6 2} Qa5
{(d8a5) +0.76/6 15} 9. Be3 {(c1e3) +0.02/6 8} Nh6 {(g8h6) +0.85/6 17} 10.
Qd4 {(d1d4) -0.02/6 19} Ng4+ {(h6g4) +0.87/6 28} 11. Kg3 {(f2g3) -0.12/6
10} Nxe3 {(g4e3) +0.87/6 34} 12. Qxe3 {(d4e3) +2.82/6 6} f5 {(f7f5) +0.93/6
21} 13. Be2 {(f1e2) -0.11/6 7} O-O {(e8g8) +1.09/6 14} 14. Qg5 {(e3g5)
-0.19/6 7} Qc5 {(a5c5) +1.74/6 20} 15. Rd1 {(a1d1) -0.13/6 13} f4+ {(f5f4)
+5.60/6 34} 16. Qxf4 {(g5f4) -3.60/6 3} Rxf4 {(f8f4) +6.55/6 26} 17. Kxf4
{(g3f4) +3.97/6 6} Qf2+ {(c5f2) +5.57/6 15} 18. Nf3 {(g1f3) -0.94/6 2} Ng6+
{(e7g6) +M10/6 13} 19. Kg5 {(f4g5) -M497/6 2} Qxg2+ {(f2g2) +M485/6 17} 20.
Kh5 {(g5h5) -M20/6 5} Qg4# {(g2g4) +M9/6 18} 0-1
-
- Posts: 12540
- Joined: Wed Mar 08, 2006 8:57 pm
- Location: Redmond, WA USA
Re: Released Toledo Nanochess with Winboard interface
After reformatting a bit it looks like this:zullil wrote:Finally, an engine I can beat.
Nice programming by the way, although your code is a bit hard to read.
Code: Select all
#include <stdio.h>
#include <time.h>
#include <ctype.h>
char *l = "ustvrtsuqqqqqqqqyyyyyyyy}{|~z|{}"
" 76Lsabcddcba .pknbrq PKNBRQ ?A6J57IKJT576,+-48HLSU";
int B, i, y, u, b, I[411], *G = I, x = 10, z = 15, M = 1e4, D;
int X(int f, int w, int c, int h, int e, int S, int s)
{
int t,
o,
L,
E,
d,
O = f,
N = -M * M,
K = 78 - h << x,
p,
*g,
n,
*m,
A,
q,
r,
C,
J,
a = y ? -x : x;
D++;
y ^= 8;
d = w || s && X(21, 0, 0, 0, 0, 1, 0) > M;
G[h + 1] = *G;
do {;
if (o = I[p = O]) {
q = o & z ^ y;
if (q < 7) {
A = q-- & 2 ? 8 : 4;
C = o - 9 & z ? q["& .$ "] : 42;
do {
r = I[p += C[l] - 64];
if (!w | p == w && q | A > 2 | !r) {
g = q | p + a - e ? 0 : I + e;
if (!r & (q | A < 3 || g) || (r + 1 & z ^ y) > 9) {
m = 0;
if (!(r - 2 & 7))
return y ^= 8, G[h] = O, K;
n = o & z;
J = I[p - a] & z;
t = q | J - 7 ? n : (n += 2, 6 ^ y);
while (n <= t) {
p[I] = n, E = O[I] = m ? *g = *m, *m = 0 : g ? *g = 0 : 0;
L = (1 - q ? l[p / x + 5] - l[O / x + 5] + l[p % x + 6] - l[O % x + 6]
+ o / 16 * 8 : !!m * 9) + (q ? 0 : l[p % x + 6] - 98 + !(I[p - 1] ^ n)
+ !(I[p + 1] ^ n) + l[n & 7] * 9 - 288 + !!g * 99 + (A < 2 && (E = p)))
+ (r ? l[r & 7] * 9 - 189 - h - q : 0) + !(J ^ y ^ 9);
if (s > h || s == h & (L > z & 1 < s | d))
L -= X(G[h + 1], s > h | d ? 0 : p, L, h + 1, E, N, s);
if (!(h || S | B - O | i - n | p - b | L < -M))
return u = E;
J = q - 1 | A < 7 || m || !s | d | r | o < z || X(21, 0, 0, 0, 0, 1, 0) > M;
O[I] = o;
p[I] = r;
m ? *m = *g, *g = 0 : g ? *g = 9 ^ y : 0;
if (L > N) {
N = L;
G[h] = O;
if (!h & s > 1)
i = n, B = O, b = p;
if (h && c - L < S)
return y ^= 8, L;
}
n += J || (g = I + p, m = p < O ? g - 3 : g + 2, *m < z | I[p += p - O] | m[p < O ? 1 : -1]);
}
}
}
} while (!r & q > 2 || (p = O, q | A > 2 | o > z & !r && ++C && --A));
}
}
} while (++O > 98 ? O = 20 : f - O);
return y ^= 8, N + M * M && N > -K + 1924 | d ? N : 0;
}
void m1(void)
{
if (*l - 'u')
l -= 32, G = I;
B = y = u = 0;
while (++B < 121)
*G++ = B / x % x < 2 | B % x < 2 ? 7 : B / x & 4 ? 0 : *l++ & 31;
}
int main(void)
{
char g[80],
*a,
*c;
int f = 0,
j = 0,
m;
clock_t k;
setbuf(stdout, NULL);
setbuf(stdin, NULL);
while (fflush(stdout), fgets(g, 79, stdin)) {
a = c = g;
while (isspace(*a))
a++;
while (*a && *a - 10 && !isspace(*a))
*c++ = *a++;
*c = 0;
;
if (!strcmp(g, "quit"))
break;
if (!strcmp(g, "post"))
j = 1;
if (!strcmp(g, "nopost"))
j = 0;
if (!strcmp(g, "new"))
f = 0, m1();
if (!strcmp(g, "force"))
f = 1;
if (!strcmp(g, "go"))
f = 0;
if (!strcmp(g, "protover"))
puts("feature myname="Toledo Nanochess Mar/25/2009" done=1");
if (isalpha(g[0]) && isdigit(g[1]) && isalpha(g[2]) && isdigit(g[3])) {
a = g;
B = *a++ & z;
B += 100 - (*a++ & z) * x;
b = *a++ & z;
b += 100 - (*a++ & z) * x;
i = *a - 'q' ? *a - 'r' ? *a - 'b' ? *a - 'n' ? I[B] & z : 11 ^ y : 12 ^ y : 13 ^ y : 14 ^ y;
X(21, 0, 0, 0, u, 0, 1);
if (!f)
strcpy(g, "go");
};
if (!strcmp(g, "go")) {
k = clock();
D = 0;
m = X(21, 0, 0, 0, u, 1, 5);
k = (clock() - k) * 1e2 / 1000;
a = g;
*a++ = B % x + 96;
*a++ = 58 - B / x;
*a++ = b % x + 96;
*a++ = 58 - b / x;
if ((I[B] & z) - i)
*a++ = "nbrq"[i - 3 & 7];
*a = 0;
;
if (j)
printf("6 %d %d %d %s\n", m, k, D, g);
X(21, 0, 0, 0, u, 0, 1);
printf("move %s\n", g);
}
}
return 0;
}
-
- Posts: 6442
- Joined: Tue Jan 09, 2007 12:31 am
- Location: PA USA
- Full name: Louis Zulli
Re: Released Toledo Nanochess with Winboard interface
I compiled the source (as released) without the Winboard interface, and played from the command line. The same game is generated as the one you posted.Dann Corbit wrote:I must have bonked something when I was fooling around with the source code because I have never seen any engine play this crazy.