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 ]

Comments/Ratings for a Single Item

EarliestEarlier Reverse Order Later
Game Courier Developer's Guide. Learn how to design and program Chess variants for Game Courier.[All Comments] [Add Comment or Rating]
Daniel Zacharias wrote on Mon, Apr 22 05:39 PM UTC:

I'm sure there's a reason for this, but why is it that having legality defined for move highlighting isn't enough to have legal moves enforced?


🕸📝Fergus Duniho wrote on Mon, Apr 22 06:16 PM UTC in reply to Daniel Zacharias from 05:39 PM:

I'm sure there's a reason for this, but why is it that having legality defined for move highlighting isn't enough to have legal moves enforced?

  1. Rule enforcement was a feature before showing legal moves was. Instead of replacing the standard method for rule enforcement, calculating all possible legal moves ahead of time was done as an extra step.

  2. Additionally, moves sometimes had side effects that were not explicitly mentioned in the notation for a move, such as en passant capture in Chess or changing the side of a piece and placing it in hand for Shogi. This imposed the requirement of running code for the actual move when it was made.

  3. Because calculating all possible legal moves is more expensive than just calculating whether one move is legal, it is done only in the Post-Game section. So, if rule enforcement depended upon the calculation of all possible moves for each turn, it would work only in on-going games made one move at a time, or it would have to be repeatedly done in the Post-Move sections, which would prolong the calculation of whether a series of moves were all legal. The way it currently works, it evaluates the legality of a series of moves much more efficiently than it would if it had to calculate all possible moves after each move. For the sake of efficiency, which kind of matters in an interpreted language written in another interpreted language, it makes sense to calculate all possible legal moves only when there is a choice of which move to make. For past moves, calculating all this is just overkill.

[Edit: combined 3 and 4]


2 comments displayed

EarliestEarlier Reverse Order Later

Permalink to the exact comments currently displayed.