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 Latest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Comments/Ratings for a Single Item

Later Reverse Order EarlierEarliest
Game Courier History. History of the Chess Variants Game Courier PBM system.[All Comments] [Add Comment or Rating]
🕸💡📝Fergus Duniho wrote on Sun, May 12 08:53 PM UTC:

I made a change to the following functions that can run lambda functions on array values: aggregate, allfalse, nonetrue, alltrue, anyfalse, anytrue, any. These will now have access to the variable key, which will contain the key of the array value currently passed to the lambda function. This should be accessed with the var keyword to make sure that a previously defined variable is not being used.

To prevent expressions using these from changing the value of a previous variable called key, I had to raise the scope of every expression. But to get this to work, I had to rewrite each built-in function that exited the PHP function for evaluating expressions with a return. Instead of using return, I had each one set $output to a single element array with the return value, and I set $input to an empty array so that the condition on the while loop would be false. Doing this makes sure that it decrements the scope before exiting the function.

Raising the scope of an expression also makes sure that the mechanism for adding named variables to a function cannot be used in an expression to set a variable that lasts beyond the expression. The following code prints 6468, then it prints 63. This is because it raises the scope for the assignments in the expression, and when it completes the expression, it closes that scope.

set o 9;
set y 7;
set pp * var o var y =o 98 =y 66;
echo #pp;
print * #o #y;

🕸💡📝Fergus Duniho wrote on Fri, Apr 22, 2022 10:32 PM UTC:

Small palette board images with fewer than 256 colors that use the default colors can now be recolored like automatically generated boards. When the developer or user has chosen a different color than one of the default colors, the default color will be replaced by the new color in the image. For this to work, the original image must use the default colors, which are 339933, CCCC11, and 22BB22.


A. M. DeWitt wrote on Wed, Mar 16, 2022 05:29 PM UTC in reply to Fergus Duniho from Tue Mar 15 07:52 PM:

The editor is working again. Thanks.


🕸💡📝Fergus Duniho wrote on Tue, Mar 15, 2022 07:52 PM UTC in reply to A. M. DeWitt from 06:41 PM:

It seems the new handling of case is interfering with the display of the Preset Editor, at least for me.

There is a double space in the case statement on the line where the error is.

The error message it gave wasn't quite accurate, because the actual string was the empty string, not one with whitespace in it. I modified it to skip over empty strings. So, it works now.


A. M. DeWitt wrote on Tue, Mar 15, 2022 06:41 PM UTC in reply to Fergus Duniho from Mon Feb 7 06:18 PM:

It seems the new handling of case is interfering with the display of the Preset Editor, at least for me. The link below is an example.

Edit: Taishin Shogi on the Chess Variants Game Courier

There is a double space in the case statement on the line where the error is.


🕸💡📝Fergus Duniho wrote on Mon, Feb 7, 2022 06:18 PM UTC:

I made a correction to the handling of case statements. If multiple case labels were in the same case statement, it would previously check only if the first one was already assigned. It will now check whether every single case label has been assigned. If a case label has already been assigned in a switch, it will give an error message.

If a case label includes whitespace, it will now report an error message. This is in case a colon is left off a case statement, and a new line character gets included in the case label.

If a switch statement is passed a value that does not match any of its cases, and it has no default case, it will report an error message that neither the expected case nor a default case exist.

The print statement can now be used to print the value of an array, which will make it more useful for debugging.


🕸💡📝Fergus Duniho wrote on Fri, May 7, 2021 05:42 PM UTC:

I modified the sets files to use relative URLs for the value of $dir. I modified some other code to work with relative URLs, and I added code that exits the script with an error if you use a value of $dir that does not begin with a forward slash. So, from now own, $dir should be set only to a relative URL to a directory on this site.

Using relative URLs has a few advantages:

  • Piece URLs will be shorter, using less bandwidth.
  • Insecure http image URLs will no longer be used, since relative URLs will default to secure https URLs.
  • No one will be able to use piece images that are located on another website.

In a related matter, $dir is now an accessible system variable in GAME Code. You may write to it with setsystem or get its value. This is useful for using GAME Code to create and use custom piece sets that are not defined in a PHP file. More details can be found here.


🕸💡📝Fergus Duniho wrote on Wed, Mar 31, 2021 12:23 AM UTC:

