static void PlayerPlay() { Console.WriteLine(); Console.WriteLine("Would you like to break the 'right', 'left', 'top', or 'bottom' boundry?"); string input = Console.ReadLine(); // The gameboard is immutable. This means that every new turn, we instantiate // a new gameboard from the old one. That is a safety check on myself and prevents weird // things from happening. switch (input.ToLower()) { case "right": chocolateBar.TrimRight(); break; case "left": chocolateBar.TrimLeft(); break; case "top": chocolateBar.TrimTop(); break; case "bottom": chocolateBar.TrimBottom(); break; default: Console.WriteLine("I'm sorry, I did not understand that."); PlayerPlay(); break; } }
private bool TryBreakBottom() { if (!chocolateBar.rowContainsSpoiled(chocolateBar.getRowCount() - 1)) { chocolateBar.TrimBottom(); Console.WriteLine("The AI broke the bottom."); return(true); } return(false); }