Check out Grant Acedrex, our featured variant for April, 2024.


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

Comments/Ratings for a Single Item

LatestLater Reverse Order EarlierEarliest
@ Gerd Degens[All Comments] [Add Comment or Rating]
Gerd Degens wrote on Thu, Feb 29 01:44 PM UTC in reply to H. G. Muller from 11:53 AM:

I don't understand anything at the moment.

HTML according to 'custom sets (only needed for non-standard piece set)' which shows the old PTA under GAME code okay. But what does this HTML sequence have to do with the Pieces section of my description of the variant? Does it fit together? When I enter the HTML sequence in the pieces section and save it, the output only shows the HTML sequence.

I must have misunderstood this completely, right?


H. G. Muller wrote on Thu, Feb 29 11:53 AM UTC in reply to Gerd Degens from 09:25 AM:

This is not code; it is HTML text for pasting in the Pieces section of your article about the variant, if you want to present that as an auto-generated table (e.g. such as I used for Makromachy.)

For defining a custom piece set you need what the (old) PTA prints in the section "Custom sets (only needed with non-standard piece set):" after you press the GAME code button. Something like this:

{
"custom": {
  "dir": "/graphics.dir/alfaeriePNG35/",
  "pieces": {
    "P": "wpawn.png", "p": "bpawn.png",
    "N": "wknight.png", "n": "bknight.png",
    "B": "wbishop.png", "b": "bbishop.png",
    "R": "wrook.png", "r": "brook.png",
    "Q": "wqueen.png", "q": "bqueen.png",
    "K": "wking.png", "k": "bking.png"
  }
}
}

 


Gerd Degens wrote on Thu, Feb 29 09:25 AM UTC in reply to H. G. Muller from Wed Feb 28 09:45 PM:

When a Diagram is pasted in the (old) PTA, and you generate GAME code from it, piece types that are not on the board won't be mentioned in the custom set that is generated.

If I see it correctly, this seems to be the case. Here is an excerpt of the generated code, which concerns the part of the pieces that are not on the board (royal pieces - markings in the text are mine):

<tr><td width="35"><img src="/graphics.dir/alfaeriePNG/wking.png"></td><td>royal pawn</td><td>slides orthogonally, slides to the 2nd square straight ahead for capturing only, or steps one square straight ahead</td></tr>
<tr><td width="35"><img src="/graphics.dir/alfaeriePNG/wking.png"></td><td>royal amazon</td><td>slides in all 8 directions, slides in all 8 directions, or makes a knight's jump</td></tr>
<tr><td width="35"><img src="/graphics.dir/alfaeriePNG/wking.png"></td><td>royal chancellor</td><td>steps one square in all 8 directions, castles by stepping 2 squares towards the king (fast castle), makes a knight's jump, or slides orthogonally</td></tr>
<tr><td width="35"><img src="/graphics.dir/alfaeriePNG/wking.png"></td><td>royal archbishop</td><td>steps one square in all 8 directions, castles by stepping 6 squares towards the king (fast castle), makes a knight's jump, or slides diagonally</td></tr>


Gerd Degens wrote on Thu, Feb 29 08:37 AM UTC in reply to H. G. Muller from Wed Feb 28 09:45 PM:

The suggested lines [set wroyal (K J L M O);
set broyal (k j l m o);] I have tried several times before - and just now again. The following happens: as soon as a white piece is clicked, the game stops immediately and the message 'White lost by absence of royalty!' appears.

It appears I have now solved this.

I have just tested this with the following result:
When the king enters the morph zone, the previous error message 'White lost by absence of royalty!' no longer appears. Instead, the king is shown in the table of captured pieces, which was the case before. The game can be continued, whereby the new king appears to be recognized as such and the king also receives the upgraded or downgraded move options. The only strange thing is that whenever the new king comes into check, this is not shown as a 'check'. The move options displayed for the new king also include those that put him back in check, which should not actually happen. If he makes such a move, an error message 'GameEnd This exposes your royal piece to capture' appears. Moves that free the king from check are possible.


Gerd Degens wrote on Thu, Feb 29 08:32 AM UTC in reply to H. G. Muller from 08:19 AM:

Did you move the King to a5 through an illegal move? 

Yes, I did. To test it, I moved the king from e1 to a5. I understood that it can't work like that.


H. G. Muller wrote on Thu, Feb 29 08:19 AM UTC in reply to Gerd Degens from 07:28 AM:

I just wonder how it can be that the game ends with 'I win' when a king on a5 is captured with a move from a9.

