| Author |
Message |
Marcelo Portella (Portella)
New member Username: Portella
Post Number: 6 Registered: 7-2008
| | Posted on Wednesday, August 06, 2008 - 2:22 pm: | |
In the game I'm designing I have to scan the whole board for pieces that already moved in order to update their status (they kind of recharge every move). Since the board is big (17x17), I think this will be expensive, reducing zillions AI performance. Is there an efficient way of doing it, like establishing a flag to positions with moved pieces and then just updating those? As far as I know, flags can't be used outside a move block... or am I wrong? |
Shane Freeman (Thegreathabudabi)
New member Username: Thegreathabudabi
Post Number: 26 Registered: 7-2008
| | Posted on Wednesday, August 06, 2008 - 4:14 pm: | |
Why not have a piece attribute that gets updated inside the move block when the pieces move? Then you can use a while on-board? construct to search out pieces with the previously mentioned attribute set to true and do whatever you need to do to them when that attribute is found. Then at the conclusion of that syntax, set the attribute back to false. - Shane |
Shane Freeman (Thegreathabudabi)
New member Username: Thegreathabudabi
Post Number: 27 Registered: 7-2008
| | Posted on Wednesday, August 06, 2008 - 4:17 pm: | |
BTW, my 4 player chess variant is operated on a 16 x 16 layout, and I use the aforementioned syntax for a variety of things, which as fas as I can tell does not make the Zillions AI any dumber. - Shane |
M Winther (Kalroten)
New member Username: Kalroten
Post Number: 92 Registered: 1-2007
| | Posted on Wednesday, August 06, 2008 - 11:36 pm: | |
A way of solving this without scanning the board is, perhaps, to have several piece definitions of the same piece, e.g. 1knight, 2knight, etc. A 1knight, when it moves, is promoted to a 2knight, a 2knight to a 3knight, etc. The "move-type" in the 1knight definition (1moves) has a lower (or higher) priority than the 2knight move-type, etc. In this way, a 2knight has a higher priority than a 1knight, and the 1knight cannot move. It's only possible to move the 2knight. So all kinds of pieces use move-types 1moves, 2moves, etc, which correspond to 1bishop, 2bishop etc. In this way a 2bishop has the same priority as a 2knight. In this way you can perhaps circumvent the costly scanning procedure. /Mats |
Marcelo Portella (Portella)
New member Username: Portella
Post Number: 7 Registered: 7-2008
| | Posted on Thursday, August 07, 2008 - 11:03 am: | |
Thanks Mats! Thanks Shane! Will try those solutions. I'm a bit low on time during this weeks, but will give it a try on the weekend. |
|