| Author |
Message |
Luke Pebody (Bozzball)
| | Posted on Tuesday, October 26, 2004 - 10:26 am: | |
I am trying to programme a game where the winning condition involves the other player having just played. I.E. In order for black to win, his pieces must have some relative-config, and white must just have moved. How do I do that? |
Sean Duggan (Dream)
| | Posted on Tuesday, October 26, 2004 - 3:52 pm: | |
I guess my first question would be what situation you might have where White was not the last person to move. However, as a general solution, create a dummy position and a dummy piece for the dummy position. Put the piece on the position if a player moves. Remove it if they don't. The next player can check for the dummy piece's existence and include it as part of their winning condition. With more details as to what you want to do, we can give more specific advice. |
L. Lynn Smith (Interrupt27)
| | Posted on Tuesday, October 26, 2004 - 7:03 pm: | |
Or... Change-owner a dummy piece on a dummy position at the end of each turn, then have the win-condition test for the owner of that piece. This works fine for two player games. With a >2 player game, create dummy positions and dummy pieces for each player. They start as a 'null'. At the end of a player's turn, turn all enemy pieces to 'null' and friendly pieces to 'active'. Have the win-condition test for friendly or enemy 'active' or 'null', according to the particular move sequence. |
Dan Troyka (Dtroyka)
| | Posted on Tuesday, October 26, 2004 - 7:50 pm: | |
Epaminondas uses the method that Lynn describes. There's a piece called Turn-Indicator that monitors whose turn it is. The code is complicated by all the ways a player can even the game on his grace turn but hopefully it might provide some guidance. |
|