public int ForceStaleMate(List <int> LosingSelection) { List <int> StaleMateList = FlagsThatCanBeRemove.Except(LosingSelection).ToList(); if (StaleMateList.Count > 0) { StaleMateList.Sort(); return(StaleMateList[StaleMateList.Count - 1]); } else { //will lose anyway no matter choose what //only hope the opponent make a mistake in their turn Random random = new Random(); return(FlagsThatCanBeRemove[random.Next(0, FlagsThatCanBeRemove.Count)]); } }
public int PulledFlagDecisionConsecutive(int remainingFlags) { int pulledFlag = 0; var remainingLosingStateFlagsNum = LosingStateFlagsNum.Where(x => x < remainingFlags).ToList(); foreach (int item in remainingLosingStateFlagsNum) { int num = remainingFlags - item; if (FlagsThatCanBeRemove.Contains(num)) { pulledFlag = num; break; } } if (pulledFlag == 0) { Random random = new Random(); int index = random.Next(FlagsThatCanBeRemove.Count); pulledFlag = FlagsThatCanBeRemove[index]; } return(pulledFlag); }