I am not sure what exactly you tried here, in particular, what you mean by 'king'. It should not be possible to have a King on a5; it should have morphed to a Royal Pawn when it got there.

Did you move the King to a5 through an illegal move? The I.D. allows you to play illegal moves, (if these are non-captures), but these are considered part of a position setup, and would never be subjected to promotion rules. They just move a piece from one square to another. So if you play Ke1-a5, it would not morph into a Royal Pawn, and stay a King. (But due to your choice of images, you cannot see that!) As a consequence you have not lost yet, and if it can the AI would capture your King and claim the win.

If I play, from the start position, Ke1-a4, switch on the AI, and then play Ka4-a5, it does claim the win. (A bit strange here is that the King appears to promote to an enemy non-royal piece; I still have to figure out what causes that.)


H. G. Muller wrote on Thu, Feb 29 07:54 AM UTC in reply to Fergus Duniho from 03:07 AM:

@Fergus: OK, so it is what I thought. But it only contains values for pieces that are present; labels of pieces that are not on the board do not get value 0 associated. This makes it tricky to use.

What is the best way to test whether an associative array contains a given key? In JavaScript I would just copy array[key] to a variable, and then test if that variable is undefined.

But testing for an undefined value seems to be difficult in GAME code. In seems that variables to which you assign an undefined value disappear, and that #name for nonexisting variables evaluates to the string literal "#name". Is this guaranteed behavior? I.e., would it make sense to write

if != #name "#name":

to only process a variable when it does exist / was not assigned an undefined value?

Or can the problem be avoided by reading the value of the variable using var rather than #? Is there any guaranteed behavior for using var on a non-existing / undefined variable?

