public clsWinNode ndfnAddChild(enWin _winType) { clsWinNode ndChild = new clsWinNode(_winType, this, iBalance + (iBetAmount * (int)_winType), iBetAmount); lndChildren.Insert(0, ndChild); return(ndChild); }
public clsWinNode(enWin _winType, clsWinNode _ndParent, int _iBalance, int _iBetAmount) { winType = _winType; ndParent = _ndParent; iBalance = _iBalance; iBetAmount = _iBetAmount; lndChildren = new List <clsWinNode>(Enum.GetValues(typeof(enWin)).Length); }
public bool bfnBet(int _iBetAmount, enWin _winType) { if (_iBetAmount <= iBalance) { iBalance += (int)_winType * _iBetAmount; return(true); } return(false); }
/// <summary> /// Chooses an array of ints (which correspond to pictures) for a particular win type /// </summary> /// <param name="_winType"></param> /// <returns></returns> public int[] iafnTranslateWin(enWin _winType) { int[] iaSeq = new int[3]; Random rndGenerator = new Random(); // choose indexes randomly int a = rndGenerator.Next(0, 2), b = (3 - a) % 2, c = 3 - (a + b); int iNumPics = Enum.GetValues(typeof(enPic)).Length - 1; switch (_winType) { case enWin.Loss: iaSeq[a] = rndGenerator.Next(0, iNumPics); do { iaSeq[b] = rndGenerator.Next(0, iNumPics); }while (iaSeq[b] == iaSeq[a]); do { iaSeq[c] = rndGenerator.Next(0, iNumPics); }while (iaSeq[c] == iaSeq[a] || iaSeq[c] == iaSeq[b]); break; case enWin.OneToOne: do { iaSeq[a] = iaSeq[b] = rndGenerator.Next(0, iNumPics); }while ((int)enPic.Diamond == iaSeq[a] || (int)enPic.Crown == iaSeq[a]); do { iaSeq[c] = rndGenerator.Next(0, iNumPics); }while (iaSeq[c] == iaSeq[a]); break; case enWin.TwoToOne: do { iaSeq[a] = iaSeq[b] = rndGenerator.Next(0, iNumPics); }while ((int)enPic.Diamond == iaSeq[a] || (int)enPic.Crown == iaSeq[a]); do { iaSeq[c] = rndGenerator.Next(0, 1) == 0 ? (int)enPic.Diamond : (int)enPic.Crown; }while (iaSeq[c] == iaSeq[a]); break; case enWin.ThreeToOne: iaSeq[a] = iaSeq[b] = iaSeq[c] = rndGenerator.Next(0, iNumPics); break; default: break; } return(iaSeq); }