コード例 #1
0
        private static IEnumerable <ProjectedMove> AllProjectedMoves(StackTypeMeasurementSet initial,
                                                                     BitMeasurement blocks, bool isRed)
        {
            foreach (var loc in State.AllBoardLocations)
            {
                if (!initial.AnyPiece(loc))
                {
                    continue;
                }

                foreach (var move in Movement.AllMoves)
                {
                    var one   = initial.AnyOneStack(loc);
                    var two   = initial.AnyTwoStack(loc);
                    var three = initial.AnyThreeStack(loc);
                    var four  = initial.AnyFourStack(loc);
                    var five  = initial.AnyFiveStack(loc);

                    if (one || two || three || four || five)
                    {
                        foreach (var pm in MoveGenerator(loc, 1, move, blocks, isRed))
                        {
                            yield return(pm);
                        }
                    }

                    if (two || three || four || five)
                    {
                        foreach (var pm in MoveGenerator(loc, 2, move, blocks, isRed))
                        {
                            yield return(pm);
                        }
                    }

                    if (three || four || five)
                    {
                        foreach (var pm in MoveGenerator(loc, 3, move, blocks, isRed))
                        {
                            yield return(pm);
                        }
                    }

                    if (four || five)
                    {
                        foreach (var pm in MoveGenerator(loc, 4, move, blocks, isRed))
                        {
                            yield return(pm);
                        }
                    }

                    if (five)
                    {
                        foreach (var pm in MoveGenerator(loc, 5, move, blocks, isRed))
                        {
                            yield return(pm);
                        }
                    }
                }
            }
        }
コード例 #2
0
        private static StackTypeMeasurementSet Project(StackTypeMeasurementSet initial, BitMeasurement blocks, bool isRed)
        {
            var next = initial;

            foreach (var pm in AllProjectedMoves(initial, blocks, isRed))
            {
                //Returned moves start from a self-owned piece and don't pass over any blockades -- that's all we know.
                //Options are move, merge, split-move, split-merge.
                if (initial.AnyPiece(pm.To))
                {
                }
            }

            return(next);
        }