Skip to content

Commit

Permalink
Merge branch 'pep8' of https://github.com/joshuablake/aimmo into josh…
Browse files Browse the repository at this point in the history
…uablake-pep8

Conflicts:
	aimmo-game-worker/simulation/world_map.py
	aimmo-game-worker/tests/simulation/test_world_map.py
	aimmo-game/simulation/avatar/fog_of_war.py
	example_project/example_project/settings.py
  • Loading branch information
Spycho committed Nov 29, 2016
1 parent b18de2a commit 4bf48f8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions aimmo-game/simulation/map_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,30 +86,30 @@ def manhattan_distance_to_destination_cell(this_branch):
return None


def get_random_edge_index(map, rng=random):
num_row_cells = map.num_rows - 2
num_col_cells = map.num_cols - 2
def get_random_edge_index(world_map, rng=random):
num_row_cells = world_map.num_rows - 2
num_col_cells = world_map.num_cols - 2
num_edge_cells = 2*num_row_cells + 2*num_col_cells
random_cell = rng.randint(0, num_edge_cells-1)

if 0 <= random_cell < num_col_cells:
# random non-corner cell on the first row
return random_cell + 1 + map.min_x(), map.min_y()
return random_cell + 1 + world_map.min_x(), world_map.min_y()
random_cell -= num_col_cells

if 0 <= random_cell < num_col_cells:
# random non-corner cell on the last row
return random_cell + 1 + map.min_x(), map.max_y()
return random_cell + 1 + world_map.min_x(), world_map.max_y()
random_cell -= num_col_cells

if 0 <= random_cell < num_row_cells:
# random non-corner cell on the first column
return map.min_x(), map.min_y() + random_cell + 1
return world_map.min_x(), world_map.min_y() + random_cell + 1
random_cell -= num_row_cells

assert 0 <= random_cell < num_row_cells
# random non-corner cell on the last column
return map.max_x(), map.min_y() + random_cell + 1
return world_map.max_x(), world_map.min_y() + random_cell + 1


def get_adjacent_habitable_cells(cell, world_map):
Expand Down

0 comments on commit 4bf48f8

Please sign in to comment.