//set up collection of coords to check for isletter and numbers on the appropriate spot and no extras public static ShipDirection PlayerShipDirection() { while (true) { string direction = UserIO.GetStringFromUser("Please choose direction[ (U)p, (D)own, (L)eft, (R)ight: "); switch (direction.ToUpper()) { case "UP": case "U": return(ShipDirection.Up); case "DOWN": case "D": return(ShipDirection.Down); case "LEFT": case "L": return(ShipDirection.Left); case "RIGHT": case "R": return(ShipDirection.Right); } } }
public static bool PlayAgain() { do { string again = UserIO.GetStringFromUser("Would you like to start a new game?\n(Y)es / (N)o:"); again = again.ToUpper(); if (char.IsLetter(again[0]) == true) { if (again.StartsWith("Y") == true) { return(true); } if (again.StartsWith("N") == true) { return(false); } } } while (true); }