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 ]

Single Comment

Game Courier Developer's Guide. Learn how to design and program Chess variants for Game Courier.[All Comments] [Add Comment or Rating]
🕸📝Fergus Duniho wrote on Sat, Dec 18, 2004 02:35 AM UTC:
I have been busy improving GAME Code this week. Here are some of the latest
improvements. Instead of using explode to split a line of code into strings
of non-whitespace, I have written some parsing functions. One parsing
function checks whether a line of code is a move, returning each item in a
separate argument. If it's not a move, a second parsing function is used.
This function parses out quoted strings, arrays, and non-whitespace
strings. Here's how it works.

It goes through each character of a line. It normally skips over
whitespace. When it finds a double quotation mark immediately after
whitespace, it copies everything until the next one as a single string.
When it find a left parenthesis, it copies everything until the next right
parenthesis, then recursively calls the parsing function on this. This
generates an array. Otherwise, it copies as a single argument whatever
text falls between whitespace. Also, it does additional preprocessing only
on unquoted nonarrays. So if you want to use 'origin', 'dest', or
'moved' as strings rather than as special variables, you can quote them
to use the strings. This is required if you want to use setglobal to set
the value of one of these variables.

I've added target and check operators to the Polish notation calculator.
These work sort of like switch and case. They are used for speeding up the
search for pieces that might be checking the King. Details are in the
documentation.

The fn operator now accepts nameless functions as arrays, which allows the
creation of nameless lambda functions.