[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]
Comments/Ratings for a Single Item
Is there going to be a section added here for automated moves? Or are they documented elsewhere?
The section on automated moves is now added. It also gives details on random moves.
This guide now describes the following new commands: setflag, unsetflag, copyflag add, move, replace if, else, elseif, endif, verify The verify command was already available, but it has now been greatly expanded. I created some of these commands for use with Crazyhouse, and I created others because of their similarity to other commands I was creating. In particular, the new Crazyhouse preset tracks Pawns with flags, uses verify to check the flag of a captured piece, then uses add to change it to a Pawn if it used to be one. Although I didn't use them, I also figured out how to implement nesting if, if-else, and if-elseif-else statements. I haven't thoroughly tested them out yet, but I expect they should work.
The if commands are not working properly right now, but it's too late to continue debugging. I'll continue working on it later.
The if, else, elseif, and endif commands should be working properly now. My tests of their behavior are successful so far. The endif command has been expanded to allow the all parameter or a numeric parameter. The all parameter closes off all if scopes. A numeric parameter is like repeating endif as many times as specified. If you write an if-elseif series, it is appropriate to end it with 'endif all'.
Some of the new features I added are only temporary. I will be replacing some of the conditions and expressions I wrote for if and set with a function that allows various operations to be combined in a single expression using backwards Reverse Polish Notation, i.e. Polish Notation.
I have added the ability for if, set, and verify to use a Polish notation calculator for evaluating complex expressions. But it will be a while before the documentation is ready.
The automation language for Game Courier is now more powerful than ever. The newly developed if, set, and verify commands can all make use of a Polish notation calculator for evaluating very complex expressions. The Polish notation calculator includes special functions for getting information that can be used in code for enforcing rules to games. It might be possible now to write code that enforces the rules of Chess, though what I've done so far focuses mainly on the easier task of checking whether a piece has moved as its powers enable it to. The harder part is checking for check and checkmate. I haven't worked out all the details yet, but what I have implemented may already be capable of this. But even if it is, I expect to write some more functions to make the process go faster and take up less code.
Is it possible to create a 'Stratego'-like game with the following characteristics? - each player can see his own pieces but not his opponents - players are able to choose the placement of their pieces before starting
Is it possible to create a 'Stratego'-like game with the following characteristics? - each player can see his own pieces but not his opponents - players are able to choose the placement of their pieces before starting
There was a game called Stealth Chess recently that adapted that idea (Stratego-style hidden pieces) as a chess variant. It might be on eBay, or there may be websites on it. Maybe it's even on this site -- guess I should have checked before I started writing.
No, Game Courier does not support that sort of hidden-information game.
Very nice! This new version is very well written and comprehensive! Thanks for this.
I've now added two new parameters to Customize and Edit mode. These are Scale and JPG Quality. Scale resizes auto-generated PNG and JPG images, while JPG Quality is used for saving JPG files. Details are given in the section on Customize mode. I uploaded a new Circular Chess preset today that makes use of both of these new parameters. It also makes use of the new method for generating circular boards, which I'm still working on and have only begun to document here.
The PNG and JPG methods for automatically generating circular boards seem to now be in good working order. They are described in the guide. I have also added details on some new functions for the Polish Notation Calculator: prevfullmove, prevmove, count, and trim.
In preparation for a British Chess preset, I have added some new features to Game Courier that are now documented here. These are the path function and the foreach-next loop. The path function returns an array of all steps from one space to another. The foreach-next loop iterates through all the elements of an array. Although I could do it, I don't plan to add additional types of looping, since I don't want to provide the ability to create infinite loops. Foreach should be sufficient for any looping needs any preset has. Also, I am deprecating how endif currently works. In the future, endif will automatically close off all elseifs within the scope of the current if, which it will also close. There will no longer be any need to use numbers or the all keyword with endif. I could make the switch right away if everyone wrote endifs the same way I do, but just in case anyone has used endif arguments for shortcuts that close off multiple ifs, not just multiple elseifs and a single if, I am allowing time for transition before the old way of using endif breaks down. To make the transition, replace any use of 'endif all' or 'endif #' with 'endifs' and make sure that each 'endifs' statement closes off only one 'if' statement. The 'endifs' command works in the same way that 'endif' eventually will.
I've changed how next works since last night. It no longer uses any arguments. It just updates whatever loop it is for and loops back if it hasn't reached the end of the array yet. I have added the for command. It works much the same as the foreach command, but it uses a different syntax, and it uses an array expression instead of an array name. If you had in mind something like 'for x = 1 to 8', you would write it as 'for x range 1 8'. I have added the sub, return, and gosub commands for using subroutines. The sub and return commands mark the beginning and end of a subroutine. The gosub command goes to a subroutine. To prevent the possibility of infinite loops, the gosub command cannot be used from within a subroutine.
I have written a comprehensive postauto1 and postauto2 code (with perhaps a few bugs) which covers the 16 possibilities for Chess With Different Armies. (All there is to change in each preset is the title in 'game', the initial setup in 'code' and two arrays for possible promotions in 'pregame'.) Would it be possible to refer to a common postauto1 entry and a common postauto2 entry, instead of having to maintain 16 identical postauto1 entries and 16 identical postauto2 entries? It would also be useful when there are several presets for a same game.
You cannot store code for multiple games in a single file unless you plan on using the same game name. The feature you ask for is not needed when their are several presets of the same game, because those presets can already be made to use a common settings file. A settings file may be shared by presets so long as the game name remains the same.
I have removed the prevmove and prevfullmove functions, and I have replaced them with a thismove function. This one accurately does the job the others were intended for. It will return the text of the player's move, no matter whether it is called in the premove code or the postmove code.
Because of some changes I made to how Game Courier processes automation code, some presets are presently in need of debugging. Until now, the premove and postmove code would just be recopied for each new move, and Game Courier would go through all the code from start to finish. But now, Game Courier encapsulates the premove and postmove automation code into subroutines, and it puts all the moves and automation code into the form of a computer program, which it interprets. One more change I've made is in how endif works. It now works the same way as endifs. I had to make this change right away instead of waiting longer, because 'endif all' did not work as intended when inside of a subroutine. I expect most of the bugs will have to do with improperly placed 'endif' commands. For debugging purposes, Game Courier will let you view the program that it will run to update the board for a game. To see it, just add '&showcode=true' to the URL.
New additions to GAME Code, Game Courier's programming language, are the ability to include code from separate files, the ability to define one-line functions, similarly to how it's done in BASIC, the ability to use subroutines, and the ability to execute code in loops. With these changes, it will now be possible to create libraries of code that can be used for many presets, and that will make preset development both faster and easier.
After creating user defined functions, I discovered that my Polish Notation calculator wouldn't let recursive functions work. So I came up with some replacements for cond, called unless and onlyif. These work sort of like cond but with only two arguments instead of three. The expression 'cond x y z' is supposed to be equivalent to 'x ? y : z' but it evaluates both y and z, making it unsuitable for recursion. It ends up creating an infinite loop when used for recursion. Unlike previous functions in the PNC, unless and onlyif can break out of it, allowing recursion loops to be exited. I won't describe them in detail here, because I already did in the documentation. After creating these new functions, I realized the same principle could be applied to logical operators. So I updated and, or, nand, and nor to use either one or two arguments. When only one argument is available, these operators will stop evaluation of the expression when the truth value of the whole expression can be known from one value. For example, I can now write code like this: def Q checkride origin dest 1 1 or checkride origin dest 1 0; This function would evaluate the Rook moves before the Bishop moves, and if the Queen moved like a Rook, it would return true without bothering to check whether it moved like a Bishop. So, finally, logical operators can be used for flow control in expressions. They can also be used for exiting from recursive functions.
I've now brought together the new features I've been developing to write a new Chess preset in a new way. Most of the code is in an include file and can be viewed here: http://play.chessvariants.org/pbm/includes/chess.txt The code makes use of user-defined functions and subroutines. I am currently using this new preset for the Chess preset with Abstract pieces. I will begin using it for the others after I have tested it more thoroughly.
I've debugged the code in the include file for Chess, and I've also made it more generalized. I've included a castle subroutine that can make castling much easier to implement, and I've generated arrays of which pieces a Pawn may promote to out of the array of piece keys, which is generated from the FEN code. I am now using this new version of the Chess enforcement code for the Alfaerie JPG Chess preset as well as for the Abstract Table preset. http://play.chessvariants.org/pbm/includes/chess.txt With the improvements I've recently made to GAME Code, it may now have the computing power to spot checkmate, but it will still take someone to figure out how to do it. I have a general of how to go about it. First, check if the King is in check. If it is, then loop through the King's possible moves, checking if any are legal. If none are legal, identify the checking pieces. If there is more than one checking piece, it is checkmate. Otherwise, check if any piece can legally capture the checking piece. If it can't be captured, check if any piece can legally move to block the check.
25 comments displayed
Permalink to the exact comments currently displayed.