SjaakII 1.0 RC1

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

Moderator: Ras

User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: SjaakII 1.0 RC6

Post by Evert »

Can you post the problematic config?
myfish
Posts: 131
Joined: Sat Feb 07, 2015 3:17 pm

Re: SjaakII 1.0 RC6

Post by myfish »

Evert wrote:Can you post the problematic config?
This loads.

Code: Select all

##########
# WaShogi #
##########

Variant: WaShogi (11x11)
Board: 11x11
FEN: "hmocvkwgubd/1e3l3f1/ppprpppqppp/3p3p3/11/11/11/3P3P3/PPPQPPPRPPP/1E3L3F1/DBUGWKVCOMH w - 0 1"
XBoard pieces:  "P.BRQFE.CWMOH..GDVL.U.+.++.+..+++++..+++.++Kp.brqfe.cwmoh..gdvl.u.+.++.+..+++++..+++.++k"
XBoard parent:  "chu"
Zone: white_promotion = a11,b11,c11,d11,e11,f11,g11,h11,i11,j11,k11,a10,b10,c10,d10,e10,f10,g10,h10,i10,j10,k10,a9,b9,c9,d9,e9,f9,g9,h9,i9,j9,k9
Zone: black_promotion = a3,b3,c3,d3,e3,f3,g3,h3,i3,j3,k3,a2,b2,c2,d2,e2,f2,g2,h2,i2,j2,k2,a1,b1,c1,d1,e1,f1,g1,h1,i1,j1,k1

# crane King, K=King
# cloud Eagle, E=Alfil
# flying Falcon F=Ferz promotes to *Tenacious Falcon
# swaLLows wings, L=Lance promotes to *Gliding Swallow
# Treacherous fox, Q=Queen
# running Rabbit, R=Rook promotes to *Treacherous fox
# violent Wolf, W=Wazir promotes to *Bear's Eyes
# Violent stag, V=Falcon promotes to *Roaming Boar
# flying Goose, G=Grasshopper promotes to *Swallow's Wings
# flying Cock, C=Chancellor promotes to *Raiding Falcon
# strUtting crow, U=Unicorn promotes to *Flying Falcon
# swooping Owl, O=Cannon promotes to *Cloud Eagle
# Blind dog, B=Bishop promotes to *Violent Wolf
# climbing Monkey, M=Man promotes to *Violent Stag
# liberated Horse, H=Nightrider promotes to  *Heavenly Horse
# oXcart, D promotes to *Plodding Ox
# sparrow Pawn, P=Pawn promotes to *Golden Bird


# Define the pieces

Piece: Crane King
Move: leap (0,1)|(1,1)
Symbol: "K", "K,k"
Flags: royal

Piece: Cloud Eagle
Move: slide (V)
Move: step W,E,SW,SE,3NW,3NE
Symbol: "E", "E,e"
Value: 850

Piece: Treacherous Fox
Symbol: "Q", "Q,q"
Move: step NW,N,NE,SW,S,SE
Move: leap (2,2)|(-2,2)
Value: 750

Piece: Sparrow Pawn
Symbol: "P", "P,p"
Move: step N
Promotion: white_promotion, black_promotion, "+"
#Flags: drop_no_mate, drop_one_file
Value: 80

Piece: Golden Bird
Move: aleap (1,0)|(-1,0)|(0,1)|(0,-1)|(1,1)|(-1,1)
Symbol: "+P", "+P,+p"
Value: 450

Piece: Flying Falcon
Symbol: "F", "F,f"
Move: slide (D,A)
Move: step N
Promotion: white_promotion, black_promotion, "+"
Value: 600

Piece: Tenacious Falcon
Symbol: "+F", "+F,+f"
Move: slide (V,A,D)
Move: step W,E
Value: 700

Piece: Running Rabbit
Symbol: "R", "R,r"
Move: step 11N
Move: step NE,NW,SE,S,SW
Promotion: white_promotion, black_promotion, "+"
Value: 400

Piece: Promoted Running Rabbit
Move: step NW,N,NE,SW,S,SE
Move: leap (2,2)|(-2,2)|(-2,2)|(-2,-2)
Symbol: "+R", "+R,+r"
Value: 750

Piece: Violent Wolf
Symbol: "W", "W,w"
# Move: step N
Promotion: white_promotion, black_promotion, "+"
Value: 400

Piece: Bears Eyes
Symbol: "+W", "+W,+w"
Move: leap (0,1)|(1,1)

