Shuriken, a Ruby chess variant engine

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

JohnWoe
Posts: 511
Joined: Sat Mar 02, 2013 11:31 pm

Shuriken, a Ruby chess variant engine

Post by JohnWoe »

This is the engine I have been working on quite some time. As I have always liked and played a lot of capablanca chess variant.

gem: https://rubygems.org/gems/shurikenengine
Docs: https://www.rubydoc.info/gems/shurikenengine/0.31
Source code: https://github.com/SamuraiDangyo/Shuriken

Shuriken currently supports: caparandom + capablanca + gothic + falcon variants.
Only Xboard protocol.
Can play tons of games w/o crashing.
There isn't many Ruby engines: Rubyknight(Standard chess) and maybe some more.

Will add more variants in the future. But only bigger boards. No 8x8 boards. I'm done w/ standard chess.

What is the strength? Shuriken generates moves by 14_000 nps whereas Sapeli generates 30_000_000 nps. So being 2_000 slower leaves not much room for game logic. It is stronger that random mover. Fairy-max was too tough so I made a random mover opponent for shuriken w/ -randommode option:

It can beat a random mover every time. But not much more than that. In the future if I manage to speed up move generation to at least 1 mnps then there's room for game play creativity. I'm gonna keep Shuriken 100% Ruby. As I like Ruby language a lot. So I'm not gonna write anything in C.

Code: Select all

[Event "Computer Chess Game"]
[Site "pc"]
[Date "2019.07.26"]
[Round "-"]
[White "Shuriken 0.31"]
[Black "Shuriken 0.31 random"]
[Result "1-0"]
[TimeControl "40/60"]
[Variant "caparandom"]
[FEN "aqrncbbkrn/pppppppppp/10/10/10/10/PPPPPPPPPP/AQRNCBBKRN w ICic - 0 1"]
[SetUp "1"]

