Current world's smallest chess program

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Jim Ablett
Posts: 1383
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: Current world's smallest chess program

Post by Jim Ablett »

Christopher Conkie wrote:
Jim Ablett wrote:New compiles:
Max2WB (final) + Toledo Nanochess (patched).
Download:
http://www.mediafire.com/?4zu4yyzmymn

And working very nicely too :)

Jim.
Thank you Jim for the welcome diversion. I suppose even I can have some fun now.

:)

Christopher

Thanks Chris. :)

I'm just in awe at both Harm and Oscar's programming skill in writing micro-max and toledo. I just doesn't look possible in such tiny code
and Harm's adapter to get them working under Winboard is quite brilliant too.

Jim.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Again with J

Post by sje »

User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Current world's smallest chess program

Post by hgm »

Christopher Conkie wrote:Thank you Jim for the welcome diversion. I suppose even I can have some fun now.

:)
At least you don't have to worry that this is a clone1 :lol:
Jim Ablett wrote:...
and Harm's adapter to get them working under Winboard is quite brilliant too.
Well, after enough trials, errors and patches, I usually get it working... :?

Tonight I did a Nunn match between Toledo_nanochess at 5 ply (the 'factory setting'), an micro-Max 1.6 at 5,000,000 nodes. At this setting Toledo-nC still takes nearly twice as much time as uMax, on most games. Only on games with an early Queen exchange that drag on afterwards, uMax sometimes uses more time. The result (10+ 10= 0- in favor of uMax) suggests that Toledo-nC is relatively better in blitz than at standard TC (where the Nunn match ended about equal).

Below are the games. They should be 100% reproducible, as neither engine reads the clock or randomizes otherwise. For clarity: the initial 7-13 moves were fed to the engines in force mode from the file Nunn.pgn, to create the Nunn starting positions, and only from that point on the engines had to make their own moves. (Forget about the reported TC: both engines were ignoring the clocks, and went well over the allocated time. For most games Toledo-nC used about 30 minutes on my 1.3GHz Pentium-M.)

Code: Select all

[Event "Computer Chess Game"]
[Site "CHESS_LAPTOP"]
[Date "2009.02.23"]
[Round "1"]
[White "toledo"]
[Black "umax1_6"]
[Result "0-1"]
[TimeControl "40/300"]

1. e4 c5 2. Nf3 e6 3. d4 cxd4 4. Nxd4 Nc6 5. Nb5 Nf6 6. N1c3 d6 7. Bf4 e5
8. Bg5 a6 9. Na3 b5 10. Bxf6 gxf6 11. Nd5 f5 12. c3 Bg7 13. exf5 Bxf5 14.
b4 O-O 15. g4 Be4 16. Rg1 Bxd5 17. Qxd5 Rc8 18. Rd1 Qh4 19. Qxd6 Rfd8 20.
Qc5 Nd4 21. cxd4 Rxc5 22. bxc5 Rxd4 23. Rxd4 exd4 24. h3 Qg5 25. Kd1 Bh6
26. Ke2 Qd2+ 27. Kf3 Qc3+ 28. Ke4 Qxa3 29. Bd3 Qxa2 30. Rf1 Qe6+ 31. Kf3
Qc6+ 32. Kg3 f6 33. Re1 Qxc5 34. f4 Qa3 35. Rd1 Qb3 36. Rd2 Bf8 37. Kh4 Bb4
38. Bc2 Qf3 39. Bd1 Qe3 40. Bb3+ Kg7 41. Rd1 Kh6 42. g5+ fxg5+ 43. fxg5+
Qxg5#
{Xboard adjudication: Checkmate} 0-1

[Event "Computer Chess Game"]
[Site "CHESS_LAPTOP"]
[Date "2009.02.23"]
[Round "2"]
[White "umax1_6"]
[Black "toledo"]
[Result "1/2-1/2"]
[TimeControl "40/300"]

1. e4 c5 2. Nf3 e6 3. d4 cxd4 4. Nxd4 Nc6 5. Nb5 Nf6 6. N1c3 d6 7. Bf4 e5
8. Bg5 a6 9. Na3 b5 10. Bxf6 gxf6 11. Nd5 f5 12. c3 Bg7 13. exf5 Bxf5 14.
Qf3 Be6 15. Nf6+ Qxf6 16. Qxc6+ Ke7 17. Bd3 Bd7 18. Qd5 Rhc8 19. O-O Bc6
20. Qb3 h5 21. Nc2 Qe6 22. Ne3 e4 23. Qxe6+ fxe6 24. Be2 Be5 25. Bxh5 Rh8
26. g4 Rag8 27. Kh1 Be8 28. f4 exf3 29. Bxe8 Rxh2+ 30. Kg1 Kxe8 31. a4 Rgh8
32. Ra3 Rh1+ 33. Kf2 R8h2+ 34. Kxf3 Rh3+ 35. Kf2 R1h2+ 36. Ng2 bxa4 37. Rg1
d5 38. Rxa4 Bd6 39. Rga1 Bc5+ 40. Kf1 Rg3 41. b4 Rh1+ 42. Ke2 Rxg2+ 43. Kf3
Rf2+ 44. Kg3 Rxa1 45. Rxa1 Be3 46. Re1 d4 47. cxd4 Bxd4 48. Rxe6+ Kd7 49.
Rxa6 Rb2 50. Ra4 Kc6 51. Kf4 Kb5 52. Ra8 Kxb4 53. Ke4 Bb6 54. Rc8 Rd2 55.
Rc1 Rd4+ 56. Kf5 Bd8 57. Rc2 Bb6 58. Rb2+ Ka5 59. Rb3 Bc7 60. Rb7 Bd6 61.
Rb3 Rf4+ 62. Ke6 Bc7 63. Rc3 Bb8 64. Rc8 Ba7 65. Ra8 Ka6 66. Rg8 Ka5 67.
Ra8 Ka6 68. Rg8 Ka5 69. Ra8
{Xboard adjudication: repetition draw} 1/2-1/2