Piece: Violent Stag
Symbol: "V", "V,v"
Move: step N
Promotion: white_promotion, black_promotion, "+"

Piece: Roaming Boar
Symbol: "+V", "+V,+v"
Move: step N

Piece: Blind Dog
Symbol: "B", "B,b"
Move: step N
Promotion: white_promotion, black_promotion, "+"

Piece: Promoted Blind Dog
Symbol "+B", "+B,+b"
Move: step N

Piece: Climbing Monkey
Symbol: "M", "M,m"
Move: step N
Promotion: white_promotion, black_promotion, "+"

Piece: Promoted Flying Monkey
Symbol: "+M", "+M,+m"
Move: step N

Piece: Flying Goose
Symbol: "G", "G,g"
Move: step N
Promotion: white_promotion, black_promotion, "+"

Piece: Promoted Flying Goose
Symbol: "+G", "+G,+g"
Move: slide (H)

Piece: Flying Cock
Symbol: "C", "C,c"
Move: step N
Promotion: white_promotion, black_promotion, "+"

Piece: Raiding Falcon
Symbol: "+C", "+C,+c"
Move: step N

Piece: Swallows Wings
Symbol: "L", "L,l"
# Move: step N
Promotion: white_promotion, black_promotion, "+"

Piece: Gliding Swallow
Symbol: "+L", "+L,+l"
Move: step N

Piece: Strutting Crow
Symbol: "U", "U,u"
Move: step N
Promotion: white_promotion, black_promotion, "+"

Piece: Promoted Strutting Cow
Symbol: "+U", "+U,+u"
Move: slide (D,A)
Move: step N

Piece: Swooping Owl
Symbol: "O", "O,o"
Move: step N
Promotion: white_promotion, black_promotion, "+"

Piece: Cloud Eagle (Promoted Swooping Owl)
Symbol: "+O", "+O,+o"
Move: step N

Piece: Liberated Horse
Symbol: "H", "H,h"
Move: step 10N,2S
Promotion: white_promotion, black_promotion, "+"

Piece: Heavenly Horse
Symbol: "+H", "+H,+h"
Move: aleap (1,2)|(-1,2)|(1,-2)|(-1,-2)

Piece: Oxcart
Symbol: "D", "D,d"
Move: step 10N
Promotion: white_promotion, black_promotion, "+"

Piece: Plodding Ox (Promoted Oxcart)
Symbol: "+D", "+D,+d"
Move: leap (0,1)|(1,1)

#Rule: keep capture, allow drops
Rule: repeat4 = draw
Rule: perpetual4 = loss

Uncomment the Move: in 'Violent Wolf' and try again.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: SjaakII 1.0 RC6

Post by Evert »

Ok, I see.

You're running into another limit here: in addition to the limit on the number of piece types (32), Sjaak has limits on the number of pieces that can make a particular move. This isn't documented, so I guess I should do that.
  • You can have an unlimited number of sliders/hoppers.
  • You can have up to 16 leapers (it should be 16 symmetric and 16 asymmetric leapers, but I just saw that it applies the same limit for both).
  • You can have up to 15 steppers.
These limits would be pretty hard to change.
Now, the situation for leapers isn't quite so bad, because Sjaak is a bit clever about re-using leaper tables if it can, so if you define several pieces with the same leaper move it will use the same type for each. It's not so smart when it comes to steppers (which I guess is another thing I should go and fix).

Right now, you define more than the 15 steppers Sjaak can handle, but many of them look like they are the same. So my immediate suggestion is to change as many of those as possible to asymmetric leapers. The following describe the same moves:

Code: Select all

Move: step NW,N,NE,SW,S,SE 
and

Code: Select all

Move: aleap (1,1)|(0,1)|(-1,1) | (1,-1)|(0,-1)|(-1,-1)
(The latter will probably be more efficient though).

A few other comments:

"leap" is for symmetric leapers, so

Code: Select all

Move: leap (2,2)|(-2,2)|(-2,2)|(-2,-2) 
is the same as

Code: Select all

Move: leap (2,2)
For an asymmetric leaper you would write

Code: Select all

Move: aleap (2,2)|(-2,2)|(-2,2)|(-2,-2) 
You can simplify (and fix) this

Code: Select all

Piece: Promoted Running Rabbit 
Move: step NW,N,NE,SW,S,SE 
Move: leap (2,2)|(-2,2)|(-2,2)|(-2,-2) 
Symbol: "+R", "+R,+r" 
Value: 750 
to this

Code: Select all

