Project Khiva
Edmund Tse on Jul 27th 2008
Khiva is an activity being run in the first semester of 2008. It runs every week straight after Advanced Algorithms and Problem Solving and is based around a game we invented.
The game
The game is played by multiple players on a single grid. Each square in the grid contains either a wall, a player or nothing. In each turn a player may rotate clockwise, rotate anti-clockwise, move in the direction they are facing, or build a wall in the square they are facing.
The game ends when walls have been built such that all players are in separate areas (or after a certain number of turns, which depends on the size of the map and the number of players).
When the game ends the players are ranked according to how large their area is – the player in the largest area wins. If two players are in the same area the number of squares is divided in two (and similarly for N players).
Game mechanics in detail
Your program may be written in any language, we will compile it and then run it once for each turn (or just run it if no compilation is needed). Note that each turn must be completed in under 0.3 seconds.
To avoid the problem of ‘order of play’ all actions for each turn are executed simultaneously. Each bot is run and its output is read, all the moves are considered and any conflicting ones are removed. The judge also traces back the change to cancel any further moves that depended on those moves. For example, if one player is unable to move, it may mean another player that was moving into their square can longer move either, etc.
Once the moves are resolved they are executed and the judge checks if the game is over.
Input / Output
Your bot must produce an output file with a name as the executable, but with ‘.out’ at the end instead of the regular extension. This file should contain just one letter:
- B – build a wall in the square in front of the player
- M – move in the direction the player is facing
- C – rotate clockwise
- A – rotate anti-clockwise
A map file also exists called ‘map.in’ which contains everything you need to know about the current state of the board.
Finally, you may store information between turns if you like, but only in a file with the same name as your executable but with ‘.private’ at the end. The file will be left alone between turns, so you can do whatever you want with it each turn and be assured of persistence.
The Judge
A sample bot and a judge will be available here soon (in fact if you received an e-mail about Khiva there should be a link here now).
No responses yet