Find the distance and relative direction to the enemy in a HEX-grid.
HEX-grid (hexagonal grid) is a coordinate system, like square grid. To find distance between two cells you don't need to find exact path from one to another, but correctly work with their coordinates. Another approach to calculate distance is to notice that all cells strict around your cell form a kind of circle and are on distance 1 from your cell, the cells around all previous cells (next "circle") are on distance 2 etc. In this mission the field from "A1" to "Z9" is used for placing you and enemy, but you may need to use coordinates "outside" this field for your calculations. Be attentive to cases when your position is on the edge of the field.
Absolute Directions. If we take any cell, the cell above it is always to the north ("N"), below - to the south ("S") etc.
Relative Directions depends of your absolute direction. if your absolute direction is "N", relative directions are the following. So all cells around specific cell form 4 "sectors": forward, right, back and left. Cells considered as present in this sectors, even if they are "outside" of our field.
But when your absolute direction is for example "SE" these "sectors" rotate and the cell in front of your cell will be to the south-east, and the north absolute direction will be in left sector.
Input: Three arguments: your current coordinates, your current absolute directions, and enemy's coordinates.
Output: A list with relative direction and distance to the enemy.
find_enemy('B2', 'S', 'B4') == ['F', 2]
How it is used:
War-game design uses hex-grid.
- 'A1' ≤ coordinates ≤ 'Z9';
- direction in ('N', 'NE', 'SE', 'S', 'SW', 'NW');
- your coordinates ≠ enemy's coordinates.
CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.
In order to install CheckiO client you'll need installed Python (version at least 3.8)
Install CheckiO Client first:
pip3 install checkio_client
Configure your tool
checkio --domain=py config --key=
Sync solutions into your local folder
(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)
checkio serv -d
Alternatevly, you can install Chrome extension or FF addon
checkio install-plugin --ff
checkio install-plugin --chromium