Check out Alice Chess, our featured variant for June, 2024.


[ Help | Earliest Comments | Latest Comments ]
[ List All Subjects of Discussion | Create New Subject of Discussion ]
[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Comments/Ratings for a Single Item

EarliestEarlier Reverse Order LaterLatest
ChessVA computer program
. Program for playing numerous Chess variants against your PC.[All Comments] [Add Comment or Rating]
Aurelian Florea wrote on Wed, Dec 14, 2022 05:49 PM UTC in reply to Greg Strong from 05:31 PM:

The rest I'm leaving them as they are no enpassant. Thanks for your help!


Aurelian Florea wrote on Sat, Dec 17, 2022 06:45 AM UTC in reply to Greg Strong from Wed Dec 14 05:31 PM:

Hello Greg, More questions from me I'm afraid. How do I tell the AI that a piece is minor or major? I noticed the ai knows that KBvK is a draw, probably also KNvK too. I do not know about KNNvsK. I am interested in KMvK,vwhere M stands for mamluk(CW).


Aurelian Florea wrote on Sat, Dec 17, 2022 10:20 AM UTC in reply to Aurelian Florea from 06:45 AM:

Oh,

also in the KJvK endgame the AI does not know how to mate. It manages the heard the king to the corner, but then it does not give the final blow.


📝Greg Strong wrote on Sat, Dec 17, 2022 03:58 PM UTC:

There is an evaluation function called LowMaterialEvaluation that does a few things. It will immediately terminate the game if we are down to KNK, KBK, KNNK, and even KBBK if both Bishops are on the same color.

It will return a flat evaluation of zero for KBKB, KBKN, and KNKN but won't terminate the game. It also has a setting called KRKIsDraw that, when set, will return zero if down to KRK (for Cylindrical Chess and Omega Chess), but doesn't terminate the game (although perhaps it should.)

It will also perform specialized evaluation for KRKP, KRKB, and KRKN so that it can win those. And there is a KxK function (where x is Rook or other piece with an endgame value of 500 or more) which returns an evaluation based on how close the losing king is to the corner plus how close the two kings are together.

Basically, it assumes a piece can mate the enemy king if it has an endgame value over 500 and switches to specialized evaluation. If it's not over 500, it will not terminate the game except in those special circumstances dictated by the rules of chess. Perhaps it should for situations like King + Camel vs King. It could decide this if the last piece is colorbound I suppose.

In all other circumstances, the standard game evaluation function applies. So for King+Joker against King, I am not surprised it does not know how to win. Perhaps I should activate KxK evaluation for any x that doesn't promote... And perhaps I should activate it for multiple non-promoting pieces against a lone King. Certainly there is more work to be done here. I have wanted to make a specialized KPK function for a long time. Knowing how to win when down to only a couple of pieces is tricky business in Chess and obviously harder in a universal chess program where your pieces can be anything...

EDIT: There are also a couple of games where I turn off the LowMaterialEvaluation completely because it would not do "the right thing" (for example, Knightmate).


Aurelian Florea wrote on Sat, Dec 17, 2022 04:15 PM UTC in reply to Greg Strong from 03:58 PM:

Can't major or minor be a user defined property of a piece?


Aurelian Florea wrote on Sat, Dec 17, 2022 04:18 PM UTC in reply to Greg Strong from 03:58 PM:

I do not think I have expressed myself well about the joker. The K and J do manage to force the enemy king to the corner, but then it is not doing the obvious checkmating move.


📝Greg Strong wrote on Sat, Dec 17, 2022 04:55 PM UTC in reply to Aurelian Florea from 04:15 PM:

Can't major or minor be a user defined property of a piece?

Sure, it could.  But is that the right thing to do?

Perhaps any non-pawn (or any piece that doesn't promote) should activate the KxK endgame evaluation.  When active, the evaluation is determined 100% by (a) material, (b) how close the weak king is to the corner, and (c) how close the two kings are together.  All other considerations are switched off.  Maybe this should apply for King+Minor vs. King also?  In which case the distinction doesn't matter.

@H. G., any thoughts on this?


H. G. Muller wrote on Sat, Dec 17, 2022 05:48 PM UTC:

Forcing the opponent's last remaining piece into a corner can never hurt. So it should probably be the dominant eval term. Fairy-Max doesn't have true PST; just a centralization bonus, and a weight for each piece type to multiply it. Originally that weight was 0 or 1, configurable by the user. When the King is bared, I now increase it to 10. I don't see any reason to discard other eval terms.

What holds to K-K distance in the bared case should probably hold for all short-range leapers. Removing their centralization drive does not help them seek out the bare King, even though it doesn't obstruct it. In Fairy-Max this was a problem in the KNFFK and KFFFK (Makruk!), where K + two pieces is enough to corner the King (and N + F even enough to trap it there), and then it had no incentive to approach the remaining piece(s), which are needed to execute the checkmate. You would probably see the same in KNNNK, certainly on large boards.

Of course forcing into a corner can backfire if it is the wrong corner (KBNK!). In Fairy-Max I solved this by switching to a centalization bonus that awards driving to another corner once the bare King visits one. The idea is that if there is a mate in the current corner, the search will always be deep enough to see it when the bare King is already trapped there.

With orthodox Kings (and a rectangular board) many pieces can be classified as minors with certainty: if they do not attack two orthogonally adjacent squares. That of course includes color-bounds. But also many more (all elementary obliques, Omega Wizard, Phoenix, Mamluk). Not all pieces that fail this test are majors, though. E.g. Silver or Wildebeest. But is seems a better criterion than piece value; the >500 criterion also gets the Wildebeest, Commoner, Gold and WD wrong. In I once made a Fairy-Max derivative 'Pair-o-Max' where I apply the color-binding and value criterion, but the user can force a piece to be considered a 'weak major'.

Other user-configured end-game properties in Pair-o-Max were 'defective pair' and 'strong defender', which could indicate KxxK or KQKx are draws, respectively.


Aurelian Florea wrote on Sat, Dec 17, 2022 05:59 PM UTC in reply to H. G. Muller from 05:48 PM:

There is also the reverse case where a heavy minor manticore can't mate!


📝Greg Strong wrote on Sun, Dec 18, 2022 12:34 AM UTC in reply to Aurelian Florea from Sat Dec 17 04:18 PM:

I do not think I have expressed myself well about the joker. The K and J do manage to force the enemy king to the corner, but then it is not doing the obvious checkmating move.

Ok, I have done some testing and we were looking in the wrong place.  The reason it does not do the obvious checkmating move is because that move is not checkmate, it is stalemate.  Until that point, the computer thinks it is ahead by one Joker.  It doesn't want to trap the King in the corner with the Joker because that ends the game in a draw.

Per an earlier discussion, the Joker only has movement capabilities when its side is on the move.  When the other side is on the move, the Joker has no movements at all.  So the King in the corner cannot move, because then the Joker would be checking it.  But the King is not actually in check before it moves.  It has no legal move, so it is a stalemate.  I had not considered this situation before.  But, under the current rules, King+Joker vs. King is a draw.


Aurelian Florea wrote on Sun, Dec 18, 2022 06:17 AM UTC in reply to Greg Strong from 12:34 AM:

From what I understand a stalemated king passes nothing to the joker. Am I correct?


H. G. Muller wrote on Sun, Dec 18, 2022 07:06 AM UTC in reply to Aurelian Florea from 06:17 AM:

I don't think this is the most natural interpretation of the Joker. I would opt for rules where the Joker keeps mimicking the previously moved piece after null move (just as it would after opponent Joker move). But that for implementation of the 'castling through check' rule the partial-move interpretation would be used: would the King be capturable if it only performed the move up to that point? The castling issue is not only relevant to the Joker. E.g. with a lame Dababba (nD) on d1, could you play O-O? I would say 'no', because after the King steps to f1, the nD could capture it. But with the King still on e1 the nD cannot capture to f1.

[Edit] Another interpretation could be that the Joker during the opponent turn it always moves as King (or whatever royal you have). A null move cannot be unambiguously assigned to any piece, but for the definition of check we could use the fiction that the royal must make it, in contexts where it matters what piece was moved.

Of course it is still a matter of taste what the Joker imitates after castling. If we consider castling a 3-step move (K+K+R), it would be most natural if it imitated the Rook.


Aurelian Florea wrote on Sun, Dec 18, 2022 10:58 AM UTC in reply to H. G. Muller from 07:06 AM:

I don't think this is the most natural interpretation of the Joker. I would opt for rules where the Joker keeps mimicking the previously moved piece after null move (just as it would after opponent Joker move).

I agree with HG. It makes sense that a joker imitating a king to be a man so KJK is exactly like KMK. 


H. G. Muller wrote on Sun, Dec 18, 2022 11:51 AM UTC in reply to Aurelian Florea from 10:58 AM:

After some more consideration I would prefer the "null move doesn't change imitation" over "null move = King move" rule. Because then it would not matter whether you define check by a second move in the same turn, or as a move after a hypothetical null move. I am afraid the concept of a null move is only natural to engine programmers.


📝Greg Strong wrote on Sun, Dec 18, 2022 01:48 PM UTC in reply to Aurelian Florea from 06:17 AM:

From what I understand a stalemated king passes nothing to the joker. Am I correct?

I'm sorry, I do not understand what you are asking.  When a King is stalemated, the game is over.

I don't think this is the most natural interpretation of the Joker. I would opt for rules where the Joker keeps mimicking the previously moved piece after null move (just as it would after opponent Joker move).

There was a very long discussion about this on talkchess and another discussion here.  The way I've programmed it was the concensus at the time, and for good reasons.  I could change it, but I think you would like the results of that even less.  It would forbid a lot of King moves.  (The problem goes way beyond castling through check.)  A King cannot move to any square that is attacked -- if the Joker still has its previous powers, it is potentially attacking a lot of squares and stopping the King from moving to them, despite the fact that if he did, the Joker would no longer be able to capture him because its powers have changed.  Whether or not the Joker could actually capture the King on the next move is irrelevant.  At the time of the King's move, the Joker either still has its powers or it doesn't.  You can't have it both ways.

After some more consideration I would prefer the "null move doesn't change imitation" over "null move = King move" rule. Because then it would not matter whether you define check by a second move in the same turn, or as a move after a hypothetical null move. I am afraid the concept of a null move is only natural to engine programmers.

The Joker having the powers of the King when the other side is on the move is at least logically consistent.  I don't like it, but then again, I don't like the Joker.  Also, I don't understand why you are mentioning null move.  I'm not sure what that has to do with anything.


Aurelian Florea wrote on Sun, Dec 18, 2022 02:11 PM UTC in reply to Greg Strong from 01:48 PM:

I don't understand the null move usage here either. The way I have made the rules, the joker has a null move only at the beginning of the game!


📝Greg Strong wrote on Sun, Dec 18, 2022 02:54 PM UTC in reply to Aurelian Florea from 02:11 PM:

"null move" is not no moves. A null move is a player passing a turn without moving. This is not legal in Chess, but chess programs do it anyway as a way to cut out part of the search tree.

https://www.chessprogramming.org/Null_Move_Pruning


Aurelian Florea wrote on Sun, Dec 18, 2022 03:02 PM UTC in reply to Greg Strong from 02:54 PM:

Oh, ok!


H. G. Muller wrote on Sun, Dec 18, 2022 03:19 PM UTC in reply to Greg Strong from 01:48 PM:

The FIDE "laws of Chess" define check in terms of being attacked, and 'attack' in terms of pseudo-legal moves of the pieces. This does not allow for the pseudo-legal moves to change over time, and tacitly assigns the same pseudo-legal moves to a piece whether it is its turn to move or not. So it involves the fiction that the checking side can move, even if it is not his turn. To move out of turn you would either have to do two moves in the same turn, or let the opponent pass his turn between the two moves. This is how the null move enters the discussion.

Legality of moves in FIDE in general is completely covered by the rule "it is not legal to expose your King to capture, except for capturing the opponent King". Only castling is special, in that it is additionally declared illegal when the King starts or moves over an attacked square.

'Exposing to capture"is completely unambiguous. And it definitely does not indicate the interpretation you sketch above, where the Joker would "forbid a lot of King moves". The ambiguity is what moving out of check or through check means. Note that Fergus avoided any ambiguity by stating that the Royal Queen in Caïssa Britannia can not pass through a square that it could not legally move to". This also seems the logical way to treat passing through check in the context of castling. (Except perhaps for 3-step castling, where the second step in itself would be illegal because it is not even pseudo-legal, and the phrase would have to replaced by "where it cannot legally teleport to if teleporting was a pseudo-legal King move.) The spirit of the rule is all about the King being shot down during the attempt, like e.p. capture. Like I said, this is not a Joker-specific problem; many other pieces whose pseudo-legal moves depend on context (lame leapers, hoppers) require more precise definition of when castling is allowed.

Being in check at the beginning of your turn (and moving out of it) is yet another matter. Which affects both castling legality, and the stalemate definition.

To apply these definitions to a Joker, it becomes essential to define when exactly the pseudo-legal moves of the Joker change. It cannot be at the start of a turn, as at that point it is not yet decided which piece is going to move, so you cannot know what the new moves are. Declaring it has no moves at that point comes "out of nowhere"; no other piece loses all its moves (for determing whether the opponent would castle out of check) after it finishes is move. It seems much less arbitrary to let it keep its moves until another piece actually starts moving. That would affect whether you consider the side to move to be in check or not. And thereby whether castling is legal, or whether a terminal position is checkmate or stalemate. But nothing else.

 


H. G. Muller wrote on Sun, Dec 18, 2022 03:25 PM UTC in reply to Greg Strong from 02:54 PM:

This is not legal in Chess, but chess programs do it anyway as a way to cut out part of the search tree.

Or to test for check: when passing the turn would get your King captured.


📝Greg Strong wrote on Sun, Dec 18, 2022 05:21 PM UTC in reply to H. G. Muller from 03:19 PM:

Most of this makes sense.  I'm not entirely sure -- the thread on talkchess was so long ago I don't really remember, but people much smarter than I argued the point -- but I don't really care either.  I consider the Joker itself a bad idea, so I don't care exactly how it acts so long as I can implement it without making any significant changes to the architecture of the program itself.  And I think that is doable...  It makes the implemention of the ImmitatorRule a bit more complicated because it needs to track how each side's Jokers move individually, but that shouldn't be a big deal.  I think attack detection should also be ok.

Aurelian, are you in agreement that this is how it should work?  To be clear, let's make sure I understand...  White moves a Queen.  Then black moves a Knight.  It is now white's turn again.  At this instant, for purposes of determining if the white King is in check, black's Joker still moves as a Queen.  White decides to move a Bishop.  At this moment, for purposes of deciding if white's King is in check, black's Joker moves as a Bishop.  If white's King is not in check, it is black's move again.  At this instant, for purposes of determining if black's King is in check, white's Joker moves as a Knight.

with a lame Dababba (nD) on d1, could you play O-O? I would say 'no', because after the King steps to f1, the nD could capture it. But with the King still on e1 the nD cannot capture to f1.

Now this is an interesting question.  I'm inclined to agree ... castling should not be allowed because the lame Dababba could theoretically capture the King as it moves through.  That said, that is probably not how ChessV works at present.  I guess the truly correct way to do it is to move the King to each square in sequence and ask "am I in check" at each step.  But that's expensive.  It would probably be adequate just to lift the King off the board before doing the attack detection on the squares.


H. G. Muller wrote on Sun, Dec 18, 2022 06:37 PM UTC in reply to Greg Strong from 05:21 PM:

White moves a Queen.  Then black moves a Knight.  It is now white's turn again.  At this instant, for purposes of determining if the white King is in check, black's Joker still moves as a Queen.

That seems consistent. If black would have moved his Joker (as a Queen) instead of the Knight, and this Joker would then have delivered a Queen-like check at the end of this move, it seems logical that you could also use it to deliver a discovered check, by unblocking it with the Knight.

It can still be freely chosen whether the Joker would mimic the last-moved piece of the opponent, or the last-moved piece period. The rules could have been such that the black Knight move switches both Jokers to Knights, instead of just the black one. This is just a different kind of imitator.

All this would only be relevant if you aim a Joker at an uncastled King, which would want to castle on that move. It seems unusua that someone would expose his King this way, so the practical difference might be awfully small.


📝Greg Strong wrote on Sun, Dec 18, 2022 07:20 PM UTC in reply to H. G. Muller from 06:37 PM:

It can still be freely chosen whether the Joker would mimic the last-moved piece of the opponent, or the last-moved piece period. The rules could have been such that the black Knight move switches both Jokers to Knights, instead of just the black one. This is just a different kind of imitator.

Hmmm... The second option would be slightly easier to implement because it's closer to how it is currently written.  It also might be easier to understand -- maybe.  But I have no strong opinion either way.


📝Greg Strong wrote on Sun, Dec 18, 2022 07:49 PM UTC in reply to H. G. Muller from 06:37 PM:

Ooo... Something else I didn't consider. Games with Jokers need to amend the FEN format. The FEN will need to store what type(s) are currently being imitated.


H. G. Muller wrote on Sun, Dec 18, 2022 08:21 PM UTC in reply to Greg Strong from 07:49 PM:

Use the e.p. square to indicate the last-moved piece. For true e.p. rights it would be empty, implying a Pawn must be imitated.

This is also simpler when differently colored Jokers always have the same move. Which I think is conceptually simpler anyway. So it would probably the best choice.


25 comments displayed

EarliestEarlier Reverse Order LaterLatest

Permalink to the exact comments currently displayed.