public void CalcValue(eSymbol _sym) { if (owner == eSymbol.None) { Value = IndependentValue * 2; foreach (WinCon child in WinCons) { child.CalcValue(this, _sym); } if (TicTacToeAI.CompPicks.Count > 0) { if (TicTacToeAI.CompPicks[0].Value == Value) { TicTacToeAI.CompPicks.Add(this); } else if (TicTacToeAI.CompPicks[0].Value < Value) { TicTacToeAI.CompPicks.Clear(); TicTacToeAI.CompPicks.Add(this); } } else { TicTacToeAI.CompPicks.Add(this); } } }
//---------------------------------Public class method------------------------------------ /* * MakeKing is a method that check if this piece is not a king already, and if not make him king */ public void MakeKing() { if (!m_IsKing) { m_IsKing = true; m_Symbol = m_Symbol == eSymbol.WhitePiece ? eSymbol.WhiteKing : eSymbol.BlackKing; } }
public void WinningMoveCheck(eSymbol _sym) { if (owner == eSymbol.None) { foreach (WinCon child in WinCons) { child.WinningMoveCheck(this, _sym); child.PriorityPickCheck(this); } } }
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)); }
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; } }
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 void SetOwner(eSymbol _sym) { Value = 0; owner = _sym; if (_sym == eSymbol.None) { button.Enabled = true; button.Text = "Select"; } else { button.Enabled = false; button.Text = owner.ToString(); } TicTacToeAI.debugger.Text = "select " + id; }
public static void Input(eSymbol _symbol, TTTRegion _region) { _region.SetOwner(_symbol); if (_region.WinChecker()) { EndScreen(_symbol); } else if (TieChecker()) { EndScreen(eSymbol.None); } else { Run(); } }
static void EndScreen(eSymbol _symbol) { foreach (TTTRegion child in Regions) { child.button.Enabled = false; } if (_symbol == eSymbol.None) { PlayerTie(); } else if (_symbol == PlayerSymbol) { PlayerWin(); } else if (_symbol == CompSymbol) { PlayerLose(); } UpdateRecord(); }
public static void Input(eSymbol _symbol, eRegion _region) { Input(_symbol, Get(_region)); }
/* * Piece constructor for initilize the piece. */ public Piece(eTeam i_Team, Coordinates i_Coordinates) { r_Team = i_Team; m_Symbol = i_Team == eTeam.Black ? eSymbol.BlackPiece : eSymbol.WhitePiece; m_CoordinatesOnBoard = i_Coordinates; }