public ChessBoard LoadBoard(string savedBoard) { ChessBoard board = new ChessBoard(); string[] rows = savedBoard.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); for (int row = 0; row <= board.Rows - 1; row++) { string[] columns = rows[row].Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries); columns[columns.Length - 1] = columns[0]; for (int col = 0; col < board.Columns && col < rows[row].Length; ++col) { board.Array[col, row] = LoadFigure(columns[col]); } for (int col = rows[row].Length; col < board.Columns; ++col) { board.Array[col, row] = ChessFigure._; } } return board; }
public void NewGame() { board = figures.LoadBoard(ChessBoard.DefaultBoard); }