Example #1
0
        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());
            }
        }
Example #2
0
        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);
        }
Example #3
0
 public bool Equals(RemoveMovePart other)
 {
     return(Helpers.ScrambledEquals(_hexesToRemove, other._hexesToRemove));
 }