[Event "Computer Chess Game"]
[Site "CHESS_LAPTOP"]
[Date "2009.02.23"]
[Round "3"]
[White "toledo"]
[Black "umax1_6"]
[Result "1/2-1/2"]
[TimeControl "40/300"]

1. e4 c5 2. Nf3 Nc6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 d6 6. Bc4 e6 7. Be3 a6 8.
Qe2 Qc7 9. O-O-O Be7 10. Bb3 O-O 11. f4 Nxd4 12. Rxd4 h5 13. h4 Bd7 14. a4
Kh7 15. e5 dxe5 16. Rc4 Bc6 17. Bd2 b5 18. Rxc6 Qxc6 19. fxe5 Ng4 20. Rh3
b4 21. Na2 Rab8 22. c4 f5 23. exf6 gxf6 24. Nxb4 Bxb4 25. Bxb4 Rxb4 26.
Bc2+ Kg7 27. Qd3 Rh8 28. Qg6+ Kf8 29. Rf3 Qxc4 30. Rxf6+ Nxf6 31. Qxf6+ Kg8
32. Qg6+ Kf8 33. Qf6+ Kg8 34. Qg6+ Kf8 35. Qf6+
{Xboard adjudication: repetition draw} 1/2-1/2

[Event "Computer Chess Game"]
[Site "CHESS_LAPTOP"]
[Date "2009.02.23"]
[Round "4"]
[White "umax1_6"]
[Black "toledo"]
[Result "1/2-1/2"]
[TimeControl "40/300"]

1. e4 c5 2. Nf3 Nc6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 d6 6. Bc4 e6 7. Be3 a6 8.
Qe2 Qc7 9. O-O-O Be7 10. Bb3 O-O 11. f4 e5 12. Nf3 exf4 13. Bxf4 Be6 14.
Qd3 Rad8 15. Kd2 Ne5 16. Qe2 Bxb3 17. axb3 d5 18. Nxe5 Nxe4+ 19. Nxe4 dxe4+
20. Ke3 Rxd1 21. Qxd1 Rd8 22. Qe2 Qc5+ 23. Kxe4 Qd5+ 24. Kf5 f6 25. c4 Qc5
26. Kg4 fxe5 27. Bxe5 h5+ 28. Kf4 Re8 29. Qxh5 Rf8+ 30. Ke4 Bf6 31. Rd1
Qc6+ 32. Rd5 Bxe5 33. Kxe5 g6 34. Qh4 Rf5+ 35. Kd4 Qb6+ 36. Kc3 Qe3+ 37.
Kb4 Qb6+ 38. Kc3 Qe3+ 39. Kb4 Qb6+ 40. Kc3
{Xboard adjudication: repetition draw} 1/2-1/2

[Event "Computer Chess Game"]
[Site "CHESS_LAPTOP"]
[Date "2009.02.23"]
[Round "5"]
[White "toledo"]
[Black "umax1_6"]
[Result "1/2-1/2"]
[TimeControl "40/300"]

1. e4 e6 2. d4 d5 3. Nc3 Bb4 4. e5 c5 5. a3 Bxc3+ 6. bxc3 Qc7 7. Nf3 Ne7 8.
a4 b6 9. Bb5+ Bd7 10. Bd3 Nbc6 11. O-O O-O 12. dxc5 Nxe5 13. cxb6 Nxf3+ 14.
gxf3 axb6 15. Ba3 Bxa4 16. Bxh7+ Kxh7 17. Rb1 Rfe8 18. Bxe7 Rxe7 19. Qd3+
Kh6 20. Rb4 Qc5 21. Rh4+ Kg5 22. Rg4+ Kh6 23. Rh4+ Kg5 24. Rg4+ Kh6 25.
Rh4+
{Xboard adjudication: repetition draw} 1/2-1/2

[Event "Computer Chess Game"]
[Site "CHESS_LAPTOP"]
[Date "2009.02.23"]
[Round "6"]
[White "umax1_6"]
[Black "toledo"]
[Result "1/2-1/2"]
[TimeControl "40/300"]

1. e4 e6 2. d4 d5 3. Nc3 Bb4 4. e5 c5 5. a3 Bxc3+ 6. bxc3 Qc7 7. Nf3 Ne7 8.
a4 b6 9. Bb5+ Bd7 10. Bd3 Nbc6 11. O-O cxd4 12. cxd4 f6 13. exf6 gxf6 14.
Bh6 Kf7 15. Be3 Rad8 16. Qd2 a5 17. h4 h5 18. Rfe1 e5 19. Kf1 e4 20. Bxe4
dxe4 21. Bf4 Qb7 22. Rxe4 Rhe8 23. Ke2 Bf5 24. Re3 Qa6+ 25. Ke1 Nb4 26. Rc1
Ned5 27. Rxe8 Rxe8+ 28. Be3 Qc4 29. Kd1 Qf1+ 30. Qe1 Nc3+ 31. Kd2 Ne4+ 32.
Kd1 Nc3+ 33. Kd2 Ne4+ 34. Kd1 Nc3+
{Xboard adjudication: repetition draw} 1/2-1/2