Piece: Promoted Running Rabbit 
Move: aleap (1,1)|(0,1)|(-1,1) | (1,-1)|(0,-1)|(-1,-1) | (2,2)|(-2,2)|(-2,2)|(-2,-2) 
Symbol: "+R", "+R,+r" 
Value: 750 
This:

Code: Select all

Piece: Running Rabbit 
Symbol: "R", "R,r" 
Move: step 11N 
Move: step NE,NW,SE,S,SW 
Promotion: white_promotion, black_promotion, "+" 
Value: 400 
does not work: the move type must be different on every Move: line. You can either combine them into one line, or replace the second one with an aleap (this is probably better).

Those issues aside, I don't see anything particularly wrong with it. I will fix the re-use of steppers and the separate limits on leapers and asymmetric leapers (and document that these limits exist).
myfish
Posts: 131
Joined: Sat Feb 07, 2015 3:17 pm

Re: SjaakII 1.0 RC6

Post by myfish »

OK, I'll see if I can work with the constraints. Thanks.
myfish
Posts: 131
Joined: Sat Feb 07, 2015 3:17 pm

Re: SjaakII 1.0 RC6

Post by myfish »

with the 'W' definition, it wouldn't load if I removed the commented out Violent Wolf piece def.

However:

That definition had Promotion: white_promotion, black_promotion, "+" in it

The moment I added the Move: for the promoted piece, despite the symbol and name being defined, it loaded. So this means the pieces are 'linked' in the definitions too, not just on the board.

It's 'starting' to come together but with 17 piece types and 14 promotional types, it's a bit like a maze. I'm sure I'll have a basic working version soon though.
User avatar
gbtami
Posts: 389
Joined: Wed Sep 26, 2012 1:29 pm
Location: Hungary

Re: SjaakII 1.0 RC6

Post by gbtami »

Evert wrote:
gbtami wrote:I think this now is a real bug :)

[Event "Helyi esemény"]
[Site "Helyben"]
[Date "2015.03.10"]
[Round "1"]
[White "PyChess.py"]
[Black "sjaakii"]
[Result "*"]
[TimeControl "60+2"]
[Time "22:49:00"]
[WhiteClock "0:00:09.579"]
[BlackClock "23:59:59.863"]
[Variant "Sittuyin"]
[SetUp "1"]
[FEN "8/8/4pppp/pppp4/4PPPP/PPPP4/8/8/nnssrrfkNNSSRRFK w - - 0 1"]
[PlyCount "137"]

1. K@a2 K@e7 2. R@d1 S@d6 3. N@e3 R@f8 4. N@g3 S@c6 5. R@e1 N@b7 6. S@f3 N@c7
7. S@d2 R@d8 8. F@e2 F@b6 9. exd5 Nxd5 10. Nxd5+ exd5 11. g5 fxg5 12. fxg5 hxg5
13. hxg5 c4 14. bxc4 bxc4 15. dxc4 dxc4 16. Se3 Nc5 17. Sd4 Rb8 18. Sxc5 Fxc5
19. Ne4 Se5 20. Nd2 Rf5 21. Nxc4 Rxg5 22. Sg4 Sb5 23. Ne3 Fd4 24. Sxg5 Fxe3 25.
Ff3 Ke6 26. Rxe3 Sc4 27. Sxg6 Rb3 28. Fg4 Rb5 29. Ff5+ Kf6 30. Rf1 Rb3 31. Rb1
Rxb1 32. Kxb1 a4 33. Kc1 Sd5 34. Rg3 Sc4 35. Kb2 Sf4 36. Rg1 Sd3 37. Rf1 Kg5
38. Kc1 Se2 39. Rh1 Sd3 40. Rg1+ Kf6 41. Rf1 Kg5 42. Rf2 Se3 43. Rf3 Sdd2+ 44.
Kc2 Sf4 45. Rh3 Sde3 46. Rh7 Kf6 47. Kc1 Ke5 48. Ra7 Kd5 49. Rxa4 Se5 50. Ra5+
Kd6 51. Rb5 S5f4 52. Rb7 Kc6 53. Re7 Kd5 54. Rc7 Kd6 55. Rh7 Kc6 56. Kb1 Kd6
57. Rf7 Sg3 58. Rg7 Sgf4 59. Fe4 Ke5 60. Sf5 Kd6 61. c4 Ke5 62. Rd7 Sg3 63. c5
Kf4 64. Ka1 Sgf2 65. Rf7 Sg3 66. Kb2 Sd4 67. c6 Ke3 68. Kc2 Sf4 69. c7 *

Now sjaakii claimed the c6c7 move illegal but it's not IMO.
Correct, fixed.

This is the type of bug that's hard to spot in self-play: how do you reliably detect that a move is never generated, if the only sparring-partner never generates it either?
Do you have perft functionality in PyChess?
Implemented it (using your perft), and created a single file python zip executable here:
http://web.t-online.hu/berado/pychess-engine
You can run it after chmod +x pychess-engine if you have python installed, or just run it with python/python3/pypy as is.
myfish
Posts: 131
Joined: Sat Feb 07, 2015 3:17 pm

Re: SjaakII 1.0 RC6

Post by myfish »

Evert wrote:Ok, I see.

You're running into another limit here: in addition to the limit on the number of piece types (32), Sjaak has limits on the number of pieces that can make a particular move. This isn't documented, so I guess I should do that.
  • You can have an unlimited number of sliders/hoppers.
  • You can have up to 16 leapers (it should be 16 symmetric and 16 asymmetric leapers, but I just saw that it applies the same limit for both).
  • You can have up to 15 steppers.
These limits would be pretty hard to change.
Now, the situation for leapers isn't quite so bad, because Sjaak is a bit clever about re-using leaper tables if it can, so if you define several pieces with the same leaper move it will use the same type for each. It's not so smart when it comes to steppers (which I guess is another thing I should go and fix).
I'm sure I now have
16 leaps
15 steps
09 slides

I could of course swap some around if you split 'aleap' and 'leap'.
However, I can only get a game loaded with 14 leaps, not 16 so I have switched 2 pieces off in the config whilst I'm building the rest of the svg pieces in the 'hope', you can accommodate this config with some tweaks.
User avatar
gbtami
Posts: 389
Joined: Wed Sep 26, 2012 1:29 pm
Location: Hungary

Re: SjaakII 1.0 RC6

Post by gbtami »

gbtami wrote:Implemented it (using your perft), and created a single file python zip executable here:
http://web.t-online.hu/berado/pychess-engine
You can run it after chmod +x pychess-engine if you have python installed, or just run it with python/python3/pypy as is.
Updated it with readline support. For me the readline support works with python3, but not with python2, dunno why.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: SjaakII 1.0 RC6

Post by Evert »

myfish wrote:
Evert wrote:Ok, I see.

You're running into another limit here: in addition to the limit on the number of piece types (32), Sjaak has limits on the number of pieces that can make a particular move. This isn't documented, so I guess I should do that.
  • You can have an unlimited number of sliders/hoppers.
  • You can have up to 16 leapers (it should be 16 symmetric and 16 asymmetric leapers, but I just saw that it applies the same limit for both).
  • You can have up to 15 steppers.
These limits would be pretty hard to change.
Now, the situation for leapers isn't quite so bad, because Sjaak is a bit clever about re-using leaper tables if it can, so if you define several pieces with the same leaper move it will use the same type for each. It's not so smart when it comes to steppers (which I guess is another thing I should go and fix).
I'm sure I now have
16 leaps
15 steps
09 slides

I could of course swap some around if you split 'aleap' and 'leap'.
However, I can only get a game loaded with 14 leaps, not 16 so I have switched 2 pieces off in the config whilst I'm building the rest of the svg pieces in the 'hope', you can accommodate this config with some tweaks.
Please give http://www.eglebbk.dds.nl/program/downl ... src.tar.gz a shot. It's a bit more clever about reusing existing entries when it can, and if you type "pieceinfo" it will now list the number of leapers/aleapers and steppers as part of the info dump.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: SjaakII 1.0 RC6

Post by Evert »

gbtami wrote:
gbtami wrote:Implemented it (using your perft), and created a single file python zip executable here:
http://web.t-online.hu/berado/pychess-engine
You can run it after chmod +x pychess-engine if you have python installed, or just run it with python/python3/pypy as is.
Updated it with readline support. For me the readline support works with python3, but not with python2, dunno why.
Readline doesn't seem to work for me either, Python 2.7

We disagree on perft 1 in my first test position (which you may recognise): 8/6k1/6p1/3s2P1/3npR2/2r5/p2N2F1/3K4[-] b 0 49, SjaakII lists both a2-a1 and a2-a1F, while PyChess only lists the latter as a legal move. I'm guessing that it doesn't allow non-promotion pawn moves to the last rank, or else considers the move illegal because the pawn turns into dead wood if it doesn't promote. However, my understanding of the rules is that this is actually allowed.