JavaScript chess

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Alessandro Scotti

JavaScript chess

Post by Alessandro Scotti »

An interesting page with engines written in JavaScript:1

http://p4wn.sourceforge.net/

Apparently there's something in less than 3K of code, which includes the user interface!
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: JavaScript chess

Post by hgm »

A close competitor for micro-Max as far as size is concerned. I knew about the 5K contest, but this one is even significantly smaller.

In terms of speed JavaScript can probably not compete with C, though.

Btw, uMax had a nice win today in Open War, against HoiChess. I guess version 4.8 has really reached the state of a quite balanced engine, without any obvious blind spots that can be exploited for an easy victory.
[Event "OpenWar 2nd Edition"]
[Site "DELL-E6600"]
[Date "2007.06.01"]
[Round "55.11"]
[White "Micro-Max 4.8"]
[Black "HoiChess 0.9.0"]
[Result "1-0"]
[TimeControl "2700+5"]
[Annotator "1. +0.10 2... +0.08"]
[Number "1793"]

1. Nc3 {+0.10/10} d5 2. Nf3 {+0.05/11} d4 {+0.08/12} 3. Ne4 {-0.12/11}
Nc6 {+0.13/11} 4. e3 {-0.01/11} dxe3 {+0.18/11} 5. fxe3 {-0.08/12}
e5 {+0.20/10} 6. Bc4 {+0.05/11} Bf5 {+0.17/11} 7. Ng3 {+0.04/11}
Bg6 {+0.65/10} 8. O-O {+0.06/11} Bd6 {+0.23/10} 9. d4 {-0.14/10}
Nf6 {+0.02/10} 10. c3 {+0.06/11} Nd7 {+0.23/10} 11. Bd5 {+0.06/11}
exd4 {-0.09/10} 12. Nxd4 {+0.05/11} Nde5 {-0.19/10} 13. Ndf5 {+0.10/11}
Bf8 {-0.28/10} 14. Qb3 {+0.02/10} Na5 {+0.35/10} 15. Qa4+ {-0.13/12}
c6 {+0.28/10} 16. Rd1 {-0.14/12} Qc7 {+0.22/10} 17. Be4 {-0.18/11}
Nac4 {+0.23/9} 18. b3 {-0.01/10} Nb6 {+0.15/10} 19. Qa5 {+0.01/11}
Rc8 {+0.11/9} 20. c4 {+0.13/10} Qb8 {-0.02/9} 21. c5 {+0.35/12}
Nd5 {-0.67/11} 22. Bxd5 {+0.92/13} cxd5 {-1.15/11} 23. Rxd5 {+0.99/13}
Nd7 {-1.18/10} 24. Nd6+ {+0.95/12} Bxd6 {-1.17/12} 25. cxd6 {+1.11/12}
O-O {-1.16/10} 26. Bd2 {+1.41/11} Rc6 {-1.11/9} 27. Bb4 {+1.34/12}
Re8 {-1.07/10} 28. Re1 {+1.35/12} Rc2 {-1.05/9} 29. Nf5 {+1.53/13}
b6 {-0.88/10} 30. Qb5 {+1.55/12} Nf6 {-0.92/10} 31. Ne7+ {+1.74/11}
Kh8 {-0.96/11} 32. Rd4 {+1.55/12} Rxa2 {-0.87/10} 33. Nxg6+ {+2.05/12}
hxg6 {-0.90/10} 34. d7 {+2.18/13} Rd8 {-1.52/11} 35. Qc6 {+2.33/13}
b5 {-2.06/10} 36. Be7 {+2.42/13} Rxd7 {-2.95/11} 37. Bxf6 {+2.41/14}
Qb7 {-3.00/11} 38. Rh4+ {+2.39/15} Kg8 39. Qxb7 {+2.25/15} Rxb7 {-2.74/11}
40. Be5 {+2.23/14} Re7 {-2.65/10} 41. Rc1 {+2.18/13} Re8 {-2.38/10} 42.
Bd4 {+2.17/13} Ra3 {-2.36/10} 43. Rb1 {+2.20/13} a5 {-2.37/10} 44.
Rg4 {+2.23/13} a4 {-2.37/10} 45. Rg5 {+2.37/15} b4 {-3.97/11} 46.
bxa4 {+2.77/15} Rxa4 {-3.99/10} 47. Rb5 {+2.84/16} f6 {-4.03/10} 48.
R1xb4 {+2.96/15} Rxb4 {-4.04/11} 49. Rxb4 {+3.01/14} Kf7 {-4.09/11} 50.
h4 {+3.16/15} Ke6 {-4.09/10} 51. Kf2 {+3.18/15} Re7 {-4.11/10} 52.
g3 {+3.14/15} Rc7 {-4.12/10} 53. g4 {+3.17/15} Kd5 {-4.13/9} 54.
e4+ {+3.18/16} Ke6 {-4.13/10} 55. g5 {+3.17/17} fxg5 {-4.34/9} 56.
Rb6+ {+3.13/17} Kf7 {-4.70/11} 57. hxg5 {+3.10/18} Re7 {-4.83/11} 58.
Ke3 {+3.64/19} Ra7 {-4.84/11} 59. e5 {+4.10/18} Re7 {-4.90/10} 60.
Ke4 {+4.43/19} Re8 {-5.30/11} 61. Rd6 {+5.07/19} Re7 {-5.34/10} 62.
Kd5 {+6.39/20} Ke8 {-5.95/10} 63. e6 {+12.75/22} Rb7 {-6.70/12} 64.
Ra6 {+16.49/21} Rb8 {-7.20/11} 65. Bc5 {+16.50/15} Rd8+ {-13.45/12} 66.
Bd6 {+3.60/1} Rc8 {-999.90/10} 67. Ra7 {+4.19/2} Kd8 {-999.92/8} 68.
Rd7+ {+4.33/2} Ke8 69. Rf7 {+16.46/4} Rc5+ {-999.96/5} 70. Bxc5 {+8.03/2}
Kd8 71. Rxg7 Kc8 {-999.96/5} 72. Bd6 {+10.08/4} Kd8 73. Rg8# {+9.52/2}
{White mates} 1-0
User avatar
jshriver
Posts: 1342
Joined: Wed Mar 08, 2006 9:41 pm
Location: Morgantown, WV, USA