[Event "Computer Chess Game"]
[Site "CHESS_LAPTOP"]
[Date "2009.02.23"]
[Round "7"]
[White "toledo"]
[Black "umax1_6"]
[Result "0-1"]
[TimeControl "40/300"]

1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O b5 6. Bb3 Be7 7. Re1 O-O 8.
c3 d6 9. h3 Na5 10. Bc2 c5 11. d4 Qc7 12. Nbd2 cxd4 13. cxd4 Be6 14. d5 Bd7
15. b4 Rac8 16. bxa5 Qc3 17. Rb1 Qxc2 18. Qxc2 Rxc2 19. a3 h5 20. Nb3 Kh7
21. Rb2 Rxb2 22. Bxb2 Rc8 23. Nfd2 Rc2 24. Bc1 Rc3 25. f3 Kg6 26. g4 Rc2
27. Na1 Rc3 28. Bb2 Rd3 29. Re2 Nh7 30. Nab3 Ng5 31. Nc1 Rxd2 32. Rxd2
Nxf3+ 33. Kf1 Nxd2+ 34. Ke2 Nxe4 35. gxh5+ Kxh5 36. Kd3 Nf6 37. Ne2 Bxh3
38. Nc3 Bd8 39. a4 Bxa5 40. axb5 axb5 41. Ne2 Bf5+ 42. Ke3 Kg4 43. Kf2 Nxd5
44. Ba3 Bb6+ 45. Kg2 Bd3 46. Nc1 Ne3+ 47. Kg1 Bc4 48. Bxd6 Nf5+ 49. Bc5
Bxc5+ 50. Kg2 Ng3 51. Kh2 Bd5 52. Nb3 Nf1#
{Xboard adjudication: Checkmate} 0-1

[Event "Computer Chess Game"]
[Site "CHESS_LAPTOP"]
[Date "2009.02.23"]
[Round "8"]
[White "umax1_6"]
[Black "toledo"]
[Result "1/2-1/2"]
[TimeControl "40/300"]

1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O b5 6. Bb3 Be7 7. Re1 O-O 8.
c3 d6 9. h3 Na5 10. Bc2 c5 11. d4 Qc7 12. Nbd2 cxd4 13. cxd4 exd4 14. Nxd4
Nc6 15. N2f3 Bb7 16. Nf5 g6 17. Nxe7+ Qxe7 18. Bf4 Rad8 19. Qd2 Ne5 20.
Bxe5 dxe5 21. Qg5 Rfe8 22. Qe3 h5 23. Bd3 Rd6 24. Kf1 Qd8 25. Ke2 Rxd3 26.
Qxd3 Qxd3+ 27. Kxd3 Re7 28. Ng5 Kg7 29. Rac1 Kh6 30. h4 Ne8 31. Rc5 Nd6 32.
Nf3 f6 33. Nd2 f5 34. f3 fxe4+ 35. fxe4 Ba8 36. Re2 Bb7 37. Re3 Ba8 38. Nf3
a5 39. Nxe5 Kh7 40. a4 Kg7 41. axb5 Bb7 42. Nc6 Rc7 43. Kd4 Nxb5+ 44. Rxb5
Bxc6 45. Rxa5 Bb7 46. Ra7 Rd7+ 47. Ke5 Kf7 48. Rf3+ Ke8 49. Rf4 Rc7 50. Rf3
Rd7 51. Rf4 Rc7 52. Rf3 Rd7
{Xboard adjudication: repetition draw} 1/2-1/2

[Event "Computer Chess Game"]
[Site "CHESS_LAPTOP"]
[Date "2009.02.23"]
[Round "9"]
[White "toledo"]
[Black "umax1_6"]
[Result "0-1"]
[TimeControl "40/300"]

1. d4 d5 2. c4 c6 3. Nf3 e6 4. cxd5 exd5 5. Nc3 Nf6 6. Bg5 Be7 7. Qc2 Nbd7
8. e3 O-O 9. Bd3 Re8 10. O-O Nf8 11. b4 Bxb4 12. Ne2 Bg4 13. Rab1 Qa5 14.
a3 Bd6 15. Rxb7 Qxa3 16. Rb3 Qa4 17. Bxf6 gxf6 18. h3 Bxf3 19. gxf3 Rab8
20. Rxb8 Qxc2 21. Bxc2 Rxb8 22. Ba4 Rb2 23. Ng3 Bxg3 24. fxg3 Re2 25. Bxc6
Rxe3 26. Bxd5 Rd3 27. Bb7 Ne6 28. d5 Nd8 29. Ba8 Kg7 30. g4 Rc3 31. d6 Rd3
32. Ra1 Rxd6 33. Rxa7 Rd2 34. Be4 Ne6 35. Ra5 Ng5 36. h4 Nxe4 37. fxe4 Rd4
38. g5 Rxe4 39. gxf6+ Kxf6 40. h5 Re5 41. Rxe5 Kxe5 42. Kf1 Kf5 43. Ke1 Kg5
44. h6 Kxh6 45. Kd1 Kg5 46. Kc1 f5 47. Kb1 h5 48. Ka1 h4 49. Kb1 Kf4 50.
Ka1 h3 51. Kb1 h2 52. Ka1 h1=Q+ 53. Ka2 Qh3 54. Kb2 Qd3 55. Ka2 Qc3 56. Kb1
Qd2 57. Ka1 Ke4 58. Kb1 Kd4 59. Ka1 Kc3 60. Kb1 Qb2#
{Xboard adjudication: Checkmate} 0-1

