public int Evaluate(List <int[]> slotColumns, int spinNumber, Paytable pPayTable, List <int> wildList, int iBetAmount, List <int> iExtraWilds = null) { m_SlotColumns = slotColumns; m_PayTable = pPayTable; m_WildList = wildList; m_iExtraWilds = iExtraWilds; PaylineNode node = m_RootNode; m_WinLines.Clear(); m_SearchSymbols.Clear(); //m_PayoutLines.Clear(); for (int i = 0; i < m_SlotColumns[0].Length; i++) { if (!m_SearchSymbols.Contains(m_SlotColumns[0][i])) { m_SearchSymbols.Add(m_SlotColumns[0][i]); } } for (int i = 0; i < m_SlotColumns[0].Length; i++) { Search(node.getChild(node.getChildIndex(i)), m_SlotColumns[0][i], false, isWildSymbol(i, 0) /*m_SlotColumns[0][0] == 0 ? true : false*/); } //Search(node.getChild(node.getChildIndex(0)), m_SlotColumns[0][0], false, isWildSymbol(0,0)/*m_SlotColumns[0][0] == 0 ? true : false*/); //Search(node.getChild(node.getChildIndex(1)), m_SlotColumns[0][1], false, isWildSymbol(1,0)/*m_SlotColumns[0][1] == 0? true : false*/); //Search(node.getChild(node.getChildIndex(2)), m_SlotColumns[0][2], false, isWildSymbol(2,0)/*m_SlotColumns[0][2] == 0 ? true : false*/); for (int i = 0; i < m_WinLines.Count; i++) { m_WinLines[i].applyBetLevel(iBetAmount); } //VerifyWinLines(); int iTotalWinAmount = 0; for (int i = 0; i < m_WinLines.Count; i++) { iTotalWinAmount += m_WinLines[i].getWinAmount(); } return(iTotalWinAmount); }
public void Search(PaylineNode node, int iSymbolID, bool bEnd, bool bStartWild) { PaylineNode child = null; for (int i = 0; i < node.NumberOfChilds; i++) { child = node.getChild(i); //if (getSymbolId(node.Row, node.col) != 0 && bStartWild) if (!isWildSymbol(node.Row, node.col) && bStartWild) { iSymbolID = getSymbolId(node.Row, node.col); bStartWild = false; } //if (getSymbolId(child.Row, child.col) == iSymbolID || getSymbolId(child.Row, child.col) == 0 || bStartWild) if (getSymbolId(child.Row, child.col) == iSymbolID || isWildSymbol(child.Row, child.col) || bStartWild) { bEnd = false; //wild case // if (getSymbolId(node.Row, node.col) == 0) iSymbolID = getSymbolId(child.Row, child.col); Search(child, iSymbolID, bEnd, bStartWild); } else { bEnd = true; } if (m_PayTable.IsPaySymbol(iSymbolID) /*node.col >= 2*/ && !node.IsRoot && bEnd && node.col != m_SlotColumns.Count) { int payline = child.getLastChild().PayLineNum; if (/*(node.col+1) >= m_PayTable.getMinCount(iSymbolID)*/ m_PayTable.getWinAmount(iSymbolID, node.col + 1) != 0) { m_WinLines.Add(new WinLine(payline, iSymbolID, node.col + 1, m_PayTable.getWinAmount(iSymbolID, node.col + 1), m_WinningLines[payline])); // m_PayoutLines.Add(" Payline# " + payline + " last column: " + node.col + " row: " + node.Row + "\n"); } PaylineNode subChild = child.getLastChild(); if (subChild.NumberOfChilds > 0) //if there are other winlines that's a child of the winning winline then add payouts to all the children { for (int j = 0; j < subChild.NumberOfChilds; j++) { PaylineNode eachChild = subChild.getChild(j); int subPayLine = eachChild.PayLineNum; if (subPayLine != payline && m_PayTable.getWinAmount(iSymbolID, node.col + 1) != 0 /*(node.col+1)>= m_PayTable.getMinCount(iSymbolID)*/) { m_WinLines.Add(new WinLine(subPayLine, iSymbolID, node.col + 1, m_PayTable.getWinAmount(iSymbolID, node.col + 1), m_WinningLines[subPayLine])); // m_PayoutLines.Add(" Payline# " + subPayLine + " last column: " + node.col + " row: " + node.Row + "\n"); } } } } } if (node.col == m_SlotColumns.Count - 1 && !node.IsRoot /*&& (getSymbolId(node.Row, node.col) == iSymbolID || isWildSymbol(node.Row, node.col))*/ && !bEnd) { if (isWildSymbol(iSymbolID)) { iSymbolID = getSymbolId(node.Row, node.col); } if (m_PayTable.IsPaySymbol(iSymbolID) && m_PayTable.getWinAmount(iSymbolID, node.col + 1) != 0) { int payline = node.PayLineNum; m_WinLines.Add(new WinLine(payline, iSymbolID, node.col + 1, m_PayTable.getWinAmount(iSymbolID, node.col + 1), m_WinningLines[payline])); // m_PayoutLines.Add(" Payline# " + payline + " last column: " + node.col + " row: " + node.Row + "\n"); } } }