chessjoker

Discussion of chess software programming and technical issues.

Moderator: Ras

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

Re: chessjoker

Post by hgm »

Pippo wrote:
Michel wrote:It is a check in the sense that if the opponent would do a nullmove, you would take his king.
Right! Fine answer!
Well, but this is exactly the source of the controversy. Because a null-move is not a legal move, no rule for Joker behavior after a null move was formulated.

But formulating one would not solve all problems. The 'virtual check' through which a castling is not allowed to pass is in a sense even more virtual, as the King is not even there to be captured. So it does not use the fiction of a null move, but the fiction of an actual King step (possibly even an illegal King step e1-c1!). Which makes it even more incongruent that the Joker would not move as a King in the virtual reply. (OTOH, how should a Joker move after Ke1-c1? Perhaps like a Chu-Shogi Lion?) But the rules can of course specify anything, whether you agree with the logic or not. I also see not much logic in the rule of Seirawan Chess, that you cannot gate a piece from under a pinned piece.
Pippo
Posts: 50
Joined: Tue Mar 04, 2014 6:40 pm
Location: Murcia España

Re: chessjoker

Post by Pippo »

Ok Evert, now I understand that really ther's a difference: stalemate or checkmate.:oops:

Anyway, I prefer the second way: Joker can do checkmate. This is in accord to "can eat the king after a null movement".

All is clear at last? :wink:
User avatar
hgm
Posts: 28353
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: chessjoker

Post by hgm »

Well, I think there is little to be gained discussing this point forever. Rules can be arbitrary. Unfortunately Fairy-Max is an extremely simple engine, and cannot be configured or easily modified to support Chess variants that do not conform to its own logic. So unless I get some brilliant idea, what we have now is about the best it can do, rule-wise. I don't expect its misconceptions about the rules to have significant impact on the game. (It is for instance much worse that it doesn't know KBK and KNK are draw than that it would not be able to win KJK. After all, it can also not win KBNK.)

A more interesting question is what would be a good piece value for the Joker. Initially I thought it would be somewhere between Knight and Rook. But now I am starting to doubt that. It is too easy for the opponent to compromise the moves of a Joker by choosing which piece to move himself. So you tend to never have many moves if there are any good ones amongst them. So I would be inclined to put its value below that of a minor. Even in Pawn endings a Joker would be quite powerless in stopping a passer, unless it happened to be standing directly in its path. It would be interesting to play Knights vs Jokers in a FIDE context.
Pippo
Posts: 50
Joined: Tue Mar 04, 2014 6:40 pm
Location: Murcia España

Re: chessjoker

Post by Pippo »

hgm wrote:It is too easy for the opponent to compromise the moves of a Joker by choosing which piece to move himself. So you tend to never have many moves if there are any good ones amongst them. So I would be inclined to put its value below that of a minor.
Why you say that it is too easy? It depends.
First, you can have cases in which the opponent joker inhibits the movements of your queen and rooks at the same time. And you don't escape this dangerous situation moving a pawn: you have to stop just the virtual check of the joker.
Secondary, also in the case in which you can decrease the joker strong moving (for example) a pawn, just the fact that you are obligated to do this choice (instead of to do another great movement, for example with queen) is limitating also YOU!
I also think that joker value is near to the rook one.

Anyway, I thank you again very much to find interesting Chessjoker and for work that you have already done.
The future we will see... now to eat!

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

Re: chessjoker

Post by Pippo »

hgm wrote:Well, I think there is little to be gained discussing this point forever. Rules can be arbitrary. Unfortunately Fairy-Max is an extremely simple engine, and cannot be configured or easily modified to support Chess variants that do not conform to its own logic. So unless I get some brilliant idea, what we have now is about the best it can do, rule-wise. I don't expect its misconceptions about the rules to have significant impact on the game. (It is for instance much worse that it doesn't know KBK and KNK are draw than that it would not be able to win KJK. After all, it can also not win KBNK.).
I got it, Harm!

Just after that a player has moved, imitation value of HIS joker has no importance: in the program, must be RESETTED to undefinite value (but, surely, not the same with its value in point!). Because the opponent player has take to care just the POSITION of the opponent joker, not its imitation value (that is effimere, virtual). This is true also in case a joker has been moved.