If not, it seems to be useful to have an operator (let's call it number) that would evaluate to the numerical value of its operand, but to zero if the operand was not numeric, or undefined. So that I could write something like number elem #key piececount, which would give me the expected 0 if #key was not a valid key in the piececount table.


Gerd Degens wrote on Thu, Feb 29 07:28 AM UTC in reply to H. G. Muller from Wed Feb 28 09:45 PM:

As should be expected, as otherwise only the last piece in the table is royal.

You are certainly right, in the piece table only the king is marked as the last in the table with 'c00'.

I just wonder how it can be that the game ends with 'I win' when a king on a5 is captured with a move from a9. Consequently, the king on a5 must have been recognized as royal. The same applies to any other square in the morph zone.
 


🕸Fergus Duniho wrote on Thu, Feb 29 03:07 AM UTC in reply to H. G. Muller from Wed Feb 28 07:30 PM:
                    case "piececount":
                        $temp = array();
                        foreach ($space as $p) {
                            if (($p != "@") && ($p != "-"))
                                $temp[$p] = isset($temp[$p]) ? $temp[$p] + 1 : 1;
                        }
                        array_push ($output,  $temp);
                        break;

H. G. Muller wrote on Wed, Feb 28 09:45 PM UTC in reply to Gerd Degens from 02:26 PM:

That seems to be the case, because the I.D. works as intended.

Not when I tried it. When I morph my King the AI claims victory. It really needs a royal=... specification. As should be expected, as otherwise only the last piece in the table is royal. When you look at the piece table and click the header of the 'move' column, the royal pieces should have '(c00)' behind their piece value, and J,L,M,O do not have that.

The suggested lines [set wroyal (K J L M O);
set broyal (k j l m o);] I have tried several times before - and just now again. The following happens: as soon as a white piece is clicked, the game stops immediately and the message 'White lost by absence of royalty!' appears.

It appears I have now solved this.

The matter with the custom set is new to me - I'll have a look at it. Many thanks in the meantime.

There is a problem here: When a Diagram is pasted in the (old) PTA, and you generate GAME code from it, piece types that are not on the board won't be mentioned in the custom set that is generated. I won't manage to fix that today. But it is not very difficult to fix it directly in the preset: just copy the suggested code, and then duplicate the line that defines the Kings 4 times, altering the K/k in these copies into J/j, L/l, M/m and O/o respectively. Then all these labels should get a King image. (Well, beware of commas. Each line should end in a comma, except the last!)


H. G. Muller wrote on Wed, Feb 28 07:30 PM UTC in reply to Gerd Degens from 03:57 PM:

@Fergus: I ran into something strange. The include file for automation with the PTA uses an identifier piececount, like it is an associative array that tells for each piece label how many there are on the board. It is used like

set nr + #nr elem #type piececount;

I cannot find a desciption of it in the GAME-code tutorial, though. Did it ever exist, and is it deprecated? Or has it been a figment of my imagination all the time? I cannot print it either; printr piececount; just prints the word 'piececount'.

The strange thing is that elem #type piececount evaluates to 1 if type has the value K or k. (Which is usually the only value it gets, as it is in a loop that has the purpose of counting the number of royals left, and K is usually the only royal type.) I would not expect that from an undefined variable, and indeed there is one King on the board. If type has the value of a piece label that is not on the board, the value does seem undefined. And apparently 1 + undefined equals 0, which is also strange. But nr ends at 0 because of this, leading to a win claim...

[Edit] For piece types that are on the board, piececount indeed appears to work as one should guess from the name. But for piece types not on the board elem #type piececount appears to evaluate to something strange, rather than 0. I now assigned it to a variable a, and print #a then produces output '#a'. Now I have seen this before for undefined variables, so I expected if not #a: set a 0; endif; to solve the problem, assuming 'undefined' would be interpreted as false. (Or is this a JavaScript expectation?) But not so; the if-statement does not trigger, and adding the undefined variable to a variable nr that already has a non-zero value appears to reset it to 0.

[Edit2] It does work as intended when I do this:

    set a elem #type piececount;
    set b 0;
    if var a:
      set b var a;
    endif;
    set nr + #nr #b;             // count them

Using #a instead of var a it just keeps interpreting that as a literal. Can this be simplified to set nr + #nr var a; ? I am afraid to try it, because I already spoiled one GC game by experimenting...


Gerd Degens wrote on Wed, Feb 28 03:57 PM UTC in reply to H. G. Muller from 01:45 PM:

@H.G.

Select a Set Group 'Custom', and then a Set 'Completely Custom' in the preset Edit page, and paste the text the PTA suggests for this section.

I have tried it, both with the old PTA (.../MSplay-test-applet-for-chess-variants) and with the new PTA (.../playtest.html). 

The result is the same in both cases and the error message appears 'Your Custom Set description failed to decode properly. Make sure it has no errors in it'. 

A very nice feature and would help a lot.


Gerd Degens wrote on Wed, Feb 28 02:26 PM UTC in reply to Gerd Degens from 02:15 PM:

So the I.D. doesn't understand these morphed Kings are royal, and as a consequence also has not passed that info to the GAME code.

That seems to be the case, because the I.D. works as intended. I.e. the morphed kings are recognized, they get new moves (pawn, archbishop, chancellor, amazon) and the game is over when they are captured. So in the I.D. everything works as expected.
 


Gerd Degens wrote on Wed, Feb 28 02:15 PM UTC in reply to H. G. Muller from 01:45 PM:

The suggested lines [set wroyal (K J L M O);
set broyal (k j l m o);] I have tried several times before - and just now again. The following happens: as soon as a white piece is clicked, the game stops immediately and the message 'White lost by absence of royalty!' appears.

The matter with the custom set is new to me - I'll have a look at it. Many thanks in the meantime.


H. G. Muller wrote on Wed, Feb 28 01:45 PM UTC in reply to Gerd Degens from 11:11 AM:

I see one problem, which is probably not what is bugging you, and perhaps somewhat my fult. The I.D. defines separate pieces for the King to morph in (good), but these are not marked as royal. There should have been a line royal=KJLMO in the description, but it turns out the new PTA is not so finished yet as I thought, and that the text entry for defining royal pieces is still ignored. (That is what you get if you take a long pause in developing something...)

So the I.D. doesn't understand these morphed Kings are royal, and as a consequence also has not passed that info to the GAME code. This could be fixed directly in the GAME code by adding lines in the Pre-Game section

set wroyal (K J L M O);
set broyal (k j l m o);

About the label-image assignment: you should be able to use a custom set that uses exactly the limages that you want for the labels of your choice. Select a Set Group 'Custom', and then a Set 'Completely Custom' in the preset Edit page, and paste the text the PTA suggests for this section. (Oh, problem: the new PTA does not suggest this yet, as it is a feature that was only introduced after I made that. But you can use the old PTA to generate that, and only use the custom-set output from it.)


Gerd Degens wrote on Wed, Feb 28 11:11 AM UTC:

@H.G.

I have been trying for days to transfer a working interactive diagram to Game Courier - without success.
I have transferred the HTML code of the interactive diagram to the PTA via editor (including the IDs of the royal pieces) and then transferred the GAME code to the preset for Game Courier. It does not work. (Interactive diagram see here, preset see here.)

Another problem I see is that the piece labels/IDs used in the PTA are only partially compatible with the piece labels/IDs in the Diagram Designer for Game Courier. For some pieces this can be adjusted (archbishop, chancellor, amazon). But the royal pieces needed for my idea can apparently not be realized with the options of the Diagram Designer (each piece has a unique label). At least that is what I know. Can't get any further without help.


Gerd Degens wrote on Mon, Feb 26 08:24 PM UTC in reply to H. G. Muller from 05:27 PM:

Apparently I was able to get the PTA running. The upgrade of the pawns does not seem to work with the GAME code. I had to make some adjustments here, i.e. I added the missing IDs for the pawn to the 'set morphers' (P p ...........). For 'set morphs assoc' I added the missing P (0 0 0 0 (P P A C Z C A P P)) and p (0 0 0 0 (p p a c z c a p p)).

Furthermore, when converting the HTML code into the GAME code, the upgrading or downgrading of the king does not work, which works with the PTA. The royal figure is not accessed, but the non-royal figure appears with the result of 'White lost by absence of royalty!

Click here for the PTA and here for the preset.

Sorry if I'm making work, but maybe it's not just me.


H. G. Muller wrote on Mon, Feb 26 05:27 PM UTC in reply to Gerd Degens from 04:42 PM:

Well, just make a Diagram with twice as many pieces, making sure that the piece you want to use as royals have different IDs from the non-royals. (Game Courier does not like it if pieces have the same ID.) In the new PTA you can specify the royals (through "Specify more rules"). Then make sure the King morphs into the royal pieces.


Gerd Degens wrote on Mon, Feb 26 04:42 PM UTC in reply to H. G. Muller from 02:05 PM:

This works very well with the newer version of the PTA when converted to Game Courier. Many thanks for that.

To make it work as you described, you should define a royal and a non-royal version of each piece type, and let the King morph to the royal types.

That sounds very plausible - but how should I do that? I'm currently at a loss, so please give me a brief explanation. Thank you.


H. G. Muller wrote on Mon, Feb 26 02:05 PM UTC in reply to Gerd Degens from 01:14 PM:

Well, the way you implemented it in the Diagram would morph the King to a non-royal piece, which it would consider a loss. To make it work as you described, you should define a royal and a non-royal version of each piece type, and let the King morph to the royal types.

I see that the regular PTA is not able to convert the morph parameters to GAME code. (I suppose originally this made sense, as there is also no way to specify morphs when you set up the variant.) You tried to use promotion to get the same effect, but the GAME code cannot specify promotion choice per square, just per entire rank. What you did would allow all pieces to choose to what they promote to, on each square of 5th rank (including promotion to enemy pieces!).

Fortunately the newer version of the PTA is nearly finished, and it can translate the morphs to GAME code.


Gerd Degens wrote on Mon, Feb 26 01:14 PM UTC:

@H.G.

Could you please take a look at my new idea, which you can find here.
I was able to implement it for the PTA, but I'm stuck with the preset for Game Courier.
I would be glad for help.


Gerd Degens wrote on Tue, Feb 20 02:29 PM UTC in reply to H. G. Muller from 02:18 PM:

I'm actually quite happy that the pieces' values are now close to each other. It doesn't seem to be that easy with sliding pieces, at least I think so.


H. G. Muller wrote on Tue, Feb 20 02:18 PM UTC in reply to Gerd Degens from 12:52 PM:

The values it guestimates are now pretty close to each other. Is there a reason why you don't use a single sliding move?


Gerd Degens wrote on Tue, Feb 20 12:52 PM UTC in reply to H. G. Muller from 12:29 PM:

Thank you very much. Could you take another look at the game where I changed the moves for the knight and bishop again.

AI now seems to be selectively accessing opportunities when it comes to promotions. Can you live with that?


H. G. Muller wrote on Tue, Feb 20 12:29 PM UTC in reply to Gerd Degens from 11:02 AM:

OK, it is fixed. There was a statement that suppressed the promotion popup on the first move of any game.

The reason for this was that the Post-Game code is already called before any moves are done, because it also is responsible for calculating the highlighting for the next move. But it is also responsible for the promotion popup, and as a part of that it tested whether the destination of the latest move was in the promotion zone. This would lead to an error screen if that destination did not exist. So I suppressed it in move 0.

There is some unexpected behavior here in Game Courier, as the system variable mln which specifies how many moves have been played, specifies 0 both before any moves have been played, and after the first white move. So after the first white move the promotion was suppressed too.

I now solved that by testing directly whether a destination square exists, rather than relying on the move number.


25 comments displayed

LatestLater Reverse Order EarlierEarliest

Permalink to the exact comments currently displayed.