[Event "Computer Chess Game"]
[Site "CHESS_LAPTOP"]
[Date "2009.02.23"]
[Round "10"]
[White "umax1_6"]
[Black "toledo"]
[Result "1-0"]
[TimeControl "40/300"]

1. d4 d5 2. c4 c6 3. Nf3 e6 4. cxd5 exd5 5. Nc3 Nf6 6. Bg5 Be7 7. Qc2 Nbd7
8. e3 O-O 9. Bd3 Re8 10. O-O Nf8 11. h3 Be6 12. Qb3 b5 13. Ne5 Bd7 14. a4
h6 15. Bxf6 gxf6 16. Nxd7 Qxd7 17. axb5 Qb7 18. Qa2 cxb5 19. Qxd5 Rab8 20.
Qxb7 Rxb7 21. Be4 Rb6 22. Rxa7 Bb4 23. Nd5 Rd6 24. Bf3 Rxd5 25. Bxd5 Re7
26. Ra8 Bd6 27. Ra6 Rd7 28. Bc6 Rd8 29. Bxb5 Ne6 30. Bc4 Rd7 31. Rc1 Kf8
32. Bxe6 fxe6 33. Kf1 Ke7 34. Ke2 Rb7 35. Kf3 e5 36. Rcc6 e4+ 37. Kxe4 Rd7
38. Kf5 h5 39. Rcb6 h4 40. Ra8 Kf7 41. Rh8 Bc7 42. Rxf6+ Kg7 43. Rfh6 Rd5+
44. Ke4 Rd6 45. R6h7+ Kg6 46. Rxc7 Re6+ 47. Kd3 Rb6 48. Rc2 Rb3+ 49. Ke4
Rb6 50. Rxh4 Re6+ 51. Kd5 Re8 52. Rc6+ Kg5 53. Rg4+ Kh5 54. Rc5 Rd8+ 55.
Ke4+ Kh6 56. Rb5 Rc8 57. Ra5 Rc2 58. Ra8 Kh7 59. Ra7+ Kh6 60. Kf5 Rxf2+ 61.
Rf4 Rxf4+ 62. exf4 Kh5 63. Rh7#
{Xboard adjudication: Checkmate} 1-0

[Event "Computer Chess Game"]
[Site "CHESS_LAPTOP"]
[Date "2009.02.23"]
[Round "11"]
[White "toledo"]
[Black "umax1_6"]
[Result "0-1"]
[TimeControl "40/300"]

1. d4 Nf6 2. c4 g6 3. Nc3 d5 4. cxd5 Nxd5 5. e4 Nxc3 6. bxc3 Bg7 7. Nf3 c5
8. Rb1 O-O 9. Be2 cxd4 10. cxd4 Nc6 11. d5 Ne5 12. Qd2 f5 13. Nxe5 Bxe5 14.
f4 Bd6 15. e5 Bc5 16. h4 Kg7 17. e6 Kh6 18. g4 Qc7 19. Bb2 Rf6 20. Be5 Qd8
21. g5+ Kg7 22. Rb5 Bb6 23. gxf6+ exf6 24. Bc3 Qe7 25. Qb2 Qf8 26. e7 Qxe7
27. Rf1 Bd7 28. Rb4 Re8 29. Rf3 Qd6 30. Rd3 Re4 31. Rxe4 fxe4 32. Rg3 Qxf4
33. Rg2 Bh3 34. Rg5 Qxh4+ 35. Kd1 Qxg5 36. Qb3 Bf5 37. Qb4 Qg1+ 38. Be1
Qd4+ 39. Qxd4 Bxd4 40. a4 Kf7 41. d6 Ke6 42. Bb4 Kd5 43. Bb5 a6 44. Be8 Kc4
45. Ba5 b6 46. Bd2 Be5 47. d7 Bc7 48. a5 bxa5 49. Bf4 Bb6 50. Ke1 Kd5 51.
Bf7+ Be6 52. Be3 Bd8 53. Be8 Kc6 54. Bf4 Bxd7 55. Bxd7+ Kxd7 56. Bh6 Ke6
57. Kd1 Be7 58. Bd2 Bb4 59. Bh6 g5 60. Bg7 Kf7 61. Bh8 Bc5 62. Kc1 g4 63.
Kb1 g3 64. Kb2 g2 65. Kb3 g1=Q 66. Kc3 e3 67. Bxf6 Kxf6 68. Kd3 Qd1+ 69.
Kc3 Qe2 70. Kb3 Bb4 71. Ka4 Qc2#
{Xboard adjudication: Checkmate} 0-1

