}//SetValueFromCell public void SetCellFromValue() { int x = Value / Board.GetColumns(); PositionCell.X = (byte)x; int y = Value % Board.GetRows(); PositionCell.Y = (byte)y; } //SetCellFromValue
}//PrintAllVerticalLines private static void PrintAllGorizontLines(char sign, Point point) { int rows = Board.GetRows(); int j = point.Y; for (int i = 0; i <= rows; i++, j += 3) { point.Y = j; PrintGorizontLine(sign, point); } }//PrintAllGorizontLines
}//PrintAllGorizontLines #endregion #region Select Options /// <summary> /// Select with whom to play in a new battle. /// </summary> /// <returns>BattleType</returns> public static BattleType SelectBattleType() { PrintHeader(); PrintMenu(new string[] { "One pleyer ", "Two pleyers", "Exit " }, ConsoleColor.Gray); byte selection = 0; do { Console.WriteLine(); Console.CursorLeft = 10; Console.Write("Please select the option: "); try { selection = byte.Parse(Console.ReadLine()); } catch (Exception) { Console.CursorLeft = 10; Console.WriteLine("Incorrect input. "); continue; } Console.CursorLeft = 10; switch (selection) { case 1: if (Board.GetColumns() > 3 && Board.GetRows() > 3) { Console.WriteLine("The board is too big to play. Change the settings of the board. "); break; } else { return(BattleType.ONEPLAYER); } // Console.WriteLine("Not implemented yet. "); // Environment.Exit(0); // break; case 2: return(BattleType.TWOPLAYERS); case 3: Console.WriteLine("May be next time... Bay bay! ;-)"); Environment.Exit(0); break; default: Console.WriteLine("Invalid selection. "); break; } } while (selection != 3); return(BattleType.ONEPLAYER); }//SelectBattleType
}//PrintGorizontLine private static void PrintVerticalLine(char sign, Point point) { int rows = Board.GetRows(); Console.CursorTop = point.Y; for (int i = 0; i < rows * 3; i++) { Console.CursorLeft = point.X; Console.WriteLine(sign); } Console.WriteLine(); }//PrintVerticalLine
}//c-tor #endregion public bool IsValid() { return(PositionCell.X < Board.GetColumns() && PositionCell.Y < Board.GetRows()); }//IsValid