Skip to content

Commit 08478c1

Browse files
committed
Added Hex grid compass
1 parent bff2058 commit 08478c1

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

2020/compass.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,24 @@
3333
"ahead": 1,
3434
"back": -1,
3535
}
36+
37+
38+
class hexcompass:
39+
west = -1
40+
east = 1
41+
northeast = 0.5 + 1j
42+
northwest = -0.5 + 1j
43+
southeast = 0.5 - 1j
44+
southwest = -0.5 - 1j
45+
46+
all_directions = [northwest, southwest, west, northeast, southeast, east]
47+
48+
text_to_direction = {
49+
"E": east,
50+
"W": west,
51+
"NW": northwest,
52+
"NE": northeast,
53+
"SE": southeast,
54+
"SW": southwest,
55+
}
56+
direction_to_text = {text_to_direction[x]: x for x in text_to_direction}

0 commit comments

Comments
 (0)