| Author |
Message |
Arie Rudich (Arie)
| | Posted on Friday, August 10, 2001 - 1:08 am: | |
Hi, The game I'm trying to program includes a Dice. Each player throws the dice and can move his pieces as many steps as the dice shows. What techniques can be use to "count down the dice"? How do I further restrict each piece to move no more then 3 steps in a move? I've found and am using the nice Dice throw from Senat. For the actual count down of steps I was considering two options: - using the counter by Patrick S. Duff (on this discussion board), or - an off board piece that moves on a line, after each throw it is set to a position corresponding to the result, before each step check if it is back to the start, and after step move it by one towards the start. Could anyone please comment on the merits of each method or suggest a better one? As a new ZRF programmer I could also use help in the structure of the program: - where is it best to put the dice accounting - in the ?Dice player code or in each move of the actual players? - how best to package into macros the code before and after each piece step? - any trade-offs relating to the AI engine performance? Thanks, Arie |
Dan Troyka (Dtroyka)
| | Posted on Friday, August 10, 2001 - 10:19 am: | |
Does the game actually require counting down the dice? It would be easier to have move blocks for each dice reading. The first line in a move block could verify a specific value for the dice. Then, if the value is one, the piece moves one space, if two, it moves two spaces, and so on. |
Arie Rudich (Arie)
| | Posted on Friday, August 10, 2001 - 11:57 am: | |
Hi Dan, Yes, there is no actual need to count down the dice, and the solution you suggest may work. BUT as the dice result can be up to 12, and there are about 15 pieces that can move (each up to 3 steps), I am planing to use 'cascade' as a way around combinatorial explosion. If you can see a way to still go about without counting I will be much obliged. Thanks, Arie |
Dan Troyka (Dtroyka)
| | Posted on Friday, August 10, 2001 - 12:31 pm: | |
Hmm, that won't be so easy. If I understand correctly, if you throw a twelve, then you can move as many as twelve pieces, and pieces can move up to three spaces at a time (until the total of 12 is exhausted). The first problem this presents is turn order. Zillions doesn't let you use add-partial to generate a new move by a different piece. Cascade won't solve the problem either (at least not if the player has a variety of options for which pieces to move and how far). I dealt with this problem in Endodoi by giving each player up to 20 moves per turn but only if certain conditions are met. When the conditions are not met all remaining moves on that player's turn are passes. The AI handles this well but it's still a very inefficient solution. Once you figure out turn order then it appears you will have to count down the dice. I prefer the off-board slider option. You would probably need one for each player. If the dice role is ten, then the slider is placed in position ten. There could be three move blocks for each piece. To move one step, verify first that the slider is not in position zero. To move two, verify that the slider is not in position zero or one, and for three, verify that the slider is not in position zero, one, or two. Then, after the move, go to position zero on the slider, use a while statement to get to the slider, cascade, and move it down according to the number of steps taken. This will move it down to zero eventually. The ?Dice player will need to reset the sliders to zero. Just my two cents. Good luck! |
|