This game is played on a 5x3 board with 15 independent reels. R1 is a
replacement symbol. There are 16 states, represented in the BaseSchemes
dataframe, with each reel being replaced independently based on this
dataframe.
The game does not evaluate lines or multiway, but rather it evaluates
adjacent positions in the cardinal positions. For example
AAJAQ
KA8AA
AA7KA
would evaluate as 5 Aces and 4 Aces. It would pay accordingly
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
Python find ajacent symbols recursively
1. '''
This game is played on a 5x3 board with 15 independent reels. R1 is a
replacement symbol. There are 16 states, represented in the BaseSchemes
dataframe, with each reel being replaced independently based on this
dataframe.
The game does not evaluate lines or multiway, but rather it evaluates
adjacent positions in the cardinal positions. For example
AAJAQ
KA8AA
AA7KA
would evaluate as 5 Aces and 4 Aces. It would pay accordingly
'''
########### define variables here
iterations = 10000000
ReplacementSymbol = "R1"
NumBaseSchemeStates = 16
WildSymbol = "WW"
BonusSymbol = "B1"
SymbolList = ["M1","M2","M3","M4","F5","F6","F7","F8"]
BonusHitCount = 0
#######
import pandas as pd
import random as rd
import os
cwd = os.getcwd()
#creates arrays with the adjacent positons for each board position
adj_1 = [1,5]
adj_2 = [0,2,6]
3. rd.randint(0,BaseReels.iloc[:,13].count()-1),
rd.randint(0,BaseReels.iloc[:,14].count()-1)])
#takes the randomly generated stop and creates a Window with the
#correct symbols placed based #on the reel positions
def get_symbols(Stop):
Window = (BaseReels.iloc[Stop[0],0],
BaseReels.iloc[Stop[1],1],
BaseReels.iloc[Stop[2],2],
BaseReels.iloc[Stop[3],3],
BaseReels.iloc[Stop[4],4],
BaseReels.iloc[Stop[5],5],
BaseReels.iloc[Stop[6],6],
BaseReels.iloc[Stop[7],7],
BaseReels.iloc[Stop[8],8],
BaseReels.iloc[Stop[9],9],
BaseReels.iloc[Stop[10],10],
BaseReels.iloc[Stop[11],11],
BaseReels.iloc[Stop[12],12],
BaseReels.iloc[Stop[13],13],
BaseReels.iloc[Stop[14],14])
#gets a random number to determine which replacement state
#will be used for this stop
ReplacementState = rd.randint(0,BaseSchemeWeight-1)
#determines which state the randomly produced ReplacementState
#variable is located in
for i in range(NumBaseSchemeStates):
#chooses the 16th column which has the ranges in it
if ReplacementState <= BaseSchemes.iloc[i,16]:
NewSymbolRow = BaseSchemes.ix[i,:]
#print(i)
break
for i in range(15):
if Window[i] == ReplacementSymbol:
Window = list(Window)
Window[i] = NewSymbolRow[i]
#this will keep track of how many times the Bonus is activated
global BonusHitCount
4. if Window[6]== BonusSymbol and Window[7] == BonusSymbol and Window[8] == BonusSymbol:
BonusHitCount = BonusHitCount + 1
#the second part of the return is never used
return[Window,NewSymbolRow[16]/BaseSchemeWeight]
def check_adjacents(InitialPosition, Symbol):
global SpotsStillToCheck, Adjacent_Positions, Adjacent_Spots,Window
SpotsStillToCheck.remove(InitialPosition)
for position in Adjacents[InitialPosition]:
if position in SpotsStillToCheck:
SpotsStillToCheck.remove(position)
if Window[position] == Symbol or Window[position] == WildSymbol:
Adjacent_Spots.append(position)
else:
next
for adj in Adjacent_Spots:
for pos in Adjacents[adj]:
#print(str(pos) + "pos")
#print(str(pos) + "position")
if pos in SpotsStillToCheck and (Window[pos] == Symbol or
Window[pos] == WildSymbol):
Adjacent_Spots.append(pos)
check_adjacents(pos,Symbol)
elif pos in SpotsStillToCheck:
SpotsStillToCheck.remove(pos)
5. TotalPay = 0
for iter in range(iterations):
WindowAndProb = get_symbols(get_stop())
#Stop = [1,5,6,1,1,1,1,2,2,1,2,1,1,2,2]
Window = WindowAndProb[0]
StateProb = WindowAndProb[1]
SpotsStillToCheck = list(range(15))
Adjacent_Spots = []
SymbolRow = 0
for Symbol in SymbolList:
SymbolRow = SymbolRow + 1
SpotsStillToCheck = list(range(15))
Adjacent_Spots = []
for i in range(15):
if i in SpotsStillToCheck:
if Window[i] == Symbol or Window[i] == WildSymbol: