Adds find_file method
This commit is contained in:
parent
5d1c96407b
commit
3fd1010559
|
@ -25,7 +25,21 @@ class Player(object):
|
|||
def __init__(self):
|
||||
pass
|
||||
|
||||
def find_file(self, name):
|
||||
"""
|
||||
Returns the correct path for finding an asset file (like neural network
|
||||
weights file) in the directory where the Ai class is.
|
||||
|
||||
:name the name of the file to look for
|
||||
"""
|
||||
return self.__module__.replace('.', '/') + '/' + name
|
||||
|
||||
|
||||
def next_position_and_direction(self, current_position, id, map):
|
||||
"""
|
||||
Computes the direction of the player, and computes its next position
|
||||
depending on the current position.
|
||||
"""
|
||||
direction = self.action(map, id)
|
||||
if direction == Direction.UP:
|
||||
return ((current_position[0] - 1, current_position[1]), direction)
|
||||
|
|
Loading…
Reference in New Issue