- Have more units by the last round than your opponent.
- Destroy all enemy units.
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
The source code of the game is available here: https://bitbucket.org/Nixerrr/cultist-wars/src
Units, there are three types:
- Neutral unit: Technically cultists but move randomly and cannot shoot until converted.
- Cult Leader: This is your initial unit and you have only one of it.
WAIT, MOVEor CONVERTneutral and enemy units. It has 10 hp.
- Cultist: Neutral units become cultists when you convert them.
WAIT, MOVEor SHOOTenemy units. It has 10 hp.
Turns play out in the following way:
- A player performs 1 action / turn. The action can be perfomed by any of the player's units.
- A random neutral unit moves in a random direction.
- The player's turn ends.
- Units can
MOVEin four directions.
- Units can
MOVEone tile per round.
- Units cannot move on tiles with obstacles or with other units.
Shooting works in the following way:
- Damage is 7 - distance. Therefore, the maximum damage is 6 hp.
- The range of Cultists is
6. Distances are calculated using Manhattan distance.
- The path of bullets is calculated based on Bresenham's line algorithm, always drawing the line from lower Y towards higher Y.
- If an obstacle or any unit is on the bullet path between the shooter and the target, then it's hit instead of the target.
- Obstacles are indestructible.
Converting units works in the following way:
- Cult leaders can convert neutral units or enemy cultists. The enemy cult leader cannot be converted.
- A cult leader can convert units standing on neighboring tiles in the four directions (they cannot convert diagonally).
Pathfinding works in the following way:
- If a unit is told to move to a non-adjacent tile, convert a unit on a non-adjacent tile,
or told to shoot at a target beyond its range, it will move towards the target tile on the shortest
available path to the target tile. If no path is available, it'll still move along the shortest path
until it hits the obstacle.
- Have less units by the last round than your opponent.
- Your number of units drops to 0.
- You output an invalid action.
Line 1: myId:
Line 2: width, height: The width and height of the game board
Next height lines: A string y representing a row of the grid
Line 1: numOfUnits: the total number of units on the board.
Next numOfUnits lines:
- unitId: individual id of the unit.
- type: The type of the unit.
0= CULTIST, 1= CULT LEADER.
- hp: current health points of the unit
- x: x coordinate of the unit.
- y: y coordinate of the unit.
- owner: ID of the owning player.
0- Player 1, 1- Player 2, 2- neutral WAIT
Health points =
Board width is
Shooting range is
Total number of units is
Number of turns is
(Assets created by www.oryxdesignlab.com)
A higher resolution is required to access the IDE