[Event "Computer Chess Game"]
[Site "CHESS_LAPTOP"]
[Date "2009.02.23"]
[Round "12"]
[White "umax1_6"]
[Black "toledo"]
[Result "1/2-1/2"]
[TimeControl "40/300"]

1. d4 Nf6 2. c4 g6 3. Nc3 d5 4. cxd5 Nxd5 5. e4 Nxc3 6. bxc3 Bg7 7. Nf3 c5
8. Rb1 O-O 9. Be2 cxd4 10. cxd4 f5 11. exf5 Bxf5 12. Bc4+ e6 13. Rxb7 Nc6
14. Be3 Na5 15. Rb4 Nc6 16. Rb5 Qe8 17. O-O Rd8 18. h3 h5 19. Rc5 Be4 20.
Ng5 Bd5 21. Bxd5 Rxd5 22. Rxd5 exd5 23. Re1 a5 24. Bf4 Qd7 25. Ne6 Rf7 26.
Qd2 Be5 27. Bxe5 Qxe6 28. f4 Re7 29. Kf2 Qf5 30. Kf3 g5 31. g4 Nxe5+ 32.
Rxe5 hxg4+ 33. hxg4 Qh7 34. Rxg5+ Rg7 35. Rxd5 Qh3+ 36. Ke4 Qh7+ 37. Ke5
Ra7 38. Rc5 Qe7+ 39. Kf5 Ra8 40. Rxa5 Qh7+ 41. Kg5 Qe7+ 42. Kh5 Qh7+ 43.
Kg5 Qe7+ 44. Kh5 Qh7+ 45. Kg5
{Xboard adjudication: repetition draw} 1/2-1/2

[Event "Computer Chess Game"]
[Site "CHESS_LAPTOP"]
[Date "2009.02.23"]
[Round "13"]
[White "toledo"]
[Black "umax1_6"]
[Result "0-1"]
[TimeControl "40/300"]

1. d4 Nf6 2. c4 e6 3. Nf3 b6 4. g3 Ba6 5. b3 Bb4+ 6. Bd2 Be7 7. Bg2 c6 8.
Bc3 d5 9. Ne5 Nfd7 10. Nxd7 Nxd7 11. Nd2 O-O 12. O-O Rc8 13. e4 f5 14. exf5
exf5 15. a4 Nf6 16. f4 Kf7 17. Re1 dxc4 18. bxc4 Bd6 19. Qb3 Kg6 20. Nf3
Ng4 21. Re6+ Kh5 22. h3 Nf6 23. Qc2 g6 24. c5 bxc5 25. Bb2 Qd7 26. Rae1 c4
27. Bc1 Kh6 28. g4 fxg4 29. Ne5 Qc7 30. hxg4 Kg7 31. Nxc6 Rce8 32. g5 Rxe6
33. Rxe6 Nh5 34. Qc3 Nxf4 35. d5+ Kg8 36. Bxf4 Rxf4 37. Qe3 Rf8 38. Rxd6
Qxd6 39. Qxa7 Re8 40. Qxa6 Qg3 41. Ne7+ Rxe7 42. Qc8+ Kf7 43. Qxc4 Re1+ 44.
Qf1+ Rxf1+ 45. Kxf1 Qxg5 46. Kg1 Qe3+ 47. Kf1 Kf6 48. a5 Ke5 49. Bh1 Kf4
50. Kg2 Qg3+ 51. Kf1 Ke3 52. Be4 Qf2#
{Xboard adjudication: Checkmate} 0-1

[Event "Computer Chess Game"]
[Site "CHESS_LAPTOP"]
[Date "2009.02.24"]
[Round "14"]
[White "umax1_6"]
[Black "toledo"]
[Result "1-0"]
[TimeControl "40/300"]

1. d4 Nf6 2. c4 e6 3. Nf3 b6 4. g3 Ba6 5. b3 Bb4+ 6. Bd2 Be7 7. Bg2 c6 8.
Bc3 d5 9. Ne5 Nfd7 10. Nxd7 Nxd7 11. Nd2 O-O 12. O-O Rc8 13. e4 f5 14. exf5
Rxf5 15. f4 Qe8 16. Bf3 c5 17. Bg4 Rf6 18. f5 exf5 19. Bxf5 cxd4 20. Bxd4
dxc4 21. Ne4 Rf8 22. Qg4 Bf6 23. Bxf6 Nxf6 24. Nxf6+ Rxf6 25. Bxc8 h5 26.
Qd7 Rxf1+ 27. Rxf1 Qe3+ 28. Kg2 Qe2+ 29. Rf2 Qe4+ 30. Kh3 Qg4+ 31. Qxg4
hxg4+ 32. Bxg4 cxb3 33. axb3 Bb5 34. Be6+ Kh7 35. Rf7 a5 36. Rb7 Bf1+ 37.
Kh4 b5 38. Bf5+ Kh6 39. g4 g5+ 40. Kg3 Bd3 41. Rh7#
{Xboard adjudication: Checkmate} 1-0

[Event "Computer Chess Game"]
[Site "CHESS_LAPTOP"]
[Date "2009.02.24"]
[Round "15"]
[White "toledo"]
[Black "umax1_6"]
[Result "0-1"]
[TimeControl "40/300"]

