Check out Atomic Chess, our featured variant for November, 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
A Wizard for GAME-Code Generation. A tutorial on using the Play-Test Applet for automating Game Courier presets.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Mon, Nov 6, 2023 10:17 AM UTC in reply to Gerd Degens from 09:41 AM:

I am not sure what you men. You did use the Play-Test Applet to create a rule-checkinf GC preset before, not? So just set up a board for normal chess, alter the King move to plain K to get rid of the castling, and ask for the GAME code.


Gerd Degens wrote on Mon, Nov 6, 2023 12:33 PM UTC in reply to H. G. Muller from 10:17 AM:

Hopefully I have implemented it correctly.

It works, but not always, as the captured pieces show.

[Edit] I have now played a few games where there were no problems.

[Edit, Edit] Now another game with captured pieces. 


💡📝H. G. Muller wrote on Mon, Nov 6, 2023 06:54 PM UTC in reply to Gerd Degens from 12:33 PM:

'Captured pieces' are something that Game Courier shows automatically, but has no effect on the playing of the game. What is shown is not controlled by any user-supplied code; it is just the difference between what is on the board now, and what was there at the start of the game.


🕸Fergus Duniho wrote on Mon, Nov 6, 2023 07:10 PM UTC in reply to H. G. Muller from 06:54 PM:

While captured pieces are shown automatically, this can be controlled in the code if the default manner of handling captured pieces does not fit with the rules of the game.


💡📝H. G. Muller wrote on Tue, Nov 7, 2023 06:41 AM UTC in reply to Fergus Duniho from Mon Nov 6 07:10 PM:

Ah. Anyway, since what is shown does not affect the game, I don't understand what the problem is.


Gerd Degens wrote on Tue, Nov 7, 2023 07:15 AM UTC in reply to H. G. Muller from 06:41 AM:

If I understand correctly, no captured pieces may be displayed (and removed from the board) in Game Courier, as all captured pieces are added to the capturing party (in Conquer, of course).


💡📝H. G. Muller wrote on Tue, Nov 7, 2023 07:44 AM UTC in reply to Gerd Degens from 07:15 AM:

Well, I don't know what is the purpose of displaying the captured pieces; as I said, displaying them has no effect on processing of the game by Game Courier, and in most variants it is mostly redundant information, as what was captured can be deduced from what is still left on the board. So one suspects that it is merely a visual aid to the players and observers to easily see the material balance.

The way GC calculates it (difference between current and initial board population) does not make it perfectly suited for that purpose, though, since pieces can disappear from the board in other ways than capture. In particular, after a promotion it would count the Pawn as 'captured', even if no Pawn was captured at all, and it would no longer show the resulting Queen as captured, even if a Queen had been captured. And it has no provision for indicating a negative difference if the original Queen was still around.

In a game like Conquer a negative material balance will occur quite often. If a visual aid for judging that balance should probably show the difference between the white and black population of the current position, presenting negatives as pieces of the opposit color. According to Fergus it should be possible to overrule the default presentation with GAME code, but I would not know how, and I don't think it would be worth it anyway.


Gerd Degens wrote on Tue, Nov 7, 2023 11:34 AM UTC in reply to H. G. Muller from 07:44 AM:

I understand that, but the following simple situation can't be right:

Instead of 32 pieces, there are now only 31 pieces on the board. That doesn't fit with Conquer.


🕸Fergus Duniho wrote on Tue, Nov 7, 2023 01:07 PM UTC in reply to Gerd Degens from 11:34 AM:

Instead of 32 pieces, there are now only 31 pieces on the board. That doesn't fit with Conquer.

Given the rules of the game, you need code for processing the captured piece after it is captured. When a capture has been made, I think you want to add the captured piece to the origin square of the piece that moved and flip its side. You should do this for both actual moves and potential moves. You would also want to turn off the display of captured pieces with this code in the Pre-Game section:

setsystem capturedpieces false;

💡📝H. G. Muller wrote on Tue, Nov 7, 2023 05:13 PM UTC in reply to Gerd Degens from 11:34 AM:

I understand that, but the following simple situation can't be right:

Indeed, that cannot be right. The code that was appended to the Post-Move sections should have placed a white Pawn on d4 in this case, as 'victim' was not empty (@) here, but a black Pawn.

