public Cell(string cellStr) { Square = new Square(cellStr.Substring(1)); Piece = new Piece(cellStr[0]); }
private void AddTakeMoves(FindTakeMovesParameter takeMoveInfo, List<string> moves, Cell cell, string path) { var takeMoves = GetSingleTakeMoves(takeMoveInfo, cell); if (takeMoves.Count == 0 && !string.IsNullOrEmpty(path)) { moves.Add(path); return; } if (string.IsNullOrEmpty(path)) path = cell.ToString(); foreach (var takeMove in takeMoves) { takeMoveInfo.AddAlreadyTaken(takeMove.SquareTaken); var newPieceType = (cell.Type == PieceType.Simple && IsTurnToKingHorizontal(_position.CurrentColor, takeMove.SquareToMove.Y) ? PieceType.King : cell.Type); var newPiece = new Piece(newPieceType, cell.Color); var newCell = new Cell(takeMove.SquareToMove, newPiece); AddTakeMoves(takeMoveInfo, moves, newCell, path + "-" + takeMove.SquareToMove); takeMoveInfo.RemoveLastAlreadyTaken(); } }