def main(): configs = ConfigsLoader("config.json") world = World(configs.Get("mapFilePath"), configs.Get("roomFilePath")) player = Player((1, 6)) action_handler = ActionHandler(world, player) room = world.GetRoom(player.GetLocation()) print(room.Visit()) while True: try: action = ActionParser.Parse(input().strip()) except ParseException: print("Invalid action.") action = None print() action_handler.Handle(action, room) room = world.GetRoom(player.GetLocation())
def base_test_move(self, starting_location: typing.Tuple[int, int], ending_location: typing.Tuple[int, int], direction: MoveDirection): player = Player(starting_location) player.Move(direction) self.assertEqual(ending_location, player.GetLocation())
def test_get_initial_default_location(self): initial_default_location = (0, 0) player = Player() self.assertEqual(initial_default_location, player.GetLocation())
def test_get_initial_defined_location(self): location = (7, 19) player = Player(location) self.assertEqual(location, player.GetLocation())