def test_move_players(self): tile = get_tile(10) tile.players[Port.C] = "blue" tile.east = get_tile(12) tile._move_players(Direction.EAST) self.assertIsNone(tile.players[Port.C]) self.assertEqual(tile.east.players[Port.B], "blue")
def setUp(self): self.board = Board() self.board.add_tile(get_tile(0), x=5, y=5, rotation=0) self.player = Player() self.rule = FirstMoveCheckNeighbors()
def setUp(self): self.board = Board() self.board.add_tile(get_tile(0), x=0, y=0, rotation=0) self.player = Player() self.rule = UnoccupiedSpace()
def dummy_placement(x=0, y=0, index=0): return IntermediatePlacement(get_tile(index), Rotation.NONE.value, Color.WHITE.value, x, y)
def test_invalid(self): placement = InitialPlacement(get_tile(0), Rotation.NONE.value, Color.WHITE.value, 0, 0, Port.C.value) is_valid, msg = self.rule.is_valid(placement, self.board, self.player) self.assertFalse(is_valid) self.assertEqual(msg, FirstMoveOutsidePort.ERROR_MSG)
def test_valid(self): placement = InitialPlacement(get_tile(0), Rotation.NONE.value, Color.WHITE.value, 0, 0, Port.A.value) is_valid, _ = self.rule.is_valid(placement, self.board, self.player) self.assertTrue(is_valid)
def test_immediate_loss_tile_raises_error(self): with self.assertRaises(InvalidBoardError): Board(tiles={get_tile(22): (0, 0)})