コード例 #1
0
ファイル: CellRun.cs プロジェクト: vfridell/Gipf
        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());
            }
        }
コード例 #2
0
ファイル: NotationParser.cs プロジェクト: vfridell/Gipf
        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);
        }
コード例 #3
0
 public bool Equals(RemoveMovePart other)
 {
     return(Helpers.ScrambledEquals(_hexesToRemove, other._hexesToRemove));
 }