Since the Compounds group had only two sets in it that didn't even match up, and one belonged to the Chess group anyway, I removed its members and replaced them with four new piece sets that do match, more or less. These four are drawn from the Abstract, Alfaerie, Magnetic, and Motif pieces. They are meant to consist only of pieces that can be made by using or recombining standard Chess piece images, particularly for Magnetic and Motif. Each one currently has all double compounds of King, Rook, Bishop, and Knight. The Amazon is the only triple compound. Compound pieces have two or three letter labels indicating the pieces they are compounds of. There is some redundancy regarding the Queen, using both q/Q and rb/RB for the Queen, since Fusion Chess uses the latter. This also carries over to the labels for the Amazon, which are qn/QN and rbn/RBN. I would like to add Ferz and Wazir pieces, some compounds with these, and some more triple compounds with these and/or the King. I'm still working on Ferz and Wazir designs. Some alternatives are to use smaller Rooks and Bishops, to mix the Rook and Bishop with Pawns, or to place the numeral 1 on modified Rooks and Bishops.


🕸💡📝Fergus Duniho wrote on Mon, Mar 29, 2021 11:08 PM UTC:

I added themes for Storm the Ivory Tower and for Omega Chess. For the latter, I added the ability to erase non-space when using tiled background images. This let me use tiled background images for Omega Chess themes. These themes do not print the coordinates for the corner spaces, but they do show the coordinates if you hover the mouse over them.


🕸💡📝Fergus Duniho wrote on Sat, Mar 27, 2021 06:25 PM UTC:

There are now themes for Chinese Chess, Janggi, and Chessgi. Chessgi themes will work for any game using the same type of board and a set from the Chess group. The Chess themes now work with any 8x8 game using a set from the Chess group instead of testing for a subset of the pieces in Chess. There are also Chess-Squares and Compounds-Squares for boards of varying dimensions built from the square shape or a 100x100 tile. These work with sets from the Chess and Compounds groups respectively.


🕸💡📝Fergus Duniho wrote on Sat, Mar 27, 2021 01:54 AM UTC in reply to Fergus Duniho from Fri Mar 26 09:34 PM:

There are now Chess themes, and these will be used for any game on an 8x8 board whose pieces on the board are a subset of the pieces in Chess.


Daniel Zacharias wrote on Fri, Mar 26, 2021 10:24 PM UTC in reply to Fergus Duniho from 09:34 PM:

Maybe themes should be shared among all games that use the same piece set and geometry


🕸💡📝Fergus Duniho wrote on Fri, Mar 26, 2021 09:34 PM UTC:

I have begun adding the ability to create themes for games. A theme is a collection of settings that can be chosen together for the purpose of changing the appearance of a game. This makes changing the appearance of a game quicker and easier than doing it one setting at a time. When themes are available for a game, they will appear in a drop down select list just above where you can change individual settings. Any member may create and save a theme by going to the Customize section of the preset. Customize it how you want, enter a theme name, and click Save Theme. It will then be available for that game.

So far, I have made themes only for Shogi. I plan to do some Chess themes later and set things up for presets that use the same equipment as Chess to use the same themes. I also plan to provide the option for games to use the themes for another game instead of having its own. This will come in handy when different games use the same board and pieces and so can share the same themes. And I plan to set things up so that players can create themes without leaving their games. But I've done enough work on it for today, and what I've done today seems to be working.


🕸💡📝Fergus Duniho wrote on Mon, Dec 28, 2020 06:33 PM UTC:

I added an exit command, which immediately terminates the GAME Code program. It works by setting a flag that causes the run_subroutine() function to immediately return before doing anything, and then it returns. So, if you use it within a subroutine, it will return from that subroutine and then return from any lower scope that called it until it completely exits the GAME Code program. Note that this will affect only the GAME Code program and will not exit the PHP script.


H. G. Muller wrote on Sat, Dec 12, 2020 02:26 PM UTC:

Is it really a good idea to make this the default behavior? There probably are some situations where you want this recursion, but I cannot imagine you would always want it. I think it would be better to have the programmer explicitly indicate whether he wants it to happen, e.g. by having an operator different from # for it. E.g. when p is set to #m and m to "foo" then #p could return "#m" but dig p could return "foo".


🕸💡📝Fergus Duniho wrote on Fri, Dec 11, 2020 02:15 AM UTC:

I previously made the variable prefixes recursive. This allows something like this:

set m Mars;
set p m;
echo ##p;

The expression ##p returns #m, which returns Mars. So, "echo ##p" prints Mars. While helpful, this breaks some code I previously used to check whether a variable has been set. This code no longer works:

set m Mars;
if == #m "#m":
  echo undefined;
else:
  echo #m;
endif;

When m is defined, #m should be its value, which is Mars, and "#m" should be the string "#m". But thanks to recursion of variable prefixes, or so I presume, the string "#m" is converted to #m, which is then converted to the value of m. So, the test == #m "#m" still returns true when m has been defined. This makes it useless for telling whether a variable has been defined.

