/* Parsers */ public static string ParseDataFromBoard(AbstractBoard board) { StringBuilder text = new StringBuilder(); for (int i = 0; i != board.GetBoardSize(); i++) { // Add newline separators after the first line if (i > 0) { text.Append(Environment.NewLine); } for (int j = 0; j != board.GetBoardSize(); j++) { // Add comma separators after the first number if (j > 0) { text.Append(","); } // Add non-blank numbers if (!board.IsNumberBlank(i, j)) { text.Append(board.GetNumber(i, j)); text.Append(board.IsNumberPredefined(i, j) ? "T" : "F"); } } } return(text.ToString()); }
/* Parsers */ public static string ParseDataFromBoard(AbstractBoard board) { StringBuilder text = new StringBuilder(); for (int i = 0; i != board.GetBoardSize(); i++) { // Add newline separators after the first line if (i > 0) text.Append(Environment.NewLine); for (int j = 0; j != board.GetBoardSize(); j++) { // Add comma separators after the first number if (j > 0) text.Append(","); // Add non-blank numbers if (!board.IsNumberBlank(i, j)) { text.Append(board.GetNumber(i, j)); text.Append(board.IsNumberPredefined(i, j) ? "T" : "F"); } } } return text.ToString(); }
public bool IsNumberPredefined(int row, int column) { if (_board != null) { return(_board.IsNumberPredefined(row, column)); } else { throw new GameNotStartedException(); } }