// Math of game theory for next move for matching game private void calculateNextMove() { if (m_ListPointForSureWinsMove.Count > 0) { m_MyNextKindMove = ePlayingStrategy.ThreeMove; } else { if (m_DictionaryMemoryOfUnrevealedKnownCardWithoutMatch.Count == 0 || (m_PairsOnTable + m_DictionaryMemoryOfUnrevealedKnownCardWithoutMatch.Count) % 2 == 1) { m_MyNextKindMove = ePlayingStrategy.TwoMove; } else if (m_DictionaryMemoryOfUnrevealedKnownCardWithoutMatch.Count >= 1 && (m_PairsOnTable + m_DictionaryMemoryOfUnrevealedKnownCardWithoutMatch.Count) % 2 == 0) { m_MyNextKindMove = ePlayingStrategy.OneMove; } else if (m_DictionaryMemoryOfUnrevealedKnownCardWithoutMatch.Count >= 2 * (m_PairsOnTable + 1) / 3 && (m_PairsOnTable + m_DictionaryMemoryOfUnrevealedKnownCardWithoutMatch.Count) % 2 == 1) { m_MyNextKindMove = ePlayingStrategy.ZeroMove; } if (m_PairsOnTable == 6 && m_DictionaryMemoryOfUnrevealedKnownCardWithoutMatch.Count == 1) { m_MyNextKindMove = ePlayingStrategy.OneMove; } } }
private void addToSureWinListKnownCard(int i_MoveSymbol, Point i_MovePoint) { m_ListPointForSureWinsMove.Add(m_DictionaryMemoryOfUnrevealedKnownCardWithoutMatch[i_MoveSymbol]); m_ListPointForSureWinsMove.Add(i_MovePoint); m_DictionaryMemoryOfUnrevealedKnownCardWithoutMatch.Remove(i_MoveSymbol); m_MyNextKindMove = ePlayingStrategy.ThreeMove; }
public void ResetMermory(int i_NumOfRow, int i_NumOfCol) { m_DictionaryMemoryOfUnrevealedKnownCardWithoutMatch = new Dictionary <int, Point>(i_NumOfRow * i_NumOfCol); m_ListPointForSureWinsMove = new List <Point>(i_NumOfRow * i_NumOfCol); m_ListPointExposedCard = new List <Point>(i_NumOfRow * i_NumOfCol); m_PairsOnTable = i_NumOfRow * i_NumOfCol; m_MyNextKindMove = ePlayingStrategy.TwoMove; m_NumOfRows = i_NumOfRow; m_NumOfCols = i_NumOfCol; }