Esempio n. 1
0
        public void PrintCommand(int CommandNumber)
        {
            if (CommandNumber < 9)
            {
                int LargeX = CurrentBoard % 3;
                int LargeY = CurrentBoard / 3;
                int SmallX = CommandNumber % 3;
                int SmallY = CommandNumber / 3;

                int BoardSize = (3 * buttonSize) + (2 * buttonPadding) + boardPadding;
                int PointX    = (SmallX + 1) * buttonPadding + SmallX * buttonSize + LargeX * BoardSize;
                int PointY    = (SmallY + 1) * buttonPadding + SmallY * buttonSize + LargeY * BoardSize;

                Point Temp = new Point(PointX, PointY);

                if (TurnID == 0)
                {
                    PlacedX[PointerX] = Temp;
                    PointerX         += 1;
                    TurnID++;
                }
                else if (TurnID == 1)
                {
                    PlacedO[PointerO] = Temp;
                    PointerO         += 1;
                    TurnID--;
                }
                CurrentBoard = CommandNumber;
            }
            else
            {
                CurrentBoard = (CommandNumber - 9);
            }
            BoardBox.Invalidate();
        }
Esempio n. 2
0
        public void SetupBoard()
        {
            PointerX        = 0;
            PointerO        = 0;
            CurrentBoard    = -1;
            TurnID          = 0;
            SelectFlag.Text = "Choose a board";
            UltSim.Start();
            BoardBox.Invalidate();

            if (PlayerMode == 2)
            {
                CC.StartRound(0, 1);
                CC.StartRound(1, 2);
                int Temporary = 0;
                while (Temporary < 150)
                {
                    if (!MUI.CurrentSim.Finished())
                    {
                        MUI.AiMove();
                    }
                    else
                    {
                        break;
                    }

                    Temporary++;
                }
            }
        }
Esempio n. 3
0
        private void SwapBoard(int Board)
        {
            if (!UltSim.Finished())
            {
                if (PlayerMode == 0 || PlayerMode == 1)
                {
                    object[] Move     = new object[1];
                    object[] TempMove = new object[1];
                    TempMove[0] = (double)(Board + 9);
                    Move[0]     = TempMove;

                    UltSim.SetCommand(Move);
                    if (UltSim.ReturnChosenCommand() == Board + 9)
                    {
                        CurrentBoard    = Board;
                        SelectFlag.Text = "";
                        BoardBox.Invalidate();
                    }
                }
            }
        }