chessjoker

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Pippo
Posts: 50
Joined: Tue Mar 04, 2014 6:40 pm
Location: Murcia España

Re: chessjoker

Post by Pippo »

Ok, here the complete rules of Chessjoker

• Rule 1 (general rule): There is just one piece more for player: the joker. Disposition is that you can see here:

http://www.bubok.es/libros/231097/Chess ... n-giullare

Rule is: the joker moves as the last piece moved by the opponent player. I will say brefly that the joker "imitates" that piece.

Ex: Black has moved a knight, so the joker of the White imitates now a knight. However, White decides to move a bishop. After this movement, the black joker imitates a bishop. After, Black decides to move just its joker. After this movement, the white joker imitates just the actual value of the black joker: a bishop, in this case.

• Rule 2 (castling rule): There is just one type of castling: after the castling, white king will be in b1 or h1; black king will be in b9 or h9. Any other rule about castling descends fron the traditional FIDE rules of castling.

• Rule 3 (pawn imitation). When the joker imitates a pawn (because the opponent player has moved a pawn), it can always do just ONE step forward (even in the first or second raw. This is just to semplify...). In the last raw, the joker-pawn does not promote and it remains blocked (because it cannot move, neither eat) until the opponent player moves something different by a pawn.

NO MORE RULES!!

But some important redondances:

• The joker is always free to move or capture as a normal piece.
• White cannot begin the game moving the joker: its imitation value is undefined.
• When the joker imitates the king, it cannot suffer a check, castling... ; the imitation is just movement imitation, without identification.
• If a player does a castling, the imitation value for the opponent joker will do a king (not a rook).
• If a player plays a joker, he assigns just its actual imitation value to the opponent joker.
• If a player promotes a pawn to a new piece, he assigns to the opponent joker just the imitation of the promoted piece (often the queen, so. Note that this feature is so interesting for the joker skill).
• It is possible to promote a pawn to a joker (in the paper, two cases in which it is the best thing to do). Naturally, the promoted joker will imitate the last piece moved by the opponent. Also, if a player promotes a pawn to joker, he assigns the actual imitation value of its joker to the opponent joker.
• A player cannot move (or promote a pawn with) any piece who assigns to the opponent joker an imitation value able to put in check its king.
This (perfectly consequent) feature is very important in this new game: the joker can "inhibit" very strongly the opponent movement of important pieces: for example queen and rooks at the same time (more in the paper).

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

Re: chessjoker

Post by Evert »

So just to make sure I understand the following consequences: the Joker cannot give check (except a discovered check), since its move will only be determined after the next player's move (who can put himself in check by moving the wrong piece), correct?

But then, what about a KJvK ending? We know the Joker is going to move like a (non-royal) king, but does that matter? Can it deliver mate? Not if it can't give check, I'd say, so although you can drive the defending king into a corner and deliver the move that would be a mate in "normal" KKvK, the resulting position would be a stalemate.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: chessjoker

Post by hgm »

First game:

Code: Select all

[Event "Computer Chess Game"]
[Site "ONTWIKKELLAPTOP"]
[Date "2014.03.16"]
[Round "-"]
[White "Fairy-Max 4.8S"]
[Black "Fairy-Max 4.8S"]
[Result "0-1"]
[TimeControl "60+0"]
[Variant "joker"]
[FEN "rnbqkbjnr/ppppppppp/9/9/9/9/PPPPPPPPP/RNBQKBJNR w KQkq - 0 1"]
[SetUp "1"]

