private static void AssertEqualChanges(FieldsToChange <BimaruValue> first, FieldsToChange <BimaruValue> second) { Assert.AreEqual(first.Count(), second.Count()); // FieldsToChange contains by design no duplicate field // => Same count + first contained in second is enough for equality foreach (var c in first) { Assert.IsTrue(second.Contains(c)); } }
private IEnumerable <FieldsToChange <BimaruValue> > GetUndeterminedToWaterTrial(IGame game) { var changes = new FieldsToChange <BimaruValue>(); foreach (GridPoint p in game.Grid.AllPoints().Where(p => !game.Grid[p].IsFullyDetermined())) { changes.Add(p, BimaruValue.WATER); } if (changes.Count() > 0) { yield return(changes); } }