Check out Grant Acedrex, our featured variant for April, 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

The Fairychess Include File Tutorial. How to use the fairychess include file to program games for Game Courier.[All Comments] [Add Comment or Rating]
🕸📝Fergus Duniho wrote on Wed, Apr 8, 2020 12:23 PM UTC:

I see in your code that you started using the name King directly instead of as an alias for Apothecary_King. When you do it this way, it calls the King subroutine. This is working out for you, because the King subroutine calls the King function. The subroutine also includes some code for handling castling, but since you have not set wcastle and bcastle, it will recognize any attempt at castling as illegal without needing to call the castle subroutine. So, it basically just uses the function to check the move's legality, and it updates the value of kpos or Kpos to the space the King moved to. What the King subroutine is doing that your code was not doing before is updating kpos or Kpos BEFORE your code checks whether your King has moved into check. Presently, you have the code for updating kpos and Kpos at the very end of your Post-Move sections, but these variables need to be updated before checking whether you have moved into check. So, if you just changed the position of this part of your code, you could use King as an alias for Apothecary_King without any problem.