def rook_moves(pos: Position, game: Game) -> List[Move]: """Return list of <game.turn> rook moves. rook moves = positions_under_threat """ moves = [ Move(pos, pos_threat) for pos_threat in PositionsUnderThreat.positions_under_rook_threat( pos, game.turn, game.board) ] return moves
def test_positions_under_rook_threat(self): """Test of positions_under_rook_threat() method.""" assert sorted( PositionsUnderThreat.positions_under_rook_threat( Position(3, 7), Colour.WHITE, self.board)) == [ Position(0, 7), Position(1, 7), Position(2, 7), Position(3, 5), Position(3, 6), Position(4, 7), Position(5, 7), ]