There are two excepcion, though: castling, and when the joker does checkmate. In the second case, is checkmate and not stalemate just by convention.
User avatar
hgm
Posts: 28353
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: chessjoker

Post by hgm »

I did some test games to gauge the value of the Joker in the end-game, starting from the position

2j1k1j2/ppppppppp/9/9/9/9/PPPPPPPPP/1N2K2N1 w - -

(And sometimes with Bb1 in stead of Nb1.) From this it seems the Joker is indeed more valuable than a minor. But not very much, because the Knights also frequently win (which would be pretty inconceivable for, say 2R vs 2N).

One way for a Joker to defend against running passers is to move up the file they are on to get a diagonal view of the promotion square. Because of the rule that after promotion the Joker moves as Q, it could then capture the Q. (For this is it is a real handicap that Fairy-Max does never consider under-promotion; a good way to thwart this defense would of course be to promote to R. The Joker could defend against that by looking at the promotion square along the back rank, but while the passer is running it cannot move backwards, so it must be lucky to already be there.)

Another way is to move it up along the file until it looks at the King from a distance. (Usually along a rank.) You would then check yourself by promoting. To step out of the Joker's view you need to move the King, and than the Joker can imitate that, to maintain the virtual check, unless your King can shelter behind something.

A strength of the Joker is also that no piece can attack it directly, without the Joker being able to capture it. Only discovered attacks can be safe. In particular, a King can never approach an opponent Joker.

Weakness of the Joker is that it is easily lost when it gets into Pawn range. You move up a Pawn to attack it, and now the Joker can only move forward, either straight or accepting the Pawn sacrifice. Then you move up another Pawn to attack it, etc. until you have drawn it so far forward that you can attack it with a protected Pawn.

Very often the Joker won by 'forking' King + other piece. E.g. in an end-game with K+N vs K+J (plus Pawns) the J steps next to an unprotected Knight and a Knight's jump from the King. Moving the Knight would now put yourself in check, while after moving the King he would take the Knight. So you can only move Pawns, which brings you into zugzwang quite soon, as the opponent can freely roam the board with his King.

The current implementation in Fairy-Max is flawed, because it is totally naive against such threats. It would not see the zugzwang, because it would happily null-move, and after null move it does not allow Joker moves. Making the Joker a 'super-piece' (i.e. Amazon, QN) after null move is too pessimistic, especially in end-games where there are only K, N and P, so there is a guarantee the Joker will never make a distant Q move. You really would have to loop over null moves with different Joker aliases to all pieces you still have. (Which is too complex for Fairy-Max, and rather expensive anyway.)

So I guess I will alter Fairy-Max such that after null move it will assume the Joker moves as a King (rather than not at all). You will always have a King, so if null move does not fail low, it is likely that in the real game you could play a quiet King move. And if the null move was refuted by a Joker king-like move, there is enough reason to worry, because that King move would also be available after moving Q or either R or B (and possibly after moving P). So it seems a reasonable good indicator of whether a full search is needed. In particular, it would make Fairy-Max recognize the zugzwang when a Joker is 'forking' K+N: the null move will fail low on JxN, and the real search will then discover moving away the N will result in JxK.

A nice spin-off is that Fairy-Max will then always consider itself in check when his King is next to a Joker, as the null move used for null-move pruning doubles duty as check detection. This will enable it to win KJK.
Pippo
Posts: 50
Joined: Tue Mar 04, 2014 6:40 pm
Location: Murcia España

Re: chessjoker

Post by Pippo »

Harm, thank you!8-)

<<I did some test games to gauge the value of the Joker in the end-game, starting from the position

2j1k1j2/ppppppppp/9/9/9/9/PPPPPPPPP/1N2K2N1 w - -

(And sometimes with Bb1 in stead of Nb1.) From this it seems the Joker is indeed more valuable than a minor. But not very much, because the Knights also frequently win (which would be pretty inconceivable for, say 2R vs 2N).
One way for a Joker to defend against running passers is to move up the file they are on to get a diagonal view of the promotion square. Because of the rule that after promotion the Joker moves as Q, it could then capture the Q.>>

Fine! Smart behavior :wink:

<<(For this is it is a real handicap that Fairy-Max does never consider under-promotion; a good way to thwart this defense would of course be to promote to R. The Joker could defend against that by looking at the promotion square along the back rank, but while the passer is running it cannot move backwards, so it must be lucky to already be there.)>>

