public static void ComputerInput()
            {
                WinningMove       = null;
                CompPicks         = new List <TTTRegion>();
                CompPicksPriority = new List <TTTRegion>();
                WinningMoveCheck();
                if (CompPicksPriority.Count == 0)
                {
                    switch (CompDifficulity)
                    {
                    case 0:
                        ComputerInputRandom();
                        break;

                    case 1:
                        ComputerInputCalculated();
                        break;

                    default:
                        ComputerInputRandom();
                        break;
                    }
                }
                CompFinalPick();
            }
예제 #2
0
 public WinCon(TTTRegion t1, TTTRegion t2, TTTRegion t3)
 {
     T1 = t1;
     T2 = t2;
     T3 = t3;
     T1.WinCons.Add(this);
     T2.WinCons.Add(this);
     T3.WinCons.Add(this);
 }
예제 #3
0
            public void PriorityPickCheck(TTTRegion T0)
            {
                TTTRegion t1p = null;
                TTTRegion t2p = null;

                GetOther2(T0, ref t1p, ref t2p);
                if (t1p.owner == t2p.owner && t1p.owner != eSymbol.None)
                {
                    TicTacToeAI.CompPicksPriority.Add(T0);
                }
            }
예제 #4
0
            public double CalcValue(TTTRegion T0, eSymbol _sym)
            {
                TTTRegion t1p = null;
                TTTRegion t2p = null;

                GetOther2(T0, ref t1p, ref t2p);
                if (T1.owner != T2.owner && T1.owner != eSymbol.None && T2.owner != eSymbol.None)
                {
                    return(0);
                }
                return(T0.Value += addingValue(t1p, _sym) + addingValue(t2p, _sym));
            }
예제 #5
0
            public void WinningMoveCheck(TTTRegion T0, eSymbol _sym)
            {
                TTTRegion t1p = null;
                TTTRegion t2p = null;

                GetOther2(T0, ref t1p, ref t2p);

                if (t1p.owner == t2p.owner && t1p.owner == _sym && t1p.owner != eSymbol.None)
                {
                    TicTacToeAI.WinningMove = T0;
                }
            }
 static void SetupRegions(Button a1, Button a2, Button a3,
                          Button b1, Button b2, Button b3,
                          Button c1, Button c2, Button c3)
 {
     A1 = new TTTRegion(a1, 2, "A1");
     A2 = new TTTRegion(a2, 1, "A2");
     A3 = new TTTRegion(a3, 2, "A3");
     B1 = new TTTRegion(b1, 1, "B1");
     B2 = new TTTRegion(b2, 1.5, "B2");
     B3 = new TTTRegion(b3, 1, "B3");
     C1 = new TTTRegion(c1, 2, "C1");
     C2 = new TTTRegion(c2, 1, "C2");
     C3 = new TTTRegion(c3, 2, "C3");
 }
예제 #7
0
 double addingValue(TTTRegion T0, eSymbol _sym)
 {
     if (T0.owner == eSymbol.None)
     {
         return(T0.IndependentValue);
     }
     else if (T0.owner == _sym)
     {
         return(T0.IndependentValue * 2);
     }
     else
     {
         return(T0.IndependentValue * -1);
     }
 }
            public static void Input(eSymbol _symbol, TTTRegion _region)
            {
                _region.SetOwner(_symbol);

                if (_region.WinChecker())
                {
                    EndScreen(_symbol);
                }
                else if (TieChecker())
                {
                    EndScreen(eSymbol.None);
                }
                else
                {
                    Run();
                }
            }
예제 #9
0
 void GetOther2(TTTRegion T0, ref TTTRegion t1p, ref TTTRegion t2p)
 {
     if (T0 == T1)
     {
         t1p = T2;
         t2p = T3;
     }
     else if (T0 == T2)
     {
         t1p = T1;
         t2p = T3;
     }
     else if (T0 == T3)
     {
         t1p = T2;
         t2p = T1;
     }
 }