In its place, you can use the test == var m null. When a variable is undefined, calling it with var instead of a prefix will return null. So, this code works properly:

set m Mars;
if == var m null:
  echo undefined;
else:
  echo #m;
endif;

🕸💡📝Fergus Duniho wrote on Wed, Jul 29, 2020 01:34 AM UTC:

I have made a few changes to GAME Code today:

  1. Functions will now evaluate variables when they are called, not when they are defined. In this example, the function x2 returns a different value each time:
def x2 * 2 #x;
set x 12;
print fn x2;
set x 23;
print fn x2;
  1. Functions now allow you to set named my scope variables. To do this, prepend a variable name with the = sign, and follow it with the value you want to copy to the variable. In the following example, the function copies "Chess Variant" to the variable v, and it doubles it. Both before and after calling the function, #v returns the value of "cartoon violence". This is because the function raised the scope, and the my scoped variables it created were destroyed when the function ended.
set v "cartoon violence";
def s2 list #v #v =v "Chess Variant";
print #v;
print fn s2;
print #v;

If more than one argument follows a variable assignment, they will be converted into an array, leaving nothing to the right of the assignment.

  1. Functions now accept named parameters. This works the same way as assigning a value to a variable except that no value follows the assignment. When no value follows the assignment, it pops off a value from the arguments passed to the function. In the example below, the output is 30, 110, and #x, because x has not been defined outside of the function:
def sqrplus + * #x #x #x =x;
print fn sqrplus 5;
print fn sqrplus 10;
print #x;

Numbered parameters will still work, since it would break way too much code if they stopped working. But numbered parameters will not work with named parameters. With numbered parameters, the exact number of arguments to expect is calculated. If too few arguments are given, there is an error message. If too many are given, only the ones that are needed get read and used. This allows code like this to make sense:

def mns - #0 #1;
def multdiff * fn mns #0 #1 #2;
print fn multdiff 5 11 10;

In the multdiff function, the call to mns has three arguments after it. It uses only the first two, leaving the third to be used as an argument for the * operator.

When you use named parameters, you will get an error message if there are not enough arguments. But if there are more than enough arguments, only the last arguments in the list will be used. In the code below, the first function call prints my name, but the second prints my uncle's.

def name list #first #last =first =last;
print fn name Fergus Duniho;
print fn name Fergus Patrick Duniho;

In general, you should avoid extra arguments when using named parameters, but this behavior may prove useful for creating functions that can take a variable number of arguments. To enable this, I have added the args operator, which returns an array of the remaining arguments. Named parameters will shrink the array of arguments by popping them off. So, if you pop them all off, args will be empty. But if you don't, you can do something like this:

def revwords list reverse args;
print fn revwords Fergus Duniho;
print fn revwords Fergus Patrick Duniho;

The revwords function can take a variable number of arguments. It reverses the order of the arguments and makes a string out of them. So, the two calls to the function output "Duniho Fergus" and "Duniho Patrick Fergus".


🕸💡📝Fergus Duniho wrote on Sat, Jul 25, 2020 10:38 PM UTC:

I have completed some improvements in how arrays are handled. Elements of multi-dimensional arrays may now be specified by including periods in the variable name. Each period separates an array element from its parent array. For example, in #example.element, the parent array comes first, and the element comes second. Deep multi-dimensional arrays are also possible, such as #this.is.an.example.of.a.deep.multidimensional.array.element. You can now set array elements with set, and you can use the value of array elements as arguments to commands that do not evaluate expressions.

You can also use array elements with some commands that change their value. For example, if you kept track of captured pieces in an array called cp, inc cp.p would increment the number of captured Black Pawns.

You can also read the values of elements in system arrays, such as $originalpieces.p, which would return 8 in Chess.

You can also insert variables into array element names using {}. For example, the code below would increment the element of cp corresponding to the captured piece whenever a piece is captured.

if capture:
  inc cp.{$old};
endif;

The setelem command still works, but now it just concatenates the array name with the element name and calls setuservar(). Likewise, the elem operator still works, but when an array is given by variable name, it will concatenate the names and call getuservar();


🕸💡📝Fergus Duniho wrote on Mon, Feb 10, 2020 02:05 AM UTC:

I'm working on adding piece descriptions to the fairychess include file. One reason for this is to help programmers using the include file find the code for the pieces they want. But instead of putting them into comments, I am creating strings that can be used in error messages to remind players how a piece moves. I started with the Chess pieces while I took the time to hone the code for displaying the messages. The strings use "%s" instead of the piece name in case someone renames a piece. I had thought of using printf, but I ended up using str_replace, which I added to the language. Like the PHP str_replace, its arguments are search, replace, and string.