In fact, that is a serious defect! Also to extimate the real joker's value in points: inhibition of promotions is a important skill for a joker. Moreover: I have studied that Chessjoker causes just a wide variability in choice of promoted piece (not always or almost always Q, like in standard game...). This is just one of most interesting things in the variant.

<<Another way is to move it up along the file until it looks at the King from a distance. (Usually along a rank.) You would then check yourself by promoting. To step out of the Joker's view you need to move the King, and than the Joker can imitate that, to maintain the virtual check, unless your King can shelter behind something.>>

Other typicall smart behavior: I think that your program is really understanding...

<<A strength of the Joker is also that no piece can attack it directly, without the Joker being able to capture it. Only discovered attacks can be safe. In particular, a King can never approach an opponent Joker.
Weakness of the Joker is that it is easily lost when it gets into Pawn range. You move up a Pawn to attack it, and now the Joker can only move forward, either straight or accepting the Pawn sacrifice. Then you move up another Pawn to attack it, etc. until you have drawn it so far forward that you can attack it with a protected Pawn.>>

These words seem a letteral traslation of my paper!
On the other side, I noted, already sunday night, that your engine understood soon that... no surprise...

<<...The current implementation inIt would not see the zugzwang, because it would happily null-move, and after null move it does not allow Joker moves. Making the Joker a 'super-piece' (i.e. Amazon, QN) after null move is too pessimistic, especially in end-games where there are only K, N and P, so there is a guarantee the Joker will never make a distant Q move. You really would have to loop over null moves with different Joker aliases to all pieces you still have. (Which is too complex for Fairy-Max, and rather expensive anyway.)
So I guess I will alter Fairy-Max such that after null move it will assume the Joker moves as a King (rather than not at all). You will always have a King, so if null move does not fail low, it is likely that in the real game you could play a quiet King move. And if the null move was refuted by a Joker king-like move, there is enough reason to worry, because that King move would also be available after moving Q or either R or B (and possibly after moving P). So it seems a reasonable good indicator of whether a full search is needed. In particular, it would make Fairy-Max recognize the zugzwang when a Joker is 'forking' K+N: the null move will fail low on JxN, and the real search will then discover moving away the N will result in JxK.
A nice spin-off is that Fairy-Max will then always consider itself in check when his King is next to a Joker, as the null move used for null-move pruning doubles duty as check detection. This will enable it to win KJK.>>

I really cannot understand the importance of null movement...:oops:, probably because I never was programming a chess algoritm.:roll: Null movement is forbidden, so I am naturally inclined to think that it is not important at all. Evidently, I'm wrong.
I guess the problem is related with the "virtual check of the joker", it isn't?

Anyway, about the Fairy-Max's flawing, I have a very easy hint (did you read my last post?). I repeat it:

"Just after that a player has moved, imitation value of HIS joker has no importance: in the program, must be RESETTED to undefinite value (not the same, naturally, with its value in point!). That is because the opponent player has take to care just the POSITION of the opponent joker, not its imitation value (that is effimere, virtual). This is true also in case a joker has been moved.

There are two excepcion, though: castling (of the opponent player), and when the joker does check (really, the exception is only checkmate, but anyway you have before to consider the simple check). In the second case, is checkmate and not stalemate just by convention."

So, I still believe that a simple engine is able to play discreetly to Chessjoker, though the game it is not so easy as in a first view could seem... true?

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

Re: chessjoker

Post by Evert »

Pippo wrote: I really cannot understand the importance of null movement...:oops:, probably because I never was programming a chess algoritm.:roll: Null movement is forbidden, so I am naturally inclined to think that it is not important at all. Evidently, I'm wrong.
Null-move is not legal, but you try it to see if a position is (very) good: if you skip your turn, and your opponent cannot hurt you, then the position can be accepted as "very good" and you do not need to search it further. It saves a considerable amount of time and gains a lot of extra depth.
"Just after that a player has moved, imitation value of HIS joker has no importance: in the program, must be RESETTED to undefinite value (not the same, naturally, with its value in point!). That is because the opponent player has take to care just the POSITION of the opponent joker, not its imitation value (that is effimere, virtual). This is true also in case a joker has been moved.
Glad to see we appear to be on the same page now.
User avatar
hgm
Posts: 28353
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: chessjoker

Post by hgm »

Human Chess players also use null move in their thinking: after the opponent moved, the first thing you usually do is look what threats he made with this move. That is, you imagine it was his turn again (i.e. that you pass yours), and see what is the worst he could do. If he cannot do anything (i.e. his move was pointless), you continue drawing your own plan. If this happens deeper in your analysis, after a move that already gained something, no more plan is needed, and you don't give the pointless opponent move any thought at all.

Computers do likewise. They use null move to detect threats (and checks are threats against your King). Being in check usually makes them search deeper, to make sure they can get out of it again, and that nothing bad will happen after that. If a superficial analysis reveals no threats at all that are worth worrying about, they discard that line.

So null move is quite essential to their quality of search. If the threat was a Joker move, wrong handling of Joker moves after null move might have them overlook it, resulting in a blunder. OTOH, seeing threats that are not there can also leads to blunders, because an imagined threat might prove unsolvable without sacrificing material, and it would sacrifice for nothing.

Note that assuming that the Joker after a null move keeps imitating the piece it last imitated will not solve this. It might be good for specifying the rules of the game, but it makes you completely miss the threats it makes when imitating something else. So perhaps it would be better to allow the Joker to imitate anything (or at least anything that is still on the board) after null move, for the purpose of threat detection. Then you would never miss a threat. But you might see a lot of threats that are not really there, or trivially solved by moving one of the many pieces that would not have that move. Which is also not good.

In an advanced engine the best approach might be to (in the null-move response) first try all moves with non-Joker pieces. If that already reveals a threat, you are done. (You don't care how many threats there are, just if there are none, so you can discard this line.) If that doesn't reveal a threat, you then could try all potential Joker moves. But if one of those looks threatening, we should not immediately get very alarmed, because we could easily dodge the threat by just not moving a piece of the type that could make it. Only when too large a fraction of the pieces we have cannot move we should start to worry. If we have only K+N+Pawns, and the Joker can capture a hanging N with a K move and our King with an N move, we are very, very dead, as Pawns should not really count. Paralyzing two piece types might just be bearable if you have two other piece types left to solve the problem. Paralyzing two types at once will be pretty common, like Q+B on a distant diagonal threat, but still no reason to panic when you have plenty of R and N as well. A sensible rule would seem to look at the fraction of your army's power (e.g. using Q=4, R=2 K=B=N=1) that is paralyzed because any of their moves would activate a refutation with the Joker, and if this rises above a certain threshold (>=50%?) consider the null move refuted.

I must admit I did not quite understand your remark on resetting the imitation value. Which problem is this addressing? Formulation of the existing rules? Or does it alter the rules compared to how they were described previously (like not allowing to move Joker after Joker)?
Pippo
Posts: 50
Joined: Tue Mar 04, 2014 6:40 pm
Location: Murcia España

Re: chessjoker

Post by Pippo »

Ciao Evert!

<<Null-move is not legal, but you try it to see if a position is (very) good: if you skip your turn, and your opponent cannot hurt you, then the position can be accepted as "very good" and you do not need to search it further. It saves a considerable amount of time and gains a lot of extra depth.>>

Ah! Now I understand... But... in this variant that is impossible! It doesn't make sense. You'd have to try all the possibilties for opponent joker. Too expansive, sure...

Since the fantastic semplification in running that you say, an efficient algoritm could try to assign a "mediate" value of imitation (like king, following Harm). But it is claire that this strategy could work only in (very) limitate cases. For example at the beginning of game.

The game is retroactive. This "simple" update introduces a new kind of complexity... Anyway, for humans also it is a great trouble:mrgreen: !!!
"Just after that a player has moved, imitation value of HIS joker has no importance: in the program, must be RESETTED to undefinite value (not the same, naturally, with its value in point!). That is because the opponent player has take to care just the POSITION of the opponent joker, not its imitation value (that is effimere, virtual). This is true also in case a joker has been moved.
Glad to see we appear to be on the same page now.[/quote]

Eheem :oops: Excuse me: I am perfectly incompetent in chess programming, moreover my english is poor and for me it is very hard to understanding your discussions...

Evert, thank you very much for your opinions!