public override string Command(Bomb bomb, string command) { foreach (var word in command.Split(' ')) { if (InternalFunctions.IsPhoneticLetter(word)) { Letter = word; } } if (string.IsNullOrEmpty(Letter)) { return("Cannot solve without the letter."); } return(Solve(bomb)); }
public override string Command(Bomb bomb, string command) { foreach (var word in command.Split(' ')) { if (InternalFunctions.IsNumber(word)) { Numbers.Add(InternalFunctions.GetNumber(word)); } if (InternalFunctions.IsPhoneticLetter(word)) { Letters.Add(InternalFunctions.GetLetterFromPhoneticLetter(word)); } } if (Letters.Count != 5) { return("Not enought phonetic letters."); } return(Solve(bomb)); }
public override string Command(Bomb bomb, string command) { foreach (var word in command.Split(' ')) { if (InternalFunctions.IsColor(word)) { StageColor = word; } if (InternalFunctions.IsPhoneticLetter(word)) { if (string.IsNullOrWhiteSpace(FirstLetter)) { FirstLetter = word; continue; } if (string.IsNullOrWhiteSpace(SecondLetter)) { SecondLetter = word; continue; } if (string.IsNullOrWhiteSpace(ThirdLetter)) { ThirdLetter = word; continue; } if (string.IsNullOrWhiteSpace(FourthLetter)) { FourthLetter = word; continue; } } } if (!string.IsNullOrWhiteSpace(StageColor) && !string.IsNullOrWhiteSpace(FirstLetter) && !string.IsNullOrWhiteSpace(SecondLetter) && !string.IsNullOrWhiteSpace(ThirdLetter) && !string.IsNullOrWhiteSpace(FourthLetter)) { return(Solve(bomb)); } else { return("Cannot resolve, try again."); } }