Check out Janggi (Korean Chess), our featured variant for December, 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

Earlier Reverse Order Later
Vanguard Chess. Game Courier preset for Vanguard Chess. (16x16, Cells: 256) [All Comments] [Add Comment or Rating]
Daniel Zacharias wrote on Thu, Feb 15 02:20 AM EST:

This preset has a problem with the black sergeants. They are unable to move forward.


Daniel Zacharias wrote on Thu, Jul 4 12:49 PM EDT:

I'm seeing this error

Syntax Error on line 287

A variable name should not begin with a digit.


H. G. Muller wrote on Thu, Jul 4 01:38 PM EDT in reply to Daniel Zacharias from 12:49 PM:

@Fergus - I have a problem with the following GAME code:

  set royal array; // empty array
  do while < #i count #myroyal:
    set type elem #i #myroyal;     // next royal type
    set cnt elem #type piececount; // count them
    if #cnt:
      set nr + #nr #cnt;
      push royal #type;
    endif;
    inc i;
  loop;

The purpose was to make (from the array 'myroyal' of royal types) an array 'royal' of royals that are actually present on the board. The problem is that 'cnt' doesn't get the value zero when the key '#type' is not in the array. So the "if #cnt:" is always satisfied, and the non-present royalas get listed in the array 'royal' as well.

How could this be solved?

[Edit] I did find a solution: use "if + 0 #cnt:" instead of "if #cnt:". Apparently dereferencing a variable with value 'undefined' produces a text string, but using it as an arithmetic operand treats it as 0.

@Daniel - It appears this solves the problem in the preset, which was caused by the first piece type mentioned in the 'royal' array being a Pr, which was not present in the initial setup.


🕸Fergus Duniho wrote on Thu, Jul 4 03:15 PM EDT in reply to H. G. Muller from 01:38 PM:

I did find a solution: use "if + 0 #cnt:" instead of "if #cnt:". Apparently dereferencing a variable with value 'undefined' produces a text string, but using it as an arithmetic operand treats it as 0.

When you place a hashtag in front of a variable name, it will return the value only if it recognizes the name, and it will otherwise return a string literal of the variable name with a hashtag in front of it. To get around this, use "if var cnt" instead.


Daniel Zacharias wrote on Thu, Jul 4 03:18 PM EDT in reply to H. G. Muller from 01:38 PM:

that works, thanks


🕸Fergus Duniho wrote on Fri, Jul 5 12:38 PM EDT in reply to Daniel Zacharias from Thu Jul 4 12:49 PM:

I'm seeing this error

Syntax Error on line 287

A variable name should not begin with a digit.

Can you be more precise about where you see this error? I did not see it when I checked the preset for this game.


H. G. Muller wrote on Fri, Jul 5 12:45 PM EDT in reply to Fergus Duniho from 12:38 PM:

Can you be more precise about where you see this error? I did not see it when I checked the preset for this game.

I already fixed this. It was the issue with the hashtag on an undefined variable resulting in a string.


7 comments displayed

Earlier Reverse Order Later

Permalink to the exact comments currently displayed.