{--------------
a q r n c b b k r n
p p p p p p p p p p
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
P P P P P P P P P P
A Q R N C B B K R N
white to play
--------------}
1. Ab3 {+0,00/22} i6 2. Qa1 {+0,00/13 1,9} e5 3. g4 {+0,00/16 1,9} b5+ 4.
f3 {+0,00/12 1,8} Ki7 5. Bj5 {+0,00/6 1,8} Axf3+ 6. exf3 {+0,00/7 1,7} c5
7. h3 {+0,00/4 1,6} Bd6 8. Aa5 {+0,00/11 1,6} h5 9. Nc3 {+0,00/15 1,5} g6
10. Bi3 {+0,00/11 1,5} Nb7 11. Cd1 {+0,00/14 1,4} Cc7 12. Ne2
{+0,00/22 1,4} Cd5 13. Ng1 {+0,00/20 1,3} Nxa5 14. b3 {+0,00/18 1,3} Rf8
15. Ce1 {+0,00/15 1,3} Kh8 16. d3 {+0,00/21 1,2} i5 17. Qd4 {+0,00/15 1,2}
Nc6 18. Kh2 {+0,00/15 1,1} Qa8 19. a4 {+0,00/12 1,1} Ne7 20. f4
{+0,00/11 1,1} Re8 21. Ce3 {+0,00/5 1,0} Cb4 22. Cc4 {+0,00/17 1,0} cxd4
23. Ne2 {+0,00/12 1,0} Qc6 24. Rce1 {+0,00/15 0,9} bxa4 25. Rif1
{+0,00/5 0,9} Rb8 26. Ri1 {+0,00/13 0,9} Bh7 27. Nc3 {+0,00/16 0,8} Qg2+
28. Kxg2 {+0,00/11 0,8} Cxb3 29. cxb3 {+0,00/22 0,8} Bc7 30. Reg1
{+0,00/20 0,8} Ra8 31. Nd5 {+0,00/17 0,7} Nc6 32. Be7 {+0,00/16 1,0} Rd8
33. i4 {+0,00/20 1,0} a6 34. Cd6 {+0,00/18 0,9} Bxd6 35. Rf1 {+0,00/22 0,9}
g5 36. Kf2 {+0,00/7 0,9} Kg8 37. h4 {+0,00/9 0,8} Rc8 38. Ri3 {+0,00/7 0,8}
Bb4 39. Rii1 {+0,00/14 0,7} Be1+ 40. Kxe1 {+0,00/12 0,7} Kh8 41. Rfg1
{+0,00/6 2,4} Kg8 42. gxh5 {+0,00/7 2,4} Rb8 43. Kd2 {+17,00/21 2,3} Nd8
44. j4 {+30,00/12 2,2} Nc6 45. b4 {+0,00/22 2,1} Bxj5 46. Bxg5
{+0,00/13 2,1} Rxb4 47. Rih1 {+0,00/5 2,0} Kf8 48. Ke2 {+0,00/11 1,9} a5
49. ixj5 {+0,00/20 1,9} Rc4 50. jxi5 {+3,00/16 1,8} Ke8 51. Bd8
{+17,00/12 1,7} Rb4 52. h6 {+0,00/10 1,7} Rb7 53. Nh2 {+3,00/19 1,6} Nh7
54. Rj1 {+0,00/15 1,6} e4 55. Rf1 {+0,00/20 1,5} Rj8 56. Kd1 {+0,00/19 1,5}
d6 57. Re1 {+0,00/20 1,4} Rg8 58. Rj2 {+0,00/12 1,4} Rb3 59. Ri2
{+0,00/11 1,3} Rb8 60. Rf1 {+0,00/22 1,3} Rf8 61. Nf3 {+0,00/16 1,2} Rb6
62. j6 {+0,00/9 1,2} Rg8 63. Ne1 {+0,00/4 1,2} Rb2 64. Rfi1 {+0,00/18 1,1}
Rd2+ 65. Kxd2 {+0,00/21 1,1} Nf6 66. Rg1 {+0,00/3 1,0} Ne7 67. Rf2
{+0,00/15 1,0} Rh8 68. Rj1 {+0,00/15 1,0} Nexd5 69. Rh2 {+0,00/21 0,9} Nh5
70. Ke2 {+0,00/7 0,9} Nb4 71. h7 {+0,00/22 0,9} Kf8 72. Rj5 {+0,00/13 1,3}
Ke8 73. Bb6 {+0,00/22 1,2} Ni3 74. dxe4 {+0,00/16 1,2} a3 75. Kd1
{+0,00/13 1,1} Ri8 76. Kd2 {+0,00/14 1,0} Rf8 77. Nc2 {+0,00/17 1,0} f5 78.
Re2 {+0,00/12 0,9} Nxc2 79. e5 {+0,00/6 0,9} Rj8 80. Kxc2 {+0,00/14 0,8}
Kf8 81. Rjj2 {+0,00/5 2,5} dxe5 82. Bc5+ {+0,00/13 2,5} Kf7 83. Rjg2
{+13,00/8 2,4} Ri8 84. Ref2 {+3,00/9 2,3} a4 85. Bf8 {+0,00/11 2,2} Rxf8
86. h8=Q {+0,00/6 2,1} Nh1 87. i6 {+0,00/22 2,1} Rb8 88. ixj7
{+0,00/16 2,0} Rc8+ 89. Kd1 {+13,01/16 1,9} Ke7 90. Re2 {+28,00/20 1,9} Nj2
91. Qg7+ {+15,00/7 1,8} Ke6 92. Qg8+ {+0,00/17 1,7} Ke7 93. Qh7+
{+13,00/12 1,7} Ke6 94. Rxe5+ {+30,00/3 1,6} Kf6 95. Qe7# {+100,00/12 1,6}
{Xboard adjudication: Checkmate} 1-0
Norbert Raimund Leisner
Posts: 1643
Joined: Tue May 20, 2008 4:57 pm
Location: Augsburg - Germany

