Skip to content

Commit

Permalink
v4 added function
Browse files Browse the repository at this point in the history
  • Loading branch information
erfanfi79 committed Jan 21, 2020
1 parent 64c9430 commit c0e965f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 9 additions & 1 deletion AI.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
from random import Random


class AI:

def pick(self, world):
self.r = Random()
print("pick")
world.choose_deck([1, 2, 3, 4])
print(world.get_shortest_path_to_cell(player_id=world.get_my_id(), row=10, col=10))
print(world.put_unit(type_id=1, path=world.map.paths[self.r.randint(1, 4)]))
if len(world.player.units) > 0:
print(world.player.units[0].cell)

def turn(self, world):
print("turn")
if len(world.player.units) > 0:
print(world.player.units[0].cell)
2 changes: 0 additions & 2 deletions world.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,6 @@ def get_shortest_path_to_cell(self, player_id, cell=None, row=None, col=None):
cell = self.map.get_cell(row, col)

shortest_path_to_cell = self.shortest_path.get(player_id)
print(shortest_path_to_cell)

if shortest_path_to_cell[cell.row][cell.col] == -1:
return None

Expand Down

0 comments on commit c0e965f

Please sign in to comment.