public Chess Move(string move) //Pe2e4 Pe7e8Q { FigureMoving fm = new FigureMoving(move); if (!moves.CanMove(fm) || board.IsCheckAfterMove(fm)) { return(this); } Board nextBoard = board.Move(fm); Chess nextChess = new Chess(nextBoard); return(nextChess); }
public Chess Move(string move) //Pe2e4. P - пешка. e2 - начальная позиция. е4 - конечная. { FigureMoving fm = new FigureMoving(move); if (!moves.CanMove(fm)) { return(this); } Board nextBoard = board.Move(fm); Chess nextChess = new Chess(nextBoard); return(nextChess); }
public Chess Move(string move) { FigureMoving fm = new FigureMoving(move); if (!moves.CanMove(fm)) { return(this); } Board nextBoard = board.Move(fm); Chess nextChess = new Chess(nextBoard); return(nextChess); }
/*******************/ //делается ход фигуры public Chess Move(string move) // Pe2e4 Pe7e8Q { FigureMoving fm = new FigureMoving(move); //figure from to promotion if (!moves.CanMove(fm)) { return(this); } if (board.IsCheckAfterMove(fm))// { return(this); } Board nextBoard = board.Move(fm); //реализация самого хода фигуры Chess nextChess = new Chess(nextBoard); //инфа о параметрах и реализации хода return(nextChess); }
public Chess Move(string move) // Pe2e4 Pe7e8Q { var fm = new FigureMoving(move); if (_moves.CanMove(fm) == false) { return(this); } if (_board.IsCheckAfterMove(fm) == true) { return(this); } Board nextBoard = _board.Move(fm); var nextChess = new Chess(nextBoard); return(nextChess); }
public Chess Move(string move) { FigureMoving fm = new FigureMoving(move); if (!moves.CanMove(fm)) { return(this); } if (!board.IsCheckAfterMove(fm)) { return(this); } Board nextBoard = board.Move(fm); return(new Chess(nextBoard)); }
public Chess Move(string move) { var fm = new FigureMoving(move); if (!Moves.CanMove(fm)) { return(this); } if (Board.IsCheckAfterMove(fm)) { return(this); } var nextBoard = Board.Move(fm); var nextChess = new Chess(nextBoard); return(nextChess); }
private bool CanEatKing(Square whereIsCheckedKing) { Moves moves = new Moves(this); foreach (FigureOnSquare fs in YieldFigures()) { FigureMoving fm = new FigureMoving(fs, whereIsCheckedKing); if (moves.CanMove(fm)) { return(true); } } return(false); }
bool CanEatKing() { Square badKing = FindBadKing(); Moves moves = new Moves(this); foreach (FigureOnSquare fs in YieldFigures()) { FigureMoving fm = new FigureMoving(fs, badKing); if (moves.CanMove(fm)) { return(true); } } return(false); }
bool CanKingGo(Square fl, Board board) { Moves moves = new Moves(board); FigureOnSquare fs = new FigureOnSquare(moveColor == Color.white ? Figure.whiteKing : Figure.blackKing, fl); foreach (Square to in Square.YieldSquares()) { FigureMoving fm = new FigureMoving(fs, to); if (moves.CanMove(fm)) { return(true); } } return(false); }
bool CanEatKing() { Square badKing = FindBadKing(); //найти короля Moves moves = new Moves(this); //найти доступные ходы foreach (FigureOnSquare fs in YieldFigures()) //перебор фигур { FigureMoving fm = new FigureMoving(fs, badKing); if (moves.CanMove(fm)) { return(true); } } return(false); }
private bool CanEatKing() { var badKing = FindBadKing(); var moves = new Moves(this); foreach (var fs in YieldFigures()) { var fm = new FigureMoving(fs, badKing); if (moves.CanMove(fm)) { return(true); } } return(false); }