# Find Enemy

Moderate
English UK

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.

Example:

`find_enemy('B2', 'S', 'B4') == ['F', 2]`

How it is used:

War-game design uses hex-grid.

Preconditions:

• 'A1' ≤ coordinates ≤ 'Z9';
• direction in ('N', 'NE', 'SE', 'S', 'SW', 'NW');
• your coordinates ≠ enemy's coordinates.

Settings
Code:
Other:
Invalid hot key. Each hot key should be unique and valid
Hot keys:
•  to Run Code: to Check Solution: to Stop:
CheckiO Extensions

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`

`checkio --domain=py config --key=`

Sync solutions into your local folder

`checkio sync`

(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`
`checkio install-plugin --ff`
`checkio install-plugin --chromium`

Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.

Pair Programming (Beta-version)

Welcome to Pair Programming! Engage in real-time collaboration on coding projects by starting a session and sharing the provided unique URL with friends or colleagues. This feature is perfect for joint project development, debugging, or learning new skills together. Simply click 'Start Session' to begin your collaborative coding journey!

Waiting for Pair Programming to start...

You are trying to join a pair programming session that has not started yet.

Please wait for the session creator to join.

Waiting for Pair Programming to reconnect...

It looks like the creator of the pair programming session closed the editor window.

It might happen accidentally, so that you can wait for reconnection.