SlideShare a Scribd company logo
1 of 6
'''
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]
adj_3 = [1,3,7]
adj_4 = [2,4,8]
adj_5 = [3,9]
adj_6 = [0,6,10]
adj_7 = [5,1,7,11]
adj_8 = [6,2,8,12]
adj_9 = [3,7,9,13]
adj_10 = [4,8,14]
adj_11 = [5,11]
adj_12 = [10,6,12]
adj_13 = [11,7,13]
adj_14 = [12,8,14]
adj_15 = [9,13]
#combines all of the adjacent arrays to one array
Adjacents = [adj_1,adj_2,adj_3,adj_4,adj_5,adj_6,adj_7,adj_8,
adj_9,adj_10,adj_11,adj_12,adj_13,adj_14,adj_15]
BaseReels = pd.read_csv(cwd + r'FreeGameReels.csv',sep = ",")
PayTable = pd.read_csv(cwd +r'Paytable.csv',sep = ",")
BaseSchemes = pd.read_csv(cwd +r'BonusSchemes.csv',sep = ",")
BaseSchemeWeight = sum(BaseSchemes.ix[:,15])
#returns random stop position
def get_stop():
#print(BaseReels.iloc[:,4].count())
return([rd.randint(0,BaseReels.iloc[:,0].count()-1),
rd.randint(0,BaseReels.iloc[:,1].count()-1),
rd.randint(0,BaseReels.iloc[:,2].count()-1),
rd.randint(0,BaseReels.iloc[:,3].count()-1),
rd.randint(0,BaseReels.iloc[:,4].count()-1),
rd.randint(0,BaseReels.iloc[:,5].count()-1),
rd.randint(0,BaseReels.iloc[:,6].count()-1),
rd.randint(0,BaseReels.iloc[:,7].count()-1),
rd.randint(0,BaseReels.iloc[:,8].count()-1),
rd.randint(0,BaseReels.iloc[:,9].count()-1),
rd.randint(0,BaseReels.iloc[:,10].count()-1),
rd.randint(0,BaseReels.iloc[:,11].count()-1),
rd.randint(0,BaseReels.iloc[:,12].count()-1),
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
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)
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:
check_adjacents(i,Symbol)
if(len(Adjacent_Spots)+ 1) > 3:
TotalPay = TotalPay +
PayTable[str(len(Adjacent_Spots)+1)].iloc[SymbolRow]
rtp = float(TotalPay)/iterations/60
print("Totoal Pay = " + str(TotalPay))
print("RTP = %6f" %rtp)
print(str(BonusHitCount) + "bonus hit count")

More Related Content

What's hot

Node.js in 2020 - part 1
Node.js in 2020 - part 1Node.js in 2020 - part 1
Node.js in 2020 - part 1
Timur Shemsedinov
 
7segment scetch
7segment scetch7segment scetch
7segment scetch
Bang Igo
 

What's hot (15)

Patterns and antipatterns
Patterns and antipatternsPatterns and antipatterns
Patterns and antipatterns
 
Programming Languages: comparison, history, future
Programming Languages: comparison, history, futureProgramming Languages: comparison, history, future
Programming Languages: comparison, history, future
 
Введение в SQL
Введение в SQLВведение в SQL
Введение в SQL
 
Serverless Clouds (FaaS) and request context isolation in Node.js
Serverless Clouds (FaaS) and request context isolation in Node.jsServerless Clouds (FaaS) and request context isolation in Node.js
Serverless Clouds (FaaS) and request context isolation in Node.js
 
Node.js in 2020 - part 2
Node.js in 2020 - part 2Node.js in 2020 - part 2
Node.js in 2020 - part 2
 
Pop3ck sh
Pop3ck shPop3ck sh
Pop3ck sh
 
Practica dos
Practica dosPractica dos
Practica dos
 
Array menu
Array menuArray menu
Array menu
 
[CB20] Reflex: you give me a parser, I give you a token generator by Paolo Mo...
[CB20] Reflex: you give me a parser, I give you a token generator by Paolo Mo...[CB20] Reflex: you give me a parser, I give you a token generator by Paolo Mo...
[CB20] Reflex: you give me a parser, I give you a token generator by Paolo Mo...
 
Private cloud without vendor lock // Serverless
Private cloud without vendor lock // ServerlessPrivate cloud without vendor lock // Serverless
Private cloud without vendor lock // Serverless
 
Node.js in 2020 - part 1
Node.js in 2020 - part 1Node.js in 2020 - part 1
Node.js in 2020 - part 1
 
Abap basics 01
Abap basics 01Abap basics 01
Abap basics 01
 
Web Locks API
Web Locks APIWeb Locks API
Web Locks API
 
7segment scetch
7segment scetch7segment scetch
7segment scetch
 
contoh Program queue
contoh Program queuecontoh Program queue
contoh Program queue
 

Viewers also liked

Engenharia Produção Emerson Tiago
Engenharia Produção  Emerson Tiago Engenharia Produção  Emerson Tiago
Engenharia Produção Emerson Tiago
Emerson Tiago
 

Viewers also liked (15)

Triangulos
TriangulosTriangulos
Triangulos
 
Resume201611180230
Resume201611180230Resume201611180230
Resume201611180230
 
Hieu chuan may do khi thai testo 350
Hieu chuan may do khi thai testo 350Hieu chuan may do khi thai testo 350
Hieu chuan may do khi thai testo 350
 
APORTE DE UN CLIENTE MÁS HABLANDO ACERCA DE SUS RESULTADOS CON LA LOCION ANTI...
APORTE DE UN CLIENTE MÁS HABLANDO ACERCA DE SUS RESULTADOS CON LA LOCION ANTI...APORTE DE UN CLIENTE MÁS HABLANDO ACERCA DE SUS RESULTADOS CON LA LOCION ANTI...
APORTE DE UN CLIENTE MÁS HABLANDO ACERCA DE SUS RESULTADOS CON LA LOCION ANTI...
 
Peinados
PeinadosPeinados
Peinados
 
Alcatel-Lucent TN75C
Alcatel-Lucent TN75CAlcatel-Lucent TN75C
Alcatel-Lucent TN75C
 
Ppt 3 t15 prt v2
Ppt 3 t15 prt v2Ppt 3 t15 prt v2
Ppt 3 t15 prt v2
 
Resistores
ResistoresResistores
Resistores
 
sesion 3
sesion 3sesion 3
sesion 3
 
Big Data el dorado del CRM de Proximity
Big Data el dorado del CRM de ProximityBig Data el dorado del CRM de Proximity
Big Data el dorado del CRM de Proximity
 
ADC 72558003
ADC 72558003ADC 72558003
ADC 72558003
 
Pré programme 2016 -1
Pré programme 2016 -1Pré programme 2016 -1
Pré programme 2016 -1
 
Ppt 1 t15 pt vfinal (1)
Ppt 1 t15 pt vfinal (1)Ppt 1 t15 pt vfinal (1)
Ppt 1 t15 pt vfinal (1)
 
b-alien4cloud-en1_web
b-alien4cloud-en1_webb-alien4cloud-en1_web
b-alien4cloud-en1_web
 
Engenharia Produção Emerson Tiago
Engenharia Produção  Emerson Tiago Engenharia Produção  Emerson Tiago
Engenharia Produção Emerson Tiago
 

Similar to Python find ajacent symbols recursively

sports-teampackage.bluej#BlueJ package fileobjectbench.heig.docx
sports-teampackage.bluej#BlueJ package fileobjectbench.heig.docxsports-teampackage.bluej#BlueJ package fileobjectbench.heig.docx
sports-teampackage.bluej#BlueJ package fileobjectbench.heig.docx
whitneyleman54422
 
PLEASE can do this in NETBEAN I need that way thank very muchManca.pdf
PLEASE can do this in NETBEAN I need that way thank very muchManca.pdfPLEASE can do this in NETBEAN I need that way thank very muchManca.pdf
PLEASE can do this in NETBEAN I need that way thank very muchManca.pdf
kennithdase
 
#In this project you will write a program play TicTacToe #using tw.pdf
#In this project you will write a program play TicTacToe #using tw.pdf#In this project you will write a program play TicTacToe #using tw.pdf
#In this project you will write a program play TicTacToe #using tw.pdf
aquacareser
 
#In this project you will write a program play TicTacToe #using tw.pdf
#In this project you will write a program play TicTacToe #using tw.pdf#In this project you will write a program play TicTacToe #using tw.pdf
#In this project you will write a program play TicTacToe #using tw.pdf
aquapariwar
 
The following is my code for a connectn program. When I run my code .pdf
The following is my code for a connectn program. When I run my code .pdfThe following is my code for a connectn program. When I run my code .pdf
The following is my code for a connectn program. When I run my code .pdf
eyelineoptics
 
project 6cards.pyimport randomclass Card( object ).docx
project 6cards.pyimport randomclass Card( object ).docxproject 6cards.pyimport randomclass Card( object ).docx
project 6cards.pyimport randomclass Card( object ).docx
briancrawford30935
 
Connect4.c2. Include the string.h header file3. Declare the foll.pdf
Connect4.c2. Include the string.h header file3. Declare the foll.pdfConnect4.c2. Include the string.h header file3. Declare the foll.pdf
Connect4.c2. Include the string.h header file3. Declare the foll.pdf
shakilaghani
 
You will write a multi-interface version of the well-known concentra.pdf
You will write a multi-interface version of the well-known concentra.pdfYou will write a multi-interface version of the well-known concentra.pdf
You will write a multi-interface version of the well-known concentra.pdf
FashionColZone
 
Lab Assignment 17 - Working with Object ArraysIn the old days we w.pdf
Lab Assignment 17 - Working with Object ArraysIn the old days we w.pdfLab Assignment 17 - Working with Object ArraysIn the old days we w.pdf
Lab Assignment 17 - Working with Object ArraysIn the old days we w.pdf
eyewaregallery
 
FaceUp card game In this assignment we will implement a made.pdf
FaceUp card game In this assignment we will implement a made.pdfFaceUp card game In this assignment we will implement a made.pdf
FaceUp card game In this assignment we will implement a made.pdf
abifancystore
 

Similar to Python find ajacent symbols recursively (13)

sports-teampackage.bluej#BlueJ package fileobjectbench.heig.docx
sports-teampackage.bluej#BlueJ package fileobjectbench.heig.docxsports-teampackage.bluej#BlueJ package fileobjectbench.heig.docx
sports-teampackage.bluej#BlueJ package fileobjectbench.heig.docx
 
PLEASE can do this in NETBEAN I need that way thank very muchManca.pdf
PLEASE can do this in NETBEAN I need that way thank very muchManca.pdfPLEASE can do this in NETBEAN I need that way thank very muchManca.pdf
PLEASE can do this in NETBEAN I need that way thank very muchManca.pdf
 
#In this project you will write a program play TicTacToe #using tw.pdf
#In this project you will write a program play TicTacToe #using tw.pdf#In this project you will write a program play TicTacToe #using tw.pdf
#In this project you will write a program play TicTacToe #using tw.pdf
 
#In this project you will write a program play TicTacToe #using tw.pdf
#In this project you will write a program play TicTacToe #using tw.pdf#In this project you will write a program play TicTacToe #using tw.pdf
#In this project you will write a program play TicTacToe #using tw.pdf
 
The following is my code for a connectn program. When I run my code .pdf
The following is my code for a connectn program. When I run my code .pdfThe following is my code for a connectn program. When I run my code .pdf
The following is my code for a connectn program. When I run my code .pdf
 
project 6cards.pyimport randomclass Card( object ).docx
project 6cards.pyimport randomclass Card( object ).docxproject 6cards.pyimport randomclass Card( object ).docx
project 6cards.pyimport randomclass Card( object ).docx
 
Connect4.c2. Include the string.h header file3. Declare the foll.pdf
Connect4.c2. Include the string.h header file3. Declare the foll.pdfConnect4.c2. Include the string.h header file3. Declare the foll.pdf
Connect4.c2. Include the string.h header file3. Declare the foll.pdf
 
Java Guessing Game Number Tutorial
Java Guessing Game Number TutorialJava Guessing Game Number Tutorial
Java Guessing Game Number Tutorial
 
You will write a multi-interface version of the well-known concentra.pdf
You will write a multi-interface version of the well-known concentra.pdfYou will write a multi-interface version of the well-known concentra.pdf
You will write a multi-interface version of the well-known concentra.pdf
 
Array
ArrayArray
Array
 
Codes
CodesCodes
Codes
 
Lab Assignment 17 - Working with Object ArraysIn the old days we w.pdf
Lab Assignment 17 - Working with Object ArraysIn the old days we w.pdfLab Assignment 17 - Working with Object ArraysIn the old days we w.pdf
Lab Assignment 17 - Working with Object ArraysIn the old days we w.pdf
 
FaceUp card game In this assignment we will implement a made.pdf
FaceUp card game In this assignment we will implement a made.pdfFaceUp card game In this assignment we will implement a made.pdf
FaceUp card game In this assignment we will implement a made.pdf
 

Recently uploaded

Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
HyderabadDolls
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Bertram Ludäscher
 
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
HyderabadDolls
 
Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1
ranjankumarbehera14
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Klinik kandungan
 
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
gajnagarg
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
gajnagarg
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
ahmedjiabur940
 

Recently uploaded (20)

Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
 
Ranking and Scoring Exercises for Research
Ranking and Scoring Exercises for ResearchRanking and Scoring Exercises for Research
Ranking and Scoring Exercises for Research
 
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book nowVadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
 
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
 
Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
 
Dubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls DubaiDubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls Dubai
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
 
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
 
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangePredicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
 
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24  Building Real-Time Pipelines With FLaNKDATA SUMMIT 24  Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
 
High Profile Call Girls Service in Jalore { 9332606886 } VVIP NISHA Call Girl...
High Profile Call Girls Service in Jalore { 9332606886 } VVIP NISHA Call Girl...High Profile Call Girls Service in Jalore { 9332606886 } VVIP NISHA Call Girl...
High Profile Call Girls Service in Jalore { 9332606886 } VVIP NISHA Call Girl...
 
Fun all Day Call Girls in Jaipur 9332606886 High Profile Call Girls You Ca...
Fun all Day Call Girls in Jaipur   9332606886  High Profile Call Girls You Ca...Fun all Day Call Girls in Jaipur   9332606886  High Profile Call Girls You Ca...
Fun all Day Call Girls in Jaipur 9332606886 High Profile Call Girls You Ca...
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
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]
  • 2. adj_3 = [1,3,7] adj_4 = [2,4,8] adj_5 = [3,9] adj_6 = [0,6,10] adj_7 = [5,1,7,11] adj_8 = [6,2,8,12] adj_9 = [3,7,9,13] adj_10 = [4,8,14] adj_11 = [5,11] adj_12 = [10,6,12] adj_13 = [11,7,13] adj_14 = [12,8,14] adj_15 = [9,13] #combines all of the adjacent arrays to one array Adjacents = [adj_1,adj_2,adj_3,adj_4,adj_5,adj_6,adj_7,adj_8, adj_9,adj_10,adj_11,adj_12,adj_13,adj_14,adj_15] BaseReels = pd.read_csv(cwd + r'FreeGameReels.csv',sep = ",") PayTable = pd.read_csv(cwd +r'Paytable.csv',sep = ",") BaseSchemes = pd.read_csv(cwd +r'BonusSchemes.csv',sep = ",") BaseSchemeWeight = sum(BaseSchemes.ix[:,15]) #returns random stop position def get_stop(): #print(BaseReels.iloc[:,4].count()) return([rd.randint(0,BaseReels.iloc[:,0].count()-1), rd.randint(0,BaseReels.iloc[:,1].count()-1), rd.randint(0,BaseReels.iloc[:,2].count()-1), rd.randint(0,BaseReels.iloc[:,3].count()-1), rd.randint(0,BaseReels.iloc[:,4].count()-1), rd.randint(0,BaseReels.iloc[:,5].count()-1), rd.randint(0,BaseReels.iloc[:,6].count()-1), rd.randint(0,BaseReels.iloc[:,7].count()-1), rd.randint(0,BaseReels.iloc[:,8].count()-1), rd.randint(0,BaseReels.iloc[:,9].count()-1), rd.randint(0,BaseReels.iloc[:,10].count()-1), rd.randint(0,BaseReels.iloc[:,11].count()-1), rd.randint(0,BaseReels.iloc[:,12].count()-1),
  • 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:
  • 6. check_adjacents(i,Symbol) if(len(Adjacent_Spots)+ 1) > 3: TotalPay = TotalPay + PayTable[str(len(Adjacent_Spots)+1)].iloc[SymbolRow] rtp = float(TotalPay)/iterations/60 print("Totoal Pay = " + str(TotalPay)) print("RTP = %6f" %rtp) print(str(BonusHitCount) + "bonus hit count")