/// <summary> /// Attempts to cut 2 locations from the current board, mirrored about a randomly chosen axis. /// </summary> /// <param name="Stream">An existing <see cref="Random"/> number generator</param> /// <returns>If the result has a unique solution, then the new <see cref="Board"/>. Otherwise, the original</returns> public Board Pair(Random Stream) { var result = new Board(_parent); var Filled = _parent.Find.FilledLocations().ToList(); if (Filled.Count > 0) { Location loc = new Location(Filled[Stream.Next(Filled.Count)]); result[loc] = 0; if (Stream.Next(2) == 1) { result[loc.FlipHorizontal()] = 0; } else { result[loc.FlipVertical()] = 0; } if (result.ExistsUniqueSolution()) { return(result); } } return(_parent); }
/// <summary> /// Attempts to cut 4 locations from the current board, mirrored about both horizontal and vertical axes. /// </summary> /// <param name="Stream">An existing <see cref="Random"/> number generator</param> /// <returns>If the result has a unique solution, then the new <see cref="Board"/>. Otherwise, the original</returns> public Board Quad(Random Stream) { var result = new Board(_parent); var Filled = _parent.Find.FilledLocations().ToList(); if (Filled.Count > 0) { Location loc = new Location(Filled[Stream.Next(Filled.Count)]); result[loc] = 0; result[loc.FlipHorizontal()] = 0; result[loc.FlipVertical()] = 0; result[loc.FlipHorizontal().FlipVertical()] = 0; if (result.ExistsUniqueSolution()) return result; } return _parent; }