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

Programming Piece Movement in Game Courier. A tutorial on two different ways to program piece movement in Game Courier.[All Comments] [Add Comment or Rating]
🕸📝Fergus Duniho wrote on Fri, Oct 19, 2018 11:48 AM UTC:

sign and - are two seperate operations. The - operator does subtraction. The sign operator indicates whether the result of the subtraction is positive, negative, or zero by returning 1, -1, or 0. In this context, this value is being used as a value for the where operator, which takes three arguments and returns a coordinate. It is the same coordinate each time. The space in question is the diagonal space it must pass through before turning to move in an orthogonal direction. By using sign twice, it has divided the board into four quadrants, and it has identified the only diagonally adjacent space it could have passed through to reach the space legal movement to is being checked for. If this space is empty, it then checks whether orthogonal movement from that space could reach the destination space.