Esempio n. 1
0
        public int ProcessNext(ref State Current, State aState, int total)
        {
            int x = total / 8;
            int y = total % 8;
            //int y = Int32.Parse(textBox2.Text);
            int AssumeChild = 0;
            int nextMove    = 0;

            aState.GenerateToAllChild();

            Current = EnemyMatch(Current, aState, x, y);//global "Current" is the enemy's state now, update enemy state's board;

            //AddTwoLevelChild(Current,0);//Initialzie the states which self may put, the available position is also calculated

            AssumeChild = NextStep(Current);

            if (AssumeChild != 0)
            {
                nextMove = Current.AvailablePosition[0][AssumeChild - 1] * 8 + Current.AvailablePosition[1][AssumeChild - 1];
            }
            else
            {
                MessageBox.Show("I have no way to go");
                nextMove = 64;
            }

            Current.DisposeAllButOne(AssumeChild);
            Current = Current.Child[AssumeChild];//update the current child;
            return(nextMove);
        }
Esempio n. 2
0
        public int ProcessNext(ref State Current, State aState, int total)
        {
            int x = total / 8;
            int y = total % 8;
            //int y = Int32.Parse(textBox2.Text);
            int AssumeChild = 0;
            int nextMove = 0;

            aState.GenerateToAllChild();

            Current=EnemyMatch(Current,aState,x,y);//global "Current" is the enemy's state now, update enemy state's board;

            //AddTwoLevelChild(Current,0);//Initialzie the states which self may put, the available position is also calculated

            AssumeChild = NextStep(Current);

            if (AssumeChild != 0)
            {
                nextMove = Current.AvailablePosition[0][AssumeChild - 1] * 8 + Current.AvailablePosition[1][AssumeChild - 1];
            }
            else
            {
                MessageBox.Show("I have no way to go");
                nextMove = 64;
            }

            Current.DisposeAllButOne(AssumeChild);
            Current = Current.Child[AssumeChild];//update the current child;
            return nextMove;
        }