| Author |
Message |
Martin Omander (Momander)
| | Posted on Sunday, November 28, 2004 - 11:10 pm: | |
How would you build a game where one side wins if the other side hasn't won in 30 turns? I have implemented a turn-limit this with 30 linked dummy positions and a TimeKeeper piece that is moved along by a random player every turn. One player has the winning condition of TimeKeeper being in dummy position 30. This works, and I think the AI can take it into account. However, the moves made by the random player are shown in the move list, which is not user-friendly. The language reference says "Move actions involving dummy positions are not displayed on the move list", which seems not to be the case. Or I'm doing something wrong :-) An old posting to this message board contained utility functions for a general-purpose counter using flags, which may fit the bill. Being a ZRF semi-newbie, this approach generates even more questions: 1. From where do I call to reset the counter once when the game starts? 2. From where do I call to increment the counter each turn? From every move declaration? 3. Are flags (used by the counter) persistent across move blocks? The original post said they were, but it sounded like it's not a supported or safe feature. 4. How do I end the game when the turn limit is reached? 5. Will the AI consider the turn limit? What is the best way of implementing an invisible turn-limit? I haven't been able to find a game with a turn-limit yet from which to get inspiration. Cheers /Martin |
Dan Troyka (Dtroyka)
| | Posted on Monday, November 29, 2004 - 7:13 pm: | |
The "11-move challenge" variant of the game Duck Solo uses a turn limit similar to what you described, except that the timekeeper piece (called "counter" in my ZRF) is advanced as part of a player's move. Counting does not show up on the move list unless authoring mode is on. |
Ken Franklin (Kenz)
| | Posted on Tuesday, November 30, 2004 - 8:50 am: | |
With only 30 moves, couldn't the turn-order simply be 'spelled out' with a (Side) Stalemate as Lost condition? |
L. Lynn Smith (Interrupt27)
| | Posted on Tuesday, November 30, 2004 - 3:58 pm: | |
On way is to create two dummy positions, let's call them 'post1' and 'post10', and dummy pieces for each of the ten numbers 0-9. This way any number between 0 and 99 can be represented. When a move is performed, a subroutine would change-type these dummy positions. Now win-, loss- and draw-conditions need only look for a specific piece in a specific position. And if the counter needs to be reset, for example when a capture is performed, then these two position need only be change-type'd to the desired value. Now this would denote moves, so you'll need to double(or triple, depending on the number of players) for turns. And if a coder needs more than 99, just add a dummy position called 'post100' and adjust the decrement subroutine accordingly. Example of decrement subroutine: (define decrement_counter_one (if (piece? num1 post1)(change-type num0 post1)) (if (piece? num2 post1)(change-type num1 post1)) (if (piece? num3 post1)(change-type num2 post1)) (if (piece? num4 post1)(change-type num3 post1)) (if (piece? num5 post1)(change-type num4 post1)) (if (piece? num6 post1)(change-type num5 post1)) (if (piece? num7 post1)(change-type num6 post1)) (if (piece? num8 post1)(change-type num7 post1)) (if (piece? num9 post1)(change-type num8 post1)) (if (piece? num0 post1)(change-type num9 post1)(decrement_counter_ten)) ) (define decrement_counter_ten (if (piece? num1 post10)(change-type num0 post10)) (if (piece? num2 post10)(change-type num1 post10)) (if (piece? num3 post10)(change-type num2 post10)) (if (piece? num4 post10)(change-type num3 post10)) (if (piece? num5 post10)(change-type num4 post10)) (if (piece? num6 post10)(change-type num5 post10)) (if (piece? num7 post10)(change-type num6 post10)) (if (piece? num8 post10)(change-type num7 post10)) (if (piece? num9 post10)(change-type num8 post10)) (if (piece? num0 post10)(change-type num9 post10)) ) If additional digits are desired just duplicate accordingly. The reset of the counter should be fairly easy to accomplish. Just use the following example: (define reset_counter (change-type num9 post1) (change-type num9 post10) ) |
Karl Scherer (Karl)
| | Posted on Thursday, December 02, 2004 - 1:30 am: | |
I think the simplest way is to create a 1-dimensional grid z1-z100 with a direction (say e), and advance a piece on this grid for every move you do: z1 (while (not-piece? dot) e) capture e (create dot) The win-condition can then check any move number, e.g. (absolute-config dot (z33)) Cheers, Karl |
|