1. d4 Nf6 2. c4 g6 3. Nc3 Bg7 4. e4 d6 5. Be2 O-O 6. Nf3 e5 7. O-O Nc6 8.
d5 Ne7 9. Ne1 Ne8 10. Be3 f5 11. exf5 Nxf5 12. g4 Nxe3 13. fxe3 Rxf1+ 14.
Kxf1 Nf6 15. b4 a5 16. a3 axb4 17. axb4 Rxa1 18. Qxa1 Bxg4 19. h4 Qf8 20.
Kg1 Bxe2 21. Nxe2 Ng4 22. Kg2 Qf2+ 23. Kh3 Qxe2 24. Qa8+ Kf7 25. Qa1 h5 26.
Qb2 Qxb2 27. Nf3 Qf2 28. Ng5+ Ke7 29. e4 Qh2#
{Xboard adjudication: Checkmate} 0-1

[Event "Computer Chess Game"]
[Site "CHESS_LAPTOP"]
[Date "2009.02.24"]
[Round "16"]
[White "umax1_6"]
[Black "toledo"]
[Result "1/2-1/2"]
[TimeControl "40/300"]

1. d4 Nf6 2. c4 g6 3. Nc3 Bg7 4. e4 d6 5. Be2 O-O 6. Nf3 e5 7. O-O Nc6 8.
d5 Ne7 9. Ne1 Ne8 10. Be3 c6 11. Nd3 f5 12. f3 fxe4 13. fxe4 Rxf1+ 14. Kxf1
Nc7 15. Bf3 h5 16. Qa4 a5 17. Bg5 Bd7 18. Qb3 cxd5 19. Bxe7 Qxe7 20. Nxd5
Nxd5 21. Qxb7 Ne3+ 22. Ke2 Nc2 23. Qxa8+ Qe8 24. Qxe8+ Bxe8 25. Rf1 Bh6 26.
Rd1 Bf7 27. b3 a4 28. Rb1 axb3 29. axb3 d5 30. cxd5 Bf4 31. g3 Bg5 32. Nxe5
Be8 33. Kd3 Na3 34. Ra1 Bb5+ 35. Kc3 Bf6 36. Rxa3 Bxe5+ 37. Kd2 Bd7 38. Ra7
Bh3 39. Re7 Bd6 40. Ra7 Bb4+ 41. Kd3 Bc5 42. Rc7 Bf8 43. Ke3 Kh8 44. Kd4
Bb4 45. Ke5 Ba5 46. Rb7 Bc3+ 47. Kf4 Bd2+ 48. Ke5 Bc3+ 49. Kf4 Bd2+ 50. Ke5
Bc3+
{Xboard adjudication: repetition draw} 1/2-1/2

[Event "Computer Chess Game"]
[Site "CHESS_LAPTOP"]
[Date "2009.02.24"]
[Round "17"]
[White "toledo"]
[Black "umax1_6"]
[Result "1/2-1/2"]
[TimeControl "40/300"]

1. c4 e5 2. Nc3 Nc6 3. g3 g6 4. Bg2 Bg7 5. e3 Nge7 6. Nge2 O-O 7. O-O d6 8.
d3 Be6 9. Qa4 f5 10. h4 Kf7 11. Bf3 a5 12. a3 Bf6 13. Bd2 Bd7 14. Nb5 Be6
15. Rad1 d5 16. cxd5 Nxd5 17. h5 Nb6 18. Qc2 Nd5 19. Qc5 Be7 20. Qc2 Bg5
21. e4 fxe4 22. dxe4 Bh3 23. Bxa5 Bxf1 24. Rxd5 Qf6 25. Kxf1 Rxa5 26. Qc4
Kg7 27. b4 Qxf3 28. Nf4 Qh1+ 29. Ke2 Bxf4 30. bxa5 Qxh5+ 31. Ke1 Qh1+ 32.
Ke2 Qh5+ 33. Ke1 Qh1+ 34. Ke2 Qh5+
{Xboard adjudication: repetition draw} 1/2-1/2

[Event "Computer Chess Game"]
[Site "CHESS_LAPTOP"]
[Date "2009.02.24"]
[Round "18"]
[White "umax1_6"]
[Black "toledo"]
[Result "1-0"]
[TimeControl "40/300"]

1. c4 e5 2. Nc3 Nc6 3. g3 g6 4. Bg2 Bg7 5. e3 Nge7 6. Nge2 O-O 7. O-O d6 8.
d3 Be6 9. Bxc6 bxc6 10. Bd2 h5 11. f4 Qd7 12. Kf2 Bg4 13. e4 f5 14. Rb1
fxe4 15. Nxe4 exf4 16. Bxf4 g5 17. Nxg5 Rab8 18. Qd2 Ng6 19. Ne4 Bh3 20.
Rfe1 Qg4 21. Rg1 Ne5 22. Qe3 h4 23. b3 a5 24. d4 Nf3 25. Qxf3 hxg3+ 26.
Qxg3 Rfe8 27. Be5 dxe5 28. Nf6+ Bxf6 29. Qxh3 Bh4+ 30. Qxh4 Rf8+ 31. Ke3
Rf3+ 32. Kd2 Rd3+ 33. Kxd3 e4+ 34. Ke3 Qg7 35. Qe7 Rxb3+ 36. axb3 Qg5+ 37.
Rxg5+ Kh8 38. Qg7#
{Xboard adjudication: Checkmate} 1-0

