def testZombiePickMoves1(self): room = Room([[]], (0, 0)) example = [] for x in range(5): column = [] for y in range(5): if x == 0: column.append(WallTile((x, y))) else: t = Tile((x, y)) t.room = room column.append(Tile((x, y))) example.append(column) example[1][1].add_character(Player(1, 0, "reggie")) gost = AdversaryDriver("Boo", "zombie", 2, []) gost.update_state(SimpleState(example), (2, 2)) moves = gost.pick_moves() self.assertEqual([(2, 1)], moves)
def testZombieRequestMove1(self): room = Room([[]], (0, 0)) example = [] for x in range(5): column = [] for y in range(5): if x == 0: column.append(WallTile((x, y))) else: t = Tile((x, y)) t.room = room column.append(Tile((x, y))) example.append(column) # example[1][1].add_character(Player(1, 0, "reggie")) gost = AdversaryDriver("Boo", "zombie", 2, []) gost.update_state(SimpleState(example), (2, 2)) moves = [] moves.append(gost.request_move()) moves.append(gost.request_move()) moves.append(gost.request_move()) moves.append(gost.request_move()) moves.append(gost.request_move()) expected = [(3, 2), (2, 1), (2, 3), (1, 2), (2, 2)] for ex in expected: self.assertTrue(ex in moves) room.addDoor(example[2][1], Hallway((0, 0), (2, 1), [])) example[2][1].set_room(room) moves = [] state = SimpleState(example) gost.update_state(state, (2, 3)) state.get_tile_at((2, 1)).set_room(room) gost.update_state(state, (2, 2)) moves.append(gost.request_move()) moves.append(gost.request_move()) moves.append(gost.request_move()) moves.append(gost.request_move()) expected = [(3, 2), (2, 3), (1, 2), (2, 2)] for ex in expected: self.assertTrue(ex in moves)