{--------------
r n b q k b j n r
p p p p p p p p p
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
P P P P P P P P P
R N B Q K B J N R
white to play
--------------}
1. d4 {+0.29/7} Nc6 {+0.24/7 2.3} 2. Be3 {+0.26/7 1.0} Ng6 {+0.17/7 2.2} 3.
Ng3 {+0.22/7 2.8} e5 {+0.19/7 1.4} 4. c3 {-0.02/7 0.9} d5 {+0.18/7 1.2} 5.
Nd2 {-0.05/6 1.1} f5 {+1.59/8 0.7} 6. dxe5 {-1.57/8 0.7} f4 {+1.54/9 1.5}
7. Bxf4 {-1.56/8 1.2} Nxf4 {+1.52/8 0.6} 8. e3 {-1.49/8 2.4} Ng6
{+1.43/7 0.7} 9. f4 {-1.42/7 1.1} a6 {+1.46/6 1.9} 10. e6 {-1.15/6 0.8} Ni5
{+1.29/6 0.9} 11. f5 {-1.40/8 1.2} g6 {+1.40/8 1.2} 12. e4 {-1.46/7 0.6}
dxe4 {+2.15/8 1.5} 13. h4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8 0.4} 41. Jh2 {-6.44/8 0.3} Ne1+ {+6.44/8 0.6} 42. g4+
{-6.54/7 0.4} Nc2+ {+6.54/8 0.4} 43. Kb2+ {-6.52/8 0.6} Ne1 {+6.46/8 0.5}
44. Ri1+ {-6.52/9 1.2} Nd3+ {+6.54/8 0.3} 45. Ka3+ {-6.54/8 0.8} h6+
{+6.32/8 0.3} 46. Rf1+ {-6.33/7 0.3} Je4 {+6.35/8 0.5} 47. Ri1+
{-6.30/9 0.3} i5 {+6.28/9 0.3} 48. Ri3+ {-6.27/9 0.3} Ne5 {+6.26/9 0.5} 49.
Rh3 {-6.29/10 0.6} Jxg4 {+6.28/9 0.5} 50. Rxh6 {-6.67/10 0.8} Jg3
{+6.62/9 0.6} 51. Jd2 {-6.69/9 0.6} Ng4 {+6.77/8 0.4} 52. Ri6
{-6.89/10 0.4} c5 {+6.88/10 0.5} 53. Ri7 {-6.92/9 0.2} i4 {+7.07/10 0.3}
54. Re7 {-7.19/10 0.4} i3 {+7.19/9 0.3} 55. Ri7 {-7.32/9 0.2} Ne3
{+7.32/9 0.2} 56. Ri5 {-7.33/9 0.4} Nc2+ {+7.84/9 0.4} 57. Ka2
{-8.12/9 0.6} Jh2 {+7.88/9 0.3} 58. Jc1 {-8.21/9 0.3} Ne1 {+8.16/9 0.3} 59.
Ka3 {-8.48/9 0.2} i2 {+8.46/9 0.3} 60. Rxi2 {-9.05/11 0.3} Nc2+
{+9.24/12 0.4} 61. Kb2 {-9.02/11 0.3} Jxi2 {+9.21/13 0.2} 62. Jxc2
{-8.25/15 0.3} Bxc2 {+9.12/15 0.3} 63. Kxc2 {-8.40/14 0.3} Rg3
{+9.13/9 0.3} 64. Kb2 {-8.52/9 0.2} Jh3 {+9.12/9 0.3} 65. Ka2
{-8.47/10 0.2} Rg2+ {+9.12/9 0.2} 66. Ka1 {-8.44/10 0.3} Jg4 {+9.12/10 0.7}
67. Kb1 {-8.46/10 0.2} Jh4 {+9.11/10 0.5} 68. Kc1 {-8.45/10 0.2} Jh3
{+9.12/9 0.3} 69. Kb1 {-8.45/11 0.3} Kc7 {+8.37/9 0.3} 70. Kc1
{-8.46/10 0.2} Jg4 {+8.36/9 0.3} 71. Kb1 {-9.57/11 0.7} Kd6 {+9.52/10 0.5}
72. Kc1 {-9.54/10 0.3} Ke5 {+9.52/9 0.2} 73. Kd1 {-9.54/10 0.4} Rb2+
{+9.56/9 0.3} 74. Kc1 {-9.61/10 0.2} Rxb3 {+9.64/10 0.4} 75. Kc2
{-10.26/11 0.3} Ra3 {+10.28/10 0.4} 76. Kd2 {-10.53/10 0.3} Rxa4
{+10.88/9 0.3} 77. Kc3 {-17.27/10 0.4} Rb4 {+17.28/10 0.4} 78. Kd3
{-17.36/10 0.2} a4 {+18.08/10 0.5} 79. Ke3 {-18.02/10 0.2} a3+
{+18.04/9 0.2} 80. Ke2 {-79.96/11 0.2} a2+ {+79.96/10 0.2} 81. Kd3
{-79.97/14 0.2} a1=Q {+79.97/21 0.2} 82. Ke2 {-79.98/26 0.1} Qa2+
{+79.98/28} 83. Ke1 {-79.99/28} Rb1# {+79.99/28}
{Black mates} 0-1
It seems to work (on 9x8; Fairy-Max cannot handle boards with other than 8 ranks). Even when Joker moves after Joker, which happened several times. Not sure whether all the moves make sense, but at least they all seem legal.

I currently calculate the hash index as

pos_key + (stm + 128)*epSquare + joker_alias

I have not really thought very deep about if this would cause collisions with other stm or epSquare values. I guess not, as epSquare only differs from 128 on Pawn moves and castlings, and stm equals 0 or 16.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: chessjoker

Post by Evert »

f you interpret a null-move as the question "is my position good enough that you cannot hurt me even if you're allowed to move twice?" then it would make sense to let the joker play as a superpiece in response to a null move. If the null move still doesn't fail after that you can certainly prune the node. If the null move is refuted by a joker move, that also gives you a hint for what you may want to avoid moving.

But there is also some sense in not allowing the joker to move at all, or assigning it the move of the piece that seems most likely to let you make a tempo move (interpreting the null move as an "arbitrary move that effectively does nothing").

It's tricky. I think the first is "safer" in the sense that if you pass that, you know you're safe. Otherwise the null move will mask tactics by the other side, but there's a better chance the null-move produces a cut-off. The question is which is more important.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: chessjoker

Post by hgm »

Evert wrote: although you can drive the defending king into a corner and deliver the move that would be a mate in "normal" KKvK, the resulting position would be a stalemate.
Very astute observation. I was thinking the Joker had mating potential. But you are absolutely right. And Fairy-Max agrees with you (because I did disable the Joker after null move, and it uses null move for check detection). It cannot win KJK.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: chessjoker

Post by hgm »

OK, I posted the Fairy-Max derivative for download at

http://hgm.nubati.net/jokermax.zip

I guess it can only run on the WinBoard development version, where you can simply select 'joker' from the New Variant menu. (I implemented it as an engine-defined variant, so that the engine configures board size and initial position itself.) This WinBoard can be downloaded from

http://hgm.nubati.net/WinBoard-4.8.beta.zip
Pippo
Posts: 50
Joined: Tue Mar 04, 2014 6:40 pm
Location: Murcia España

Re: chessjoker

Post by Pippo »

Evert wrote:So just to make sure I understand the following consequences: the Joker cannot give check (except a discovered check), since its move will only be determined after the next player's move (who can put himself in check by moving the wrong piece), correct?

no, Evert! joker cannot SUFFERS a check (when it imitates the king) because it isn't the king. It can normally give check to the opponent king. Imitation value of jokers always is known!

But then, what about a KJvK ending? We know the Joker is going to move like a (non-royal) king, but does that matter? Can it deliver mate? Not if it can't give check, I'd say, so although you can drive the defending king into a corner and deliver the move that would be a mate in "normal" KKvK, the resulting position would be a stalemate.
Rein Halbersma
Posts: 741
Joined: Tue May 22, 2007 11:13 am

Re: chessjoker

Post by Rein Halbersma »

hgm wrote:OK, I posted the Fairy-Max derivative for download at

http://hgm.nubati.net/jokermax.zip

I guess it can only run on the WinBoard development version, where you can simply select 'joker' from the New Variant menu. (I implemented it as an engine-defined variant, so that the engine configures board size and initial position itself.) This WinBoard can be downloaded from

http://hgm.nubati.net/WinBoard-4.8.beta.zip
so... when's the FairyMax-StockJoker grudge match going to be held? ;-) (seriously, you guys seem to be quite grumpy and at each other's throat for no apparent reason)
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: chessjoker

Post by hgm »

And note that today was his good mood! :lol:
Pippo
Posts: 50
Joined: Tue Mar 04, 2014 6:40 pm
Location: Murcia España

Re: chessjoker

Post by Pippo »

I repeat my reply to Evert (sorry I don't write well the post):

no, Evert! joker cannot SUFFERS a check (when it imitates the king) because it isn't the king. It can normally give check to the opponent king. Imitation value of jokers always is known!