🕸💡📝Fergus Duniho wrote on Sun, Feb 9, 2020 07:09 PM UTC:

I have added to the fairychess include file the Shogi and CWDA pieces that weren't already in it.


🕸💡📝Fergus Duniho wrote on Sun, Feb 9, 2020 12:58 AM UTC:

The hyphen is in Spider-rider to separate the two adjacent r's.


Greg Strong wrote on Sat, Feb 8, 2020 11:14 PM UTC:

Since I am updating the GC presets for Opulent anyway for the new array, I am going to modify it to use the new fairychess include file.  To that end, I modified the include file to add a few new pieces.  I added Half_Duck and Knight_Wazir since Opulent requires those.  While I was at it, I added the three new pieces for Kevin's games that Aurelian has been working on: Elephant_Ferz, Elephant_Wazir, and Frog.

For reference, here are all the pieces currently supported by the fairychess include file (the notes in parenthesis are not part of the actual name):

Queen
Rook
Knight
Bishop
King
White_Pawn
Black_Pawn
White_Berolina_Pawn
Black_Berolina_Pawn
Cardinal (BN)
Marshall (RN)
Amazon (BRN)
Cannon
Vao
Wazir
Ferz
Camel
Camelrider
Dabbabah
Dabbabahrider
Elephant
Elephantrider
Nightrider
Dragon_Horse (BW)
Dragon_King (RF)
Eques_Rex (NFW)
Wizard (CF)
Champion (WDF)
Korean_Elephant
Chinese_Elephant
Giraffe (4,1 leaper)
Grasshopper
Short_Rook (R4)
Squirrel (NAD)
Spider (DA)
Spider-rider (DDAA)
Squire
Unicorn (BNN)
Zebra
Elephant_Ferz (FA)
Elephant_Wazir (WA)
Half_Duck (HFD)
Knight_Wazir (NW)
Frog (FH)
Griffon
Aanca
Leo (Cannon + Vao)
Mao
Moa
Murray_Lion

One small nit-pick, the Spider-rider has a dash while the other riders do not. Any objections if I correct this inconsistency?


🕸💡📝Fergus Duniho wrote on Sat, Feb 8, 2020 07:54 PM UTC:

I have removed $countextrasas from the system variables. It was not used in any settings file, and I could not figure out what it was for. My comments on it were not informative enough. I commented out the code that used the variable, since it appeared to be useless.


🕸💡📝Fergus Duniho wrote on Sat, Feb 8, 2020 06:03 PM UTC:

I am deprecating the use of global and setglobal as aliases for system and setsystem. I would like to eventually eliminate these from the language, since global variables have a different meaning in the language.

I have limited the power of the system built-in function. While it had prevented people from viewing a password with it, it did allow you to enter "system GLOBALS" to view all the variables, which could be a big security risk. I changed it to return values only from a whitelisted set of system variables. These correspond to the same ones that may be set with setsystem.

I introduced the use of the dollar sign as a system variable designator. When appearing at the beginning of a variable name, it will return the value of the corresponding system variable if it has been whitelisted. I also added support for $old and $moved, which return the values of $lastcaptured and $lastmoved. Since the dollar sign is also the designator for PHP variables, it is basically a way to get the values for some of the PHP variables with the same name. You may also think of the S in $ as standing for system.

Game Courier is already set up to recognize old, moved, origin, and dest as values of system variables, but I don't like this, because it prevents these from being used as ordinary words, and it might make the code more confusing if you don't already know their meaning. The use of $old, $moved, $origin, and $dest should now be preferred, though I can't phase out the old way without rewrting lots of code. I have at least made the changes in the new fairychess settings file for Chess, so that they can be used going forward.


🕸💡📝Fergus Duniho wrote on Sat, Feb 8, 2020 01:53 AM UTC:

I'm glad you like it. The changes I made to constants came about while I was working on the fairychess include file. Since I planned on using constants to associate piece labels with piece names, I wanted to avoid collisions between constants and variables with the same name. I did a grep search on the settings files and changed a few to use the @ sign instead. Just in case constants are used in presets that are defined in forms instead of settings files, or in case someone inadvertently uses # for constants in the future, I let it continue to be used that way but with lower precedence. Even without replacing # with @ in a few settings files, this would have been enough, because they normally did not use the same names for both variables and constants. But if I name constants after piece labels and also use short variable names in functions, collisions could arise. So, I wanted to separate the namespace between them.


25 comments displayed

Later Reverse Order EarlierEarliest

Permalink to the exact comments currently displayed.