Skip to content

Commit 922598f

Browse files
committed
Reformat, Add TODOs
1 parent 100fd6d commit 922598f

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

game_map.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def visible_units(self, cur_unit):
1616
return [unit for unit in self.active if cur_unit.can_see(unit)]
1717

1818
def _poten(self, next_pos, actors):
19-
poten = [0]*len(next_pos)
19+
poten = [0] * len(next_pos)
2020

2121
for i, pos in enumerate(next_pos):
2222
for actor in actors:
@@ -37,4 +37,3 @@ def next_pos_potential(self, cur_unit, next_pos):
3737
# total_poten = [max(a, b) for a, b in zip(mock_poten, total_poten)]
3838
total_poten = [a + b for a, b in zip(mock_poten, active_poten)]
3939
return [(score, pos) for score, pos in zip(total_poten, next_pos)]
40-

mock_object.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def score(path_point, i, pos):
2929
if dist == 0:
3030
return -math.inf
3131
else:
32-
return (i + 1) * ((1/dist - 1/cutoff) * (slope - i))
32+
return (i + 1) * ((1 / dist - 1 / cutoff) * (slope - i))
3333

3434
scores = [score(path_point, i, pos) for i, path_point in enumerate(self.points)]
3535
return min(scores)
@@ -55,7 +55,7 @@ def poten_at(self, pos):
5555
Returns:
5656
value: inf or 0
5757
"""
58-
if pos in self.points:
58+
if pos in self.points:
5959
return math.inf
6060
else:
6161
return 0

movement_cost.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import random
2+
23
import math
34

45

@@ -107,4 +108,3 @@ def cost(start, end):
107108
return h_func(start, end) * random.normalvariate(mu, sigma)
108109

109110
return cost
110-

path_finding.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ def best_potential_step(self, game_map, cur_unit):
215215

216216
def reconstruct_path(self, cur_pos, path):
217217
"""
218+
TODO
218219
Reconstructs a new path from current position,
219220
that joins the given path at some point
220221

unit.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from collections import namedtuple
2-
from potential_func import inert_repel, decided_path
1+
from potential_func import inert_repel
32
from moves import adjacent_linear, bc19_9_radius
43

4+
# TODO: Create subclasses
55
class Unit:
66

77
def __init__(self, cur_pos, poten_func, next_moves, move_cost_func, sight_range):
@@ -34,6 +34,6 @@ def can_see(self, other):
3434
def poten_at(self, point):
3535
return self.poten_func(self.cur_pos, point)
3636

37+
3738
# Sample units
3839
SCOUT = Unit(None, inert_repel, adjacent_linear(), None, bc19_9_radius())
39-

0 commit comments

Comments
 (0)