Re: JavaScript chess

Post by jshriver »

Alessandro Scotti wrote:An interesting page with engines written in JavaScript:1

http://p4wn.sourceforge.net/

Apparently there's something in less than 3K of code, which includes the user interface!
Either this is pretty good or I really suck. Just played it and lost :) pretty fun though.
Tony Thomas

Re: JavaScript chess

Post by Tony Thomas »

Code: Select all

 1. e2 e4   b8 c6
 2. b1 c3   g8 f6
 3. f2 f3   f6 e4
 4. c3 e4   d7 d5
 5. e4 c3   e7 e5
 6. f1 b5   c8 e6
 7. b5 c6   b7 c6
 8. g1 e2   f8 d6
 9. o-o     o-o  
10. d2 d4   e5 d4

 11. e2 d4   d6 h2
12. g1 h2   f7 f5
13. d4 e6   c6 c5
14. e6 d8   f8 d8
15. f1 e1   g7 g5
16. e1 e5   g5 g4
17. e5 f5   g4 f3
18. f5 f3   a7 a6
19. f3 f5   d5 d4
20. c3 e2   h7 h6

 21. f5 c5   d4 d3
22. c2 d3   h6 h5
23. c5 c7   h5 h4
24. c7 c4   d8 d3
25. d1 d3   a8 e8
26. c4 h4   a6 a5
27. h4 g4   g8 h8
28. d3 d4   e8 e5
29. d4 e5   h8 h7
30. e5 h5
 
I think you are bad Joshua.