fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. namespace Balloons_Pops_Game_Variant_Four
  5. {
  6. class BallonsPopsTest
  7. {
  8. static void SetConsoleSettings()
  9. {
  10. Console.Title = "Balloons Pops";
  11. Console.ResetColor();
  12. Console.Clear();
  13. }
  14.  
  15. static void Main(string[] args)
  16. {
  17. SetConsoleSettings();
  18.  
  19. GameInitialization game = new GameInitialization();
  20. game.Start();
  21.  
  22. string gameBoardPattern = @"^[0-4] [0-9]$";
  23. Regex regex = new Regex(gameBoardPattern);
  24.  
  25. while (true)
  26. {
  27. string comand = Console.ReadLine();
  28.  
  29. switch (comand)
  30. {
  31. case "top": ScoreboardInitialization.Plot();
  32. ConfigurateEmptyLinesOfMessages.Write(
  33. GameMessages.enterRowAndColumn);
  34. break;
  35. case "exit": ConfigurateEmptyLinesOfMessages.WriteWithEmptyLine(
  36. GameMessages.goodbyeMessage);
  37. return;
  38. case "restart":
  39. game = new GameInitialization();
  40. game.Start();
  41. break;
  42. default:
  43. if (regex.Match(comand).Success)
  44. {
  45. Move move = new Move();
  46. move.Row = Convert.ToInt32(comand.Substring(0, 1));
  47. move.Col = Convert.ToInt32(comand.Substring(2, 1));
  48.  
  49. if (game.GameBoard.IsMoveAllowed(move))
  50. {
  51. game.Player.Score++;
  52. game.GameBoard.Refresh(move);
  53. if (game.GameBoard.IsEmpty())
  54. {
  55. ConfigurateEmptyLinesOfMessages.WriteWithEmptyLine(string.Format
  56. (GameMessages.congratulationsMessage, game.Player.Score));
  57. if (ScoreboardInitialization.ShouldBeRefreshed(game.Player))
  58. {
  59. ConfigurateEmptyLinesOfMessages.Write(
  60. GameMessages.enterNameForTopScoreboard);
  61. game.Player.Name = Console.ReadLine();
  62. ScoreboardInitialization.Refresh(game.Player);
  63. ScoreboardInitialization.Plot();
  64. }
  65. game = new GameInitialization();
  66. game.Start();
  67. }
  68. else
  69. {
  70. game.GameBoard.GeneratePlot();
  71. ConfigurateEmptyLinesOfMessages.Write(
  72. GameMessages.enterRowAndColumn);
  73. }
  74. }
  75. else
  76. {
  77. ConfigurateEmptyLinesOfMessages.WriteWithEmptyLine(
  78. GameMessages.illegalMove);
  79. ConfigurateEmptyLinesOfMessages.Write(
  80. GameMessages.enterRowAndColumn);
  81. }
  82. }
  83. else
  84. {
  85. ConfigurateEmptyLinesOfMessages.WriteWithEmptyLine(
  86. GameMessages.invalidMoveOrCommand);
  87. ConfigurateEmptyLinesOfMessages.Write(
  88. GameMessages.enterRowAndColumn);
  89. }
  90. break;
  91. }
  92. }
  93. }
  94. }
  95. }
  96.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(19,13): error CS0246: The type or namespace name `GameInitialization' could not be found. Are you missing a using directive or an assembly reference?
prog.cs(45,29): error CS0246: The type or namespace name `Move' could not be found. Are you missing a using directive or an assembly reference?
Compilation failed: 2 error(s), 0 warnings
stdout
Standard output is empty