Check out Glinski's Hexagonal Chess, our featured variant for May, 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. PHP script for playing Chess variants online.[All Comments] [Add Comment or Rating]
🕸💡📝Fergus Duniho wrote on Thu, Feb 6, 2020 04:28 PM UTC:

You shouldn't need to call them directly.  They are called from the Checked function if I recall correctly.

In the chess include file, they are used in the stalemated and checkmated subrroutines. To test for checkmate or stalemate, these subroutines calculate every possible legal move. When no legal moves are found, each of these two subroutines will return true. When any legal moves are found, they will return false. But instead of stopping with the first legal move, they will continue to calculate all legal moves, so that an array of legal moves can be created for use in displaying legal moves. To find all the legal moves for a piece, it checks whether each piece can make a legal move to each space that falls within its range of movement. That second function is used to create an array of destination spaces to check for legal moves to.

Zillions-of-Games will do things differently. It uses a single movement definition to calculate where a piece may legally move. Instead of knowing how a piece moves, the chess include file for Game Courier relies on knowing how to check whether a move was legal and on knowing which spaces it is worth the trouble to check for a legal move to. Although this requires two functions instead of one, the two functions will normally be simpler.