Find Enemy Find Enemy
Moderate
English

Find the distance and directions to an enemy in a HEX-grid.

HEX-grid

HEX-Grid

Absolute Directions

Directions

Relative Directions

* if your absolute directions are "N"

Relative Directions

Input: Three arguments: your current coordinates, your current absolute directions, and enemy's coordinates.

Output: A list with relative directions and distance to the enemy.

Example:

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

Example


How it is used:

War-game design using hex-grid.

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