Check out Makruk (Thai Chess), our featured variant for March, 2025.


[ 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
Play-test applet for chess variants. Applet you can play your own variant against.[All Comments] [Add Comment or Rating]
Carlos Cetina wrote on Thu, Oct 27, 2022 03:49 PM UTC:

It seems you have removed the lines, and the error has now disappeared. What are BBB, WWW and BWBWBW supposed to be anyway? They did not seem to be defined anywhere; their only occurrence was in those two functions.

 

I copied and pasted those lines from the following paragraph taken from A Wizard for Game-Code Generation:

Another example where this technique can be useful is the Bishop Conversion Rule. This rule specifies Bishops can move on their initial move as either a Bishop or Wazir, but the two Bishops cannot start in the same way. One way to implement that is by having separate definitions of a Bishop, a Wazir and their compound in the legdefs table, and let the Bishop function dynamically decide for virgin Bishops which of the definitions to use. You would need an extra variable for each player to remember whether one of the possibilities has already been used up by the other Bishop, and if so, which one. If nothing has been done yet, a virgin Bishop moves like the compound. But if a Wazir move was done, it should move like a Bishop, and vice versa. Non-virgin Bishops would always move like a Bishop.

// in the Pre-Game section:
set many wstart 0 bstart 0; // indicate no Bishop has moved yet
// in the Post-Move sections, after the gosub HandleMove
if == B #mover and not flag #ori:                // a virgin Bishop moved
set wstart cond checkleap #ori #desti 0 1 1 2; // 1 = as Wazir, 2 = as Bishop
endif;

That is for the Post-Move 1 section (white moves); in Post-Move 2 you would use b and bstart instead of B and wstart. The 'flag' on a square tells you whether the piece on there has moved before, moverori and desti are the label for the piece that moved, the origin square and the destination square, respectively, all left by HandleMove. You can then change functions B and b in the Pre-Game code to

def B cond #0 (cond flag var ori BBB cond == 1 var wstart BBB cond var wstart WWW BWBWBW) 0;

and a similar function for black, where BBBWWW and BWBWBW are the index of the Bishop, Wazir and BW compound moves in legdefs. The expression between parentheses would return BBB when the flag on the square of origin was set (meaning this Bishop had moved before, so that it should keep moving as a Bishop), or when wstart=1 (meaning the other Bishop has already started as a Wazir). Otherwise, when wstart=0 it returns the index for the moves of the compound (as this then is the first Bishop we move in this game), and if none of that is the case, it moves like a Wazir (as the other Bishop must have started as a Bishop, wstart=2).

 

 

 


💡📝H. G. Muller wrote on Thu, Oct 27, 2022 03:53 PM UTC in reply to Carlos Cetina from 03:32 PM:

Sure, I understood that these were lines not generated by the applet in an attempt to implement Bishop Conversion. But when BBB, WWW and BWBWBW are not defined, it will return an undefined value. Which is going to give trouble if it is used as an index in the legdefs array.

I see no 'set WWW ...' in the PreGame code anywhere. And I also don't see what it would have to be set too, because there isn't any pure Bishop definition in the legdefs array at all.

[Edit] Well, they would not have to be set to anything; that would only have effect when they were used in the function as #WWW etc. They should just be replaced by the appropriate number. Perhaps you could use use the current legdef table, because it does contain the moves of the BW compound with the W moves only as initial moves. So it could also be used for a non-virgin Bishop. So BBB and BWBWBW should both be 104. And the Wazir moves come at the end of that, so a pure Wazir can be obtained by just using the 4 last moves of the compound, which start 20 places later. So WWW should be replaced by 124.

In the context of Cetina Random Chess there still is a problem, though (from which the Diagram I made also suffers): it always applies the conversion rule, also when the shuffling puts the Bishops on different shades to begin with. It would then still insist one of those started as a Wazir. So it would be necessary to detect whether the Bishops ended on equal or different shade by the shuffling.

 

[Edit2] OK, I found a solution to the shuffle problem. At the end of the PreGame section, add the code

set b1 findpiece B first spaces;
set b2 findpiece B last spaces;
if & 1 - file b1 file b2:
  setflag #b1;
  setflag #b2;
endif;
set b1 findpiece b first spaces;
set b2 findpiece b last spaces;
if & 1 - file b1 file b2:
  setflag #b1;
  setflag #b2;
endif;

This will mark both Bishops as non-virgin in the starting position when their distance is an odd number of squares (i.e. when they are already on different shades). And non-virgin Bishops can never use the Wazir move.


Carlos Cetina wrote on Thu, Oct 27, 2022 06:52 PM UTC:

OK, I found a solution to the shuffle problem. At the end of the PreGame section, add the code

set b1 findpiece B first spaces;
set b2 findpiece B last spaces;
if & 1 - file b1 file b2:
  setflag #b1;
  setflag #b2;
endif;
set b1 findpiece b first spaces;
set b2 findpiece b last spaces;
if & 1 - file b1 file b2:
  setflag #b1;
  setflag #b2;
endif;

This will mark both Bishops as non-virgin in the starting position when their distance is an odd number of squares (i.e. when they are already on different shades). And non-virgin Bishops can never use the Wazir move.

 

Something is still wrong since after adding that code I get a blank page saying only

Please report any bugs or errors to H.G. Muller

I am doing the tests with two settings names:

asymmetric-enforced  does not have the code you pointed out added.

Asymmetric-Enforced does have added the code.

Both have functions B, b defined as

def B cond #0 104 0;

def b cond #0 104 0;

What are we going to do with the following lines?

def B cond #0 (cond flag var ori BBB cond == 1 var wstart BBB cond var wstart WWW BWBWBW) 0;

def b cond #0 (cond flag var ori BBB cond == 1 var bstart BBB cond var bstart WWW BWBWBW) 0;

Will we not use them?

 


💡📝H. G. Muller wrote on Thu, Oct 27, 2022 07:57 PM UTC in reply to Carlos Cetina from 06:52 PM:

Well the error is not a proper error page; there is no link to go to the editor for debugging the preset. It seems that the GAME-code interpreter chokes on the word first in the findpiece command. This can be a problem caused by the server switch; perhaps Fergus can look into it?

 

What are we going to do with the following lines?

def B cond #0 (cond flag var ori BBB cond == 1 var wstart BBB cond var wstart WWW BWBWBW) 0;

def b cond #0 (cond flag var ori BBB cond == 1 var bstart BBB cond var bstart WWW BWBWBW) 0;

Will we not use them?

We must certainly use them. But you should replace the BBB, WWW and BWBWBW by 104 and 124, (the index of the definitions of Bishop and Wazir in legdefs) as was originally instructed.


Carlos Cetina wrote on Fri, Oct 28, 2022 02:08 AM UTC:

Okay. I have changed, in the two presets that I am using for testings, the definitions of B and b according to your instructions, being like this:

def B cond #0 (cond flag var ori 104 cond == 1 var wstart 104 cond var wstart 124 104) 0;

def b cond #0 (cond flag var ori 104 cond == 1 var bstart 104 cond var bstart 124 104) 0;

I repeat the links to the mentioned presets:

asymmetric-enforced does not have the code you pointed out added; it isn't broken but the conversion rule is not fully fulfilled.

Asymmetric-Enforced does have added the code but it's broken.

I wish Fergus could take a look at this matter.


🕸Fergus Duniho wrote on Fri, Oct 28, 2022 04:21 PM UTC in reply to Carlos Cetina from 02:08 AM:

I wish Fergus could take a look at this matter.

I will leave matters concerning H. G.'s automatically generated code to him unless he has an issue he needs my help with. I am not versed in the kind of code that is generated. What I will mainly help with is people who are programming in the GAME Code language on their own without the use of automatically generated code.


💡📝H. G. Muller wrote on Fri, Oct 28, 2022 04:29 PM UTC in reply to Fergus Duniho from 04:21 PM:

I will leave matters concerning H. G.'s automatically generated code to him unless he has an issue he needs my help with. I am not versed in the kind of code that is generated. What I will mainly help with is people who are programming in the GAME Code language on their own without the use of automatically generated code.

The point is that you have broken the GAME-code interpreter, so that it hangs (without producing a proper error page) on a program that contains nothing other than the statement

set b1 findpiece B first spaces;

We would appreciate it if you at least took the responsability to see to it that GAME code functions work as advertized...


Mirko Mirko wrote on Fri, Oct 28, 2022 09:03 PM UTC:

Is possibile to add a commando into the code for randomize the pieces of every board like chess960?


🕸Fergus Duniho wrote on Fri, Oct 28, 2022 11:41 PM UTC in reply to H. G. Muller from 04:29 PM:

The point is that you have broken the GAME-code interpreter, so that it hangs (without producing a proper error page) on a program that contains nothing other than the statement

set b1 findpiece B first spaces;

This is the first time this has been brought to my attention, and I have now fixed it. I also fixed the problem with just entering "set b1 findpiece B".

We would appreciate it if you at least took the responsability to see to it that GAME code functions work as advertized...

I do that regularly, but I do require that bugs be clearly brought to my attention. I skim or skip over many comments that are not directed at me.


Carlos Cetina wrote on Sat, Oct 29, 2022 03:43 AM UTC:

Now that the Asymmetric-Enforced preset is accessible, it seems that the added code 

set b1 findpiece B first spaces;
set b2 findpiece B last spaces;
if & 1 - file b1 file b2:
  setflag #b1;
  setflag #b2;
endif;
set b1 findpiece b first spaces;
set b2 findpiece b last spaces;
if & 1 - file b1 file b2:
  setflag #b1;
  setflag #b2;
endif;

is not having an effect since the conversion rule is not fulfilled. I await further instructions.


💡📝H. G. Muller wrote on Sat, Oct 29, 2022 06:39 AM UTC in reply to Carlos Cetina from 03:43 AM:

 

Ah, I see that I forgot the # that GAME code requires to access variables in a few places. The extra Pre-Game code should really be:

set b1 findpiece B first spaces;
set b2 findpiece B last spaces;
if & 1 - file #b1 file #b2:
  setflag #b1;
  setflag #b2;
endif;
set b1 findpiece b first spaces;
set b2 findpiece b last spaces;
if & 1 - file #b1 file #b2:
  setflag #b1;
  setflag #b2;
endif;

This does fix the case where the Bishops already start on different shade, by setting them non-virgin so that their Wazir moves are suppressed.

But I was a bit too optimistic about the other case: it does hurt that you did not define a 'pure' Bishop amongst the piece types. Because when the Bishops are on the same shade, and you move the first one as a Wazir, the second one must be forced to move as a Bishop. But it is still virgin, so the move definition of the combi piece cannot be used for it. (It can be used as the definition of a pure Wazir, because it has the W moves after the B moves, so that you can give 124 as start index of the move list instead of 104 to skip the B moves.)

From the point we are now I guess the easiest way is to add the pure Bishop  to the list by hand, making the end of the legdefs array look like

2 99 -1  1     1
  99 -1  0   32771
0
1 99  1  1     3 // pure bishop(598)
1 99  1 -1     3
1 99 -1 -1     3
1 99 -1  1     3
0);