Re: Shuriken, a Ruby chess variant engine

Post by Norbert Raimund Leisner »

Unfortunately no Windows binary (32 or 64 bit) is available there:

Well, it would be interesting to know if Shuriken works similar with Instant Rails for Windows and a batch-file like MyTeacheR, a CECP-compatible engine from France several years ago:

MyTeacheR (Ruby) under Windows

1.- downlod MyTeacheR archive:

https://github.com/micktaiwan/MyTeacheR ... master.zip

2.-unzip the content of this archive in : C:\myteacher

3.- download InstantRails 2.0 application ( most of Ruby apps don't work directly via a Ruby interpreter. InstantRails contains also the Ruby interpreter):

http://rubyforge.org/frs/download.php/2 ... .0-win.zip (until 15th May 2014)

http://web.archive.org/web/201405151823 ... .0-win.zip (Wayback Archive)


4.-unzip InstantRails in: C:\InstantRails

5.- make a myteacher.bat file having the following content:

-----------------------------------
REM Set up the environment variables for the script
set PATH_TO_RUBY=C:\InstantRails\ruby\bin
set RUBY=%PATH_TO_RUBY%\ruby.exe
set PATH_TO_SCRIPTS=C:\myteacher

%RUBY% %PATH_TO_SCRIPTS%\xboard.rb
-------------------------------------

6.-put myteacher.bat file in C:\myteacher folder

7.install myteacher.bat file like WB engine

Regards,
Norbert
JohnWoe
Posts: 511
Joined: Sat Mar 02, 2013 11:31 pm

Re: Shuriken, a Ruby chess variant engine

Post by JohnWoe »

Norbert Raimund Leisner wrote: Fri Jul 26, 2019 2:44 pm Unfortunately no Windows binary (32 or 64 bit) is available there:

Well, it would be interesting to know if Shuriken works similar with Instant Rails for Windows and a batch-file like MyTeacheR, a CECP-compatible engine from France several years ago:

MyTeacheR (Ruby) under Windows

1.- downlod MyTeacheR archive:

https://github.com/micktaiwan/MyTeacheR ... master.zip

2.-unzip the content of this archive in : C:\myteacher

3.- download InstantRails 2.0 application ( most of Ruby apps don't work directly via a Ruby interpreter. InstantRails contains also the Ruby interpreter):

http://rubyforge.org/frs/download.php/2 ... .0-win.zip (until 15th May 2014)

http://web.archive.org/web/201405151823 ... .0-win.zip (Wayback Archive)


4.-unzip InstantRails in: C:\InstantRails

5.- make a myteacher.bat file having the following content:

-----------------------------------
REM Set up the environment variables for the script
set PATH_TO_RUBY=C:\InstantRails\ruby\bin
set RUBY=%PATH_TO_RUBY%\ruby.exe
set PATH_TO_SCRIPTS=C:\myteacher

%RUBY% %PATH_TO_SCRIPTS%\xboard.rb
-------------------------------------

6.-put myteacher.bat file in C:\myteacher folder

7.install myteacher.bat file like WB engine

Regards,
Norbert
Thanks for the feedback!
Shuriken is a work in progress.

But using it is pretty simple:

Code: Select all

> gem install shurikenengine
> chmod a+x shuriken # in bin folder etc
> ruby shuriken -xboard # enters xboard mode
Or just

Code: Select all

require "shuriken"
...your code...
Or just use make fairycapa etc in lib/shuriken
You'll get this ->
Capablanca chess: Those 3 wins are fairy timelosses. Shuriken didn't outplay fairy unfortunately..

Code: Select all

...
Score of Fairy-Max 5.0b vs Shuriken 0.32: 97 - 3 - 0  [0.970] 100
Elo difference: 603.86 +/- nan
Finished match