-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
12 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
import logging | ||
import traceback | ||
from simulation.action import WaitAction | ||
|
||
LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
class AvatarRunner(object): | ||
def __init__(self, avatar=None): | ||
if avatar is None: | ||
from avatar import Avatar | ||
self.avatar = Avatar() | ||
else: | ||
self.avatar = avatar | ||
self.avatar = avatar | ||
|
||
def handle_turn(self, world_map, avatar_state): | ||
def process_avatar_turn(self, world_map, avatar_state): | ||
try: | ||
return self.avatar.handle_turn(avatar_state, world_map) | ||
if self.avatar is None: | ||
from avatar import Avatar | ||
self.avatar = Avatar() | ||
return self.avatar.handle_turn(world_map, avatar_state) | ||
|
||
except Exception as e: | ||
LOGGER.error("Code failed to run") | ||
LOGGER.error(e) | ||
LOGGER.error(traceback.print_exc()) | ||
action = WaitAction() | ||
|
||
return action |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters