public IEnumerable <RemoveMovePart> GetRemoveLists(Board board, RemoveMovePart priorRemoval) { IEnumerable <Hex> priorIntersections = board.RunIntersections.Select(c => c.hex).Intersect(priorRemoval.HexesToRemove); // ReSharper disable PossibleMultipleEnumeration if (priorIntersections.Any()) { // two runs will only ever share a single intersection return(GetRemoveLists().Where(rmp => rmp.ContiguousAfterRemoval(priorIntersections.First()))); } else { return(GetRemoveLists()); } }
internal static bool TryMakeRemoveList(string notation, out RemoveMovePart movePart) { MatchCollection captureMatches; captureMatches = _captureFullRegex.Matches(notation); if (captureMatches.Count == 0) { movePart = null; return(false); } List <Hex> captureList = captureMatches[0].Groups[1].Value.Replace("*", "").Split(',').Select(s => GetHex(s)).ToList(); movePart = new RemoveMovePart(captureList); return(true); }
public bool Equals(RemoveMovePart other) { return(Helpers.ScrambledEquals(_hexesToRemove, other._hexesToRemove)); }