Example #1
0
        public static (bool, Move) Locate(this Move move, IPosition pos)
        {
            // force position to contain the latest moves for the position moves to be searched in
            var moveList = pos.GenerateMoves();

            var element = moveList.GetMove(move.GetFromSquare(), move.GetToSquare());

            return(element == null ? (false, EmptyMove) : (true, element));
        }
Example #2
0
        public Move MoveFromUci(IPosition pos, string uciMove)
        {
            var moveList = pos.GenerateMoves();

            foreach (var move in moveList.Get())
            {
                if (uciMove.Equals(move.Move.ToString(), StringComparison.InvariantCultureIgnoreCase))
                {
                    return(move);
                }
            }

            return(Move.EmptyMove);
        }
Example #3
0
 private char GetCheckChar()
 => _pos.GenerateMoves().Any() ? '+' : '#';
Example #4
0
 private static char GetCheckChar(this IPosition pos) => pos.GenerateMoves().Any() ? '+' : '#';