[Event "Computer Chess Game"]
[Site "CHESS_LAPTOP"]
[Date "2009.02.24"]
[Round "19"]
[White "toledo"]
[Black "umax1_6"]
[Result "0-1"]
[TimeControl "40/300"]

1. e4 c5 2. Nf3 d6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 a6 6. Bg5 e6 7. f4 Qb6 8.
Qd2 Qxb2 9. Rb1 Qa3 10. Ndb5 axb5 11. Bxf6 gxf6 12. Bxb5+ Nc6 13. Qd4 Be7
14. Qc4 Bd7 15. g4 Qa7 16. a4 O-O-O 17. Ke2 h5 18. Bxc6 Bxc6 19. Nb5 Qa6
20. gxh5 d5 21. exd5 Rxd5 22. Rhd1 Rhxh5 23. h3 Rxh3 24. c3 Rc5 25. Qd4
Bf3+ 26. Ke1 Rh1+ 27. Kd2 Bxd1 28. Rxd1 Rxd1+ 29. Kxd1 Rd5 30. Kc1 Rxd4 31.
Nxd4 Bc5 32. Kc2 Qc4 33. Nb3 Qe2+ 34. Kb1 Ba3 35. Nd2 Qxd2 36. f5 Qb2#
{Xboard adjudication: Checkmate} 0-1

[Event "Computer Chess Game"]
[Site "CHESS_LAPTOP"]
[Date "2009.02.24"]
[Round "20"]
[White "umax1_6"]
[Black "toledo"]
[Result "1/2-1/2"]
[TimeControl "40/300"]

1. e4 c5 2. Nf3 d6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 a6 6. Bg5 e6 7. f4 Qb6 8.
Qd2 Qxb2 9. Rb1 Qa3 10. Bxf6 gxf6 11. Be2 Nc6 12. Nxc6 bxc6 13. O-O Bh6 14.
Bg4 Rg8 15. h3 e5 16. Bxc8 Rxc8 17. Rb3 Qc5+ 18. Qf2 Bxf4 19. Qxc5 dxc5 20.
Ne2 c4 21. Ra3 Bg5 22. Rxa6 c5 23. Kf2 h5 24. Ra4 c3 25. Kf3 Bd2 26. Rc4
Rg5 27. Nxc3 Bxc3 28. Rxc3 h4 29. Rb3 f5 30. Re1 Rd8 31. Re2 fxe4+ 32. Kxe4
Rd4+ 33. Ke3 f5 34. Kf2 Rf4+ 35. Kg1 Re4 36. Rxe4 fxe4 37. Re3 Ke7 38. Rxe4
Rh5 39. Kf2 Ke6 40. a4 Rf5+ 41. Ke3 Rg5 42. Rxh4 Rxg2 43. Ke4 Rxc2 44. Rh6+
Kf7 45. Kxe5 Rg2 46. Kd5 Rg5+ 47. Ke4 Ke7 48. Kf4 Rd5 49. Rh7+ Kf6 50. Rh6+
Kf7 51. Rh7+ Kf6 52. Rh6+ Kf7 53. Rh7+ Kf6
{Xboard adjudication: repetition draw} 1/2-1/2
User avatar
nanochess
Posts: 64
Joined: Thu Feb 19, 2009 5:34 pm
Location: Mexico, Mexico

Re: Current world's smallest chess program

Post by nanochess »

You forgotted to put your name and date of modification in the patch line, people could think that I wrote it :) , please correct it.
By the way, I'm wondering why appears

Code: Select all

int level;
in my program.
Last edited by nanochess on Fri Feb 27, 2009 12:55 am, edited 1 time in total.
User avatar
nanochess
Posts: 64
Joined: Thu Feb 19, 2009 5:34 pm
Location: Mexico, Mexico

Re: Current world's smallest chess program

Post by nanochess »

Would be nice if you post these games in PGN.
User avatar
nanochess
Posts: 64
Joined: Thu Feb 19, 2009 5:34 pm
Location: Mexico, Mexico

Re: Current world's smallest chess program

Post by nanochess »

Very interesting, I hope you could run a Nunn match between factory-default Toledo Nanochess and factory-default Micromax v1.6.
User avatar
nanochess
Posts: 64
Joined: Thu Feb 19, 2009 5:34 pm
Location: Mexico, Mexico

Re: Current world's smallest chess program

Post by nanochess »

By the way, if someone wants to put Toledo Nanochess in a tournament, please tell me first, so I can be aware of it.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Current world's smallest chess program

Post by hgm »

nanochess wrote:You forgotted to put your name and date of modification in the patch line, people could think that I wrote it :) , please correct it.
By the way, I'm wondering why appears

Code: Select all

int level;
in my program.
Oops! :oops:

That is something I used when I was trying to debug it, (finding the reason for the memory increase, checking if it was due to stack growth). I guess I forgot to remove it.

The posted games were in PGN, not?

This is the corrected version:

Code: Select all

/**************************************************************************\
| Toledo Nanochess (c) Copyright 2009 Oscar Toledo G. All rights reserved  |
| 1274 non-blank characters. Evolution from my winning IOCCC 2005 entry.   |
| o Use D2D4 algebraic style for movements.  biyubi@gmail.com  Feb/13/2009 |
| o On promotion add a number for final piece (3=N, 4=B, 5=R, 6=Q)         |
| o Press Enter alone for computer to play.                                |
| o Full legal chess moves.                                                |
| o Remove these comments to get 1341 bytes source code (*NIX end-of-line) |
| o This version patched by H.G.Muller 23/2/2009 to not crash under Cygwin |
\**************************************************************************/
char*l="ustvrtsuqqqqqqqqyyyyyyyy}{|~z|{}"
" + BAW~abcddcba .pknbrq  PKNBRQ\n?A6J57IKJT576,+-48HLSU";
#define F getchar()%16
#define v D(21,0,0,0,
#define Z while(
#define _ ;if(
#define P return y^=8,
B,i,y,u,b,I[120],G,x=10,z=15,q=100;D(f,w,c,h,e,S,s){int t,o,L,E,d,O=f,N=-1e9,p,
*g,n,*m=I,H,A,q,r,C,a=y?-x:x;y^=8;d=!s||1e5>v 0,1,0);H=G;do{_ o=I[p=O]){q
=o&z^y _ q<7&#41;&#123;A=q--&2?8&#58;4;C=o-9&z?q&#91;"& .$  "&#93;&#58;42;do&#123;r=I&#91;p+=C&#91;l&#93;-64&#93;_!w|p==w&&q|
A>2|!r&#41;&#123;g=q|p+a-e?0&#58;I+e _!r&&#40;q|A<3||g&#41;|&#40;r+1&z^y&#41;>9&#41;&#123;m=0 _!&#40;r-2&7&#41;&#41;P G=O,1e6-1e3
*h;n=o&z;t=q|p>28&p<91?n+1&#58;&#40;n+=2,7^y&#41;;Z n-t&#41;&#123;p&#91;I&#93;=n,E=O&#91;I&#93;=m?*g=*m,*m=0&#58;g?*g=0&#58;
0;L=&#40;1-q?l&#91;p/x+5&#93;-l&#91;O/x+5&#93;+l&#91;p%x+6&#93;-l&#91;O%x+6&#93;+o/16*8&#58;!!m*9&#41;+(!q?l&#91;p%x+6&#93;-98+!&#40;I&#91;
p-1&#93;^n&#41;+!&#40;I&#91;p+1&#93;^n&#41;+l&#91;n&7&#93;*9-387+!!g*99+&#40;1==A&&&#40;E=p&#41;)&#58;0&#41;+&#40;r?l&#91;r&7&#93;*9-288-h-q&#58;0&#41;
+!&#40;I&#91;p-a&#93;&z^y^9&#41;;L-=s>h||s==h&&#40;L>z&1<s|!d&#41;?D&#40;H,s>h|!d?0&#58;p,L,h+1,E,N,s&#41;&#58;0 _!(
B-O|i-n|h|p-b|S|L<-1e5&#41;&#41;return u=E;O&#91;I&#93;=o;p&#91;I&#93;=r;m?*m=*g,*g=0&#58;g?*g=9^y&#58;0 _ L>N&#41;
&#123;N=L;G=O _!h&S&&s&#41;i=n,B=O,b=p _ h&&c-L<S&#41;P L;&#125;q==1&A>6&!m&&&#40;g=I+p,m=p<O?g-3&#58;g+2
,o-y+*m>32&!r&!I&#91;p+=p-O&#93;&!m&#91;p<O?1&#58;-1&#93;&!!s&d&L>-1e5&#41;?0&#58;n++;&#125;&#125;&#125;&#125;Z!r&q>2||&#40;p=O,q|A
>2|&#40;o&16&&!r&#41;&&++C&&--A&#41;);&#125;&#125;&#125;Z++O>98?O=20&#58;f-O&#41;;P N+1e9?N<-998100+1e3*h&d?0&#58;N&#58;0;
&#125;main&#40;)&#123;Z B<120&#41;I&#91;B++&#93;=B%x?B/x%x<2|B%x<2?z&#58;B/x&4?0&#58;*l++&31&#58;7;Z i=19&#41;&#123;Z++i<q&#41;write&#40;1,l+(
i&#91;I&#93;|16&#41;,1&#41;_ x-&#40;B=F&#41;)&#123;i=I&#91;B+=q-F*x&#93;&z;b=F;b+=q-F*x;Z x-&#40;G=F&#41;&#41;i=G^8^y;&#125;else G=v u,
1,5&#41;;v u,0,1&#41;;&#125;&#125;
Please, Jim, could you also replace the source in your Toledo_nanochess zip download by this version? There is no need to recompile, the removal of an unused global variable should have no effect on the executable.
User avatar
Jim Ablett
Posts: 1383
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: Current world's smallest chess program

Post by Jim Ablett »

Please, Jim, could you also replace the source in your Toledo_nanochess zip download by this version? There is no need to recompile, the removal of an unused global variable should have no effect on the executable.
Done.

New download link:
http://www.mediafire.com/?ojn4ejmhx0z

Jim.
User avatar
Denis P. Mendoza
Posts: 415
Joined: Fri Dec 15, 2006 9:46 pm
Location: Philippines

Re: Current world's smallest chess program

Post by Denis P. Mendoza »

Jim Ablett wrote:
Please, Jim, could you also replace the source in your Toledo_nanochess zip download by this version? There is no need to recompile, the removal of an unused global variable should have no effect on the executable.
Done.

New download link:
http://www.mediafire.com/?ojn4ejmhx0z

Jim.
Jim,

I can't seem to download this file using the link given. Thanks.

Denis