(5 lines inserted). The B and b functions then should refer to this pure Bishop when it needs one:

def B cond #0 (cond flag var ori 598 cond == 1 var wstart 598 cond var wstart 124 104) 0;
def b cond #0 (cond flag var ori 598 cond == 1 var bstart 598 cond var bstart 124 104) 0;

This then seems to do it.

💡📝H. G. Muller wrote on Sat, Oct 29, 2022 06:47 AM UTC in reply to Mirko Mirko from Fri Oct 28 09:03 PM:

Mirko Mirko wrote on 2022-10-28 UTC

Is possibile to add a commando into the code for randomize the pieces of every board like chess960?

Yes, this is what the shuffle parameter does. For Chess960 you would say shuffle=KQR!BN , where the ! in front of the B indicates that the shuffle should keep the Bishops on different shade. All pieces mentioned in the shuffle parameter will be randomly placed in the set of squares they originally occupied. More complex restrictions of the shuffle can often be implemented by specifying several shuffles in a row (separated by a comma). For a complete explanation see the article on Interactive Diagrams, section 'Shuffle Games'.


Carlos Cetina wrote on Sat, Oct 29, 2022 08:37 AM UTC:

I think I made the adjustments you indicated correctly, however something must be wrong since the bishops lost the W option when they start on squares of the same color. It strangely happens that after moving one of them, the other can no longer be moved at all.


💡📝H. G. Muller wrote on Sat, Oct 29, 2022 09:08 AM UTC in reply to Carlos Cetina from 08:37 AM:

OK, I discovered the same. The highlighting is broken. The problem is that in the method I programmed the virginity of the Bishop is determined from the origin square (var ori). That is correct for checking the legality of the move. But not when highlighting, because possible moves for white are highlighted after the black move is made. And at that time var ori holds the origin of the black move. So instead of testing the virginity of the white Bishop it highlights the moves of, it tests whether the last-moved opponent piece was virgin! (Of course this sometimes does give the correct result, when that previously moved piece happens to have the same virginity as the Bishop.)

I now made a tiny change in the included betza.txt file to make the origin square of the piece for which moves are generated already available to the B and b functions as var ss. The two functions can then use that instead of var ori, by changing those to:

def B cond #0 (cond flag var ss 598 cond == 1 var wstart 598 cond var wstart 124 104) 0;
def b cond #0 (cond flag var ss 598 cond == 1 var bstart 598 cond var bstart 124 104) 0;

 


Mirko Mirko wrote on Sat, Oct 29, 2022 01:42 PM UTC in reply to H. G. Muller from 06:47 AM:

Thank you :)


Carlos Cetina wrote on Sat, Oct 29, 2022 01:45 PM UTC:

Problem solved. Thank you so much for everything. Thanks also to Fergus for his collaboration. In practice I will use the preset under the name Cetran Chess 1 as it is the first step in a series of variants conceived according to the basic idea of increasing the complexity of the game each time.


Mirko Mirko wrote on Wed, Nov 2, 2022 01:28 PM UTC:

Is possibile to add the classic pawn promotion on the last rank for the shogi pawn piece? I try to set a Q promotion with us but seems doesn't work...


Mirko Mirko wrote on Mon, Nov 7, 2022 02:02 PM UTC:

I noticed that the play-test applet drag & drop table in mobile devices support the placement of only the first 7 pieces in the index (the first 6 pawn and 1 knight)

Exept in the manual setup via html edit.


Mirko Mirko wrote on Sat, May 27, 2023 12:56 PM UTC:

@H.G. Muller Hi, I notice a mistake: in a mobile Browser is not possible to create holes on the chess board whit the specific commando.


💡📝H. G. Muller wrote on Sun, May 28, 2023 01:47 PM UTC:

It is not only failing to make holes on mobile browsers, but it also doesn't work on my PC. It appears the change I made in the general script to allow triple capture of the Lion Dog in the large Shogi variants collides with the way I implemented the creation of holes on the applet page. (With as a consequence that it tries to interpret the dropping of a hole as a triple capture for which it has to generate a move, which then unfortunately involves off-board squares that make it crash.)

I tried to fix it, but it seems any editing I do of this page destroys the operation of the applet: a lot of pieces, including the Kings, suddenly disappear from the selection list. So I reinstated the old version now. So that at least the applet should work as before, albeit still without the possibility to create holes. I will think on whether I can solve this hole-creation problem in the general script for interactive diagrams, without editing the applet page.


💡📝H. G. Muller wrote on Mon, May 29, 2023 08:26 AM UTC in reply to Mirko Mirko from Sat May 27 12:56 PM:

@H.G. Muller Hi, I notice a mistake: in a mobile Browser is not possible to create holes on the chess board whit the specific commando.

This is a bit difficult to fix on the short term, because the applet page cannot be edited without destroying it, and the general Diagram script it uses is cached on CloudFlare so that it cannot see any changes that are made in that. I put an improved version of the general script on the CVP website, which I expect to fix the problem, but we would have to wait until that appears in the CloudFlare cache so that it will actually be used.

In the mean time, when you want a Diagram with holes, you can just edit those into the Diagram description when you post that elsewhere; just add a line

hole::::e4,e5,d4,d5

before the line that defines the Pawn if you want holes on e4, e5, d4 and d5, etc.


Mirko Mirko wrote on Tue, May 30, 2023 09:37 AM UTC in reply to H. G. Muller from Mon May 29 08:26 AM:

Ok, no problem :)


adella wrote on Wed, May 31, 2023 05:07 PM UTC in reply to H. G. Muller from Sun May 28 01:47 PM:

Dear respected h.g.muller, how to express a non-crossing-pawns elephant? we know "A " indicates the elephant that can reach pieces behind pawns. but how to express the same track, but not able to cross pawns? Thanks so much. sincerely yours adella.


adella hardy wrote on Wed, May 31, 2023 06:10 PM UTC in reply to H. G. Muller from Mon May 29 08:26 AM:

Dear respected h.g.muller, how to express a non-crossing-pawns elephant? we

know "A " indicates the elephant that can reach pieces behind pawns. but how to express the same track, but not able to cross pawns? Thanks so much. sincerely yours adella.


💡📝H. G. Muller wrote on Wed, May 31, 2023 07:33 PM UTC in reply to adella hardy from 06:10 PM:

A non-jumping move to the second square diagonally would be nA.


25 comments displayed

EarliestEarlier Reverse Order LaterLatest

Permalink to the exact comments currently displayed.