If you would post a link to the preset, I can try to debug it.


Gerd Degens wrote on Tue, Nov 7, 2023 05:25 PM UTC in reply to Fergus Duniho from 01:07 PM:

I am grateful for the code to turn off the display of captured pieces - I added it and it works.

...I think you want to add the captured piece to the origin square of the piece that moved and flip its side. 

This is exactly the goal of Conquer. Unfortunately, I have no idea what the required code should look like - I'm not a programmer ( you remember: 'That's a part of life. We don't all have the same capabilities or inclinations').

Do you have any idea what the codes might look like? Would be nice if.


Gerd Degens wrote on Tue, Nov 7, 2023 05:43 PM UTC in reply to H. G. Muller from 05:13 PM:
Is this the right link?
https://www.chessvariants.com/play/pbm/play.php?game%3DConquer%26settings%3Dconquer

🕸Fergus Duniho wrote on Tue, Nov 7, 2023 05:44 PM UTC in reply to Gerd Degens from 05:25 PM:

It would look like a simpler form of what Shogi does, as it would move the piece to an already identified space.

if capture:
  set mynewpiece flipcase realname alias $old;
  add #mynewpiece $origin;
endif;

This should work if you're not using aliases:

if capture:
  add $old $origin;
  flip $origin;
endif;

It looks like the code for Shogi omits doing this in the stalemated subroutine, as moving a captured piece off-board does not affect whether the move leaves the King in check. If your game had check in it, you might have to deal with this in the stalemated subroutine. But since you don't have check, maybe putting the piece back on the board will not affect the evaluation of which moves are legal. In that case, it may not be essential to deal with it during the simulation of potential legal moves.


💡📝H. G. Muller wrote on Tue, Nov 7, 2023 09:22 PM UTC in reply to Fergus Duniho from 05:44 PM:

But since you don't have check, maybe putting the piece back on the board will not affect the evaluation of which moves are legal. In that case, it may not be essential to deal with it during the simulation of potential legal moves.

Indeed, this is exactly why it is sufficient to just do this at the very end of Post-Move. The preset was automated through the betza.txt include, not by fairychess.txt, so it needs different code to do that from what you give.

I run into a problem that I don't understand, though. The code I suggested, which Gerd put in the preset, relies on the variable 'victim' to contain the captured piece. But printing it shows it is always equal to @ at the end of Post-Move. Even when I print it directly after the only place in betza.txt where it is set:

  set victim cond != #desti #ori space #desti @; // no self!
print . #ori . , . #desti . , #victim;
print space #desti;

it prints @, both for #victim and space #desti:


d2,d4,@
@
e7,e5,@
@
d4,e5,@
@

But how can space #desti be @ on d4-e5 if the preceding move was e7-e5? I would have expected a Pawn there. The checkbox "Do Not Include Moves in Code" is ticked in this preset, so the Pawn should still be there.


🕸Fergus Duniho wrote on Tue, Nov 7, 2023 10:41 PM UTC in reply to H. G. Muller from 09:22 PM:

it prints @, both for #victim and space #desti:

If space #desti is @, then victim will be set to @ no matter whether #desti and #ori are the same, because the cond statement will evaluate to @ either way.

But how can space #desti be @ on d4-e5 if the preceding move was e7-e5? I would have expected a Pawn there. The checkbox "Do Not Include Moves in Code" is ticked in this preset, so the Pawn should still be there.

Since your automatically generated code runs mainly in the Post-Game section, it works very differently than the code I usually write. I think Conquer would be simple to program in the usual way with the fairychess include file, but maybe it's not as simple for your automatically generated code.


💡📝H. G. Muller wrote on Wed, Nov 8, 2023 06:16 AM UTC in reply to Fergus Duniho from Tue Nov 7 10:41 PM:

It should be fixed now; it had to do with the betza.txt script treating normal capture of a piece that could be e.p. captured also as e.p. capture, which removed the victim before the destination square was examined for its occupant. I now made sure the destination square is never included in the e.p. squares, when e.p. rights are created.

This makes the problem go away, but it would still not 'recruit' an e.p.-captured Pawn (where the destination square is empty). So we need to expand the code appended to the Post-Move sections a bit, by having it start with the line:

