| Author |
Message |
Mats W (Kålroten)
| | Posted on Tuesday, March 14, 2006 - 12:00 am: | |
I invented a simple method of checking whether a piece exists on the board. Maybe it has already been invented. In Burmese Chess (can be downloaded already now) I need to check whether the General exists, because the pawns aren't allowed to promote to General if it still exists. In the General's move definition I simply added a move to a square beside the board, and gave this move lowest priority. Whenever I need to know whether the General exists I only call the routine 'defended?' (or 'attacked?'). If the square is defended, then the General exists. It works fine as there is only one piece to check. The method isn't recommendable if there are many pieces (too heavy). (The normal way of doing this would be to check every time a piece is captured, and if it's a General one must remove or add a dummy piece beside the board, or set an attribute of a piece beside the board.) Mats |
Greg Schmidt (Gschmidt)
| | Posted on Tuesday, March 14, 2006 - 11:29 am: | |
Thanks for sharing that. I wish there was some sort of compendium of the various idioms, tricks, and optimizations that game developers are using to coax Zillions. There's alot of good information already captured on this site. Maybe at least this could be in its own topic, but right now, the "Designing Games for Zillions" topic is the closest thing in existence. -- Greg |
|