set victim cond #imp p #victim;

This makes the victim a pawn (p) for any move with implied side effects. (Which here are only e.p. captures.)


Daniel Zacharias wrote on Thu, Nov 30, 2023 02:42 AM UTC:

Is there a way to make stalemate a win for the stalemated player?


💡📝H. G. Muller wrote on Fri, Dec 1, 2023 02:43 PM UTC in reply to Daniel Zacharias from Thu Nov 30 02:42 AM:

Is there a way to make stalemate a win for the stalemated player?

Currently not. Is this needed? It would not be difficult to add. Unfortunately not in a backward-compatible way that is also logical, as currently the stalemate result is controlled by a GAME-code variable staledraw, shich by default is set to 1, and specifies a draw for any non-zero setting. When set to 0, it makes stalemating a win. I could make it suche that setting it to a negative value makes stalemating a loss.


Daniel Zacharias wrote on Sat, Dec 2, 2023 10:39 PM UTC in reply to H. G. Muller from Fri Dec 1 02:43 PM:

Is this needed?

Not really. I was just looking and thought it should have been there. I don't know of any games that actually use it though.


Kevin Pacey wrote on Sat, Dec 2, 2023 11:22 PM UTC:

The Duke of Rutland's Chess is one CV where stalemating the opponent results in losing the game:

https://www.chessvariants.com/historic.dir/rutland.html

P.S.: It may be an interesting idea for this CVP website for members (and/or editor[s]) to tag games where stalemate is either a win for the player giving it, and/or a loss for the player giving it. Baring an enemy king seems to be always a win if opponent cannot retaliate next move (if not a drawn case like for some chess endgames), and a tag for such might be considered too [edit: Losing Chess is close to being an exception].


HaruN Y wrote on Sun, Dec 3, 2023 12:09 AM UTC in reply to Daniel Zacharias from Sat Dec 2 10:39 PM:

Chaturanga, Misère, Anti-chess, Codrus Game, Take Me Chess, Duck Chess, couchtomato's variants shared in Discord at 14/11/2021 & 23/04/2022 (these 2 might be a mistake tho), Quinquereme Chess, Teutonic Knight's Chess, Mainzer Schach, Ghostarelay, etc.


💡📝H. G. Muller wrote on Sun, Dec 3, 2023 07:29 AM UTC in reply to HaruN Y from 12:09 AM:

I was aware of Duck Chess, but because this needed an alternative search routine in the AI of the Interactive Diagram, I just hardcoded the rule there. And the generated GAME code would not work anyway, as it is a multi-move game. (And it is a 'never happens' case there anyway.)

In the ID the obvious way to specify it would be staleMate=loss. In the GAME code I could make it configurable through staledraw = -1, and make the Play-Test Applet generate that when it was specified in the ID. There would have to be a pull-down menu on that page for configuring the stalenate result then; a checkbox would no longer be enough.

BTW, the only practical consequence of this rule seems to be that some KPK end-games with edge Pawn can now be won. Usually not even the strong side cannot force the weaker opponent to stalemate him, and having stalemate a draw is already enough deterrent for the strong player not to do it. Losing Chess is of course an exception to this, as even a weak player can force a lot because of the mandatory capture.


Bob Greenwade wrote on Mon, Jan 1 06:14 PM UTC:

This page really needs a button or link (somewhere in the last two paragraphs before "Alternative code for handling the mouse") to send to a blank GC preset page in a new window.


Kevin Pacey wrote on Mon, Jan 1 07:12 PM UTC in reply to Bob Greenwade from 06:14 PM:

I have wondered if a blank GC preset page (or Settings File) exists or can be created (page not being quite the right word for it, though I don't know what is, other than just calling it a preset, period). Except for the first one ever made, after Fergus made Game Courier, when there were zero presets. I have always just altered a preset made by someone, including myself, to begin making a preset for a CV of mine.


Bob Greenwade wrote on Mon, Jan 1 07:36 PM UTC in reply to Kevin Pacey from 07:12 PM:

That's probably the easiest route currently. But if a blank one isn't possible, maybe the link can go to a preset for orthodox chess.


25 comments displayed

EarliestEarlier Reverse Order LaterLatest

Permalink to the exact comments currently displayed.