Content uploaded by Todor Balabanov
Author content
All content in this area was uploaded by Todor Balabanov on Sep 23, 2016
Content may be subject to copyright.
Slot Machines RTP Optimization with Genetic
Algorithms
Todor Balabanov11, Iliyan Zankinski1and Bozhidar Shumanov1
Institute of Information and Communication Technologies,
Bulgarian Academy of Science,
acad. G. Bonchev St., Block 2, 1113 Sofia, Bulgaria,
todorb@iinf.bas.bg,
http://www.iict.bas.bg/
Abstract. Slot machine RTP optimization problem is usually solved by
hand adjustment of the symbols placed on the game reels. By controlling
symbols distribution it is possible to achieve desired return to player
percent (RTP), but also some other parameters can be adjusted (for
example free spins frequency or bonus game frequency). In this paper,
RTP optimization automation is proposed based on genetic algorithms.
Keywords: slot machines, RTP, genetic algorithms, optimization
1 Introduction
Slot machines are electronic gambling devices that offer variety of games. They
are found mainly at casinos and some bars. Slot machines are relatively inexpen-
sive to run compared to roulette, blackjack or poker, that is why they become
very popular and very profitable form of gambling. The game consists of three
or five reels which spin when button is pushed. The game pays off according
patterns of symbols visualized on the screen after spin stop. The main scope in
this paper is about symbols distribution on the machine reels.On each reel there
are ordered symbols (usually represented with numbers in math models). The
order in which symbols are presented on the reel is discrete probability distribu-
tion. According symbols distribution, different wining combinations can appear
on the game screen. Mathematicians who develop slot machine reels have the
task to select such discrete probability distribution which will produce certain
RTP. The value of RTP (return to player) is calculated by division of money won
over money lost multiplied by one hundred. The RTP value is very important for
slot machine vendors, because this is the main gambling game parameter which
is under government regulation. The RTP value has mathematical meaning as
expected value. The other interesting parameter of the slot machine games is
volatility, but this parameter is not discussed in this study, because it is less of-
ten taken into account during government regulations. The proposed approach
for symbols discrete distribution optimization can be very handy for mathemati-
cians who are working on new slot gambling games.
2 Slot Machine Reels
In this section brief review of the basic concepts of the slot machine will be given
and game reels in particular.
Slot machines are based on the concept of spin reels. In the beginning slot
reels were mechanical and the spin of the reels were done by manual pull of
the game handle. Nowadays most of the slot machines are computerized and
game reels are virtual only and stops are selected by RNG (for more info [1]).
In most games five independent reels are presented, but also there are variations
with three or more than five reels. After the push button is hit reels starts spin
and one by one each reel stops. The win of the player is calculated according
combinations of symbols presented on the screen. Each game has its own pay
table, which is visible for the player usually on the separate screen. Some symbols
are presented on the reels more often than others. Less frequent symbols form
wining combinations less often and because of that the win for the player is
bigger.
Main characteristic of each slot machine is RTP%. This parameter is calcu-
lated by the ratio between won and lost money, multiplied by one hundred. The
RTP can be from 80% in Las Vegas up to 98% in some EU member states. Fruit
machines in the United Kingdom, for example, are required by law to pay out a
minimum percentage within a short period of time.[2] Usually the RTP is above
90%. In order the desired RTP to be achieved mathematicians and game design-
ers are working in collaboration to populate game reels with proper symbols in
proper discrete distribution (for more info [3]).
3 Genetic Alghorithms
Genetic algorithms (GAs) are search heuristic inspired by the process of natural
selection.[4][5] GAs are routinely used to generate points (candidate solutions)
into solutions space. By application of techniques for inheritance (crossover),
mutation and selection generated points can get closer to the optimums. GAs are
classified also as population based algorithms, because each point into solution
space represents individual inside GAs population. Each individual has a set of
properties which are subject of mutation and modification (usually crossover).
Traditional representation of the properties is binary as sequence of 0s and 1s,
but other encodings are also available (binary tree for example).
Optimization usually starts from random generated population of individu-
als, but this is also subject of implementation. The optimization process is itera-
tive and the population in each iteration is called generation. For each individual
of the generation fitness value is calculated. Fitness value usually represents the
objective function which is subject of optimization. The most fit individuals into
the population are selected (according selection rule) and recombined (crossover
and/or mutation) to form a new generation. This new generation is used in the
next iteration of the algorithm. Algorithm termination is usually achieved by
reaching maximum number of generations or by reaching desired level of the
fitness value.
In order one to run GAs he/she should provide: 1. Genetic representation of
the solution space (solution domain); 2 appropriate fitness function to evaluate
the solution domain. Once these two conditions are met GAs can proceed with
population initialization and iterative population improvement by repetitive ap-
plication of selection, crossover, mutation and individuals evaluation.
4 Proposed Model
In the proposed model every individual consists of slot machine symbols (as
numbers) distributed on the reels. Each symbol in the reels is represented by
single integer number in such way that symbol and its position on the reel are
significant. Solution domain is finite and discrete. Each position in each reel
should be single integer number from the list of possible game symbols.
Population initialization is usually done by random generation, but the pro-
posed model in this paper use initial reels configuration to initialize population.
Initialization is done by addition of random noise to the initial reels configura-
tion ([6] for more details). Population size is subject of experimental estimation
and may vary from several individuals to hundreds or thousands.
Into selection process individuals are selected according fitness based value.
Some selection methods prefer the best individuals, but other methods prefer
only random subset of the population. The fitness function is problem depen-
dent and is defined over the genetic representation as measure of the quality of
the represented solution. In the proposed model, as fitness function, absolute
difference between desired RTP and obtained RTP is used. For obtained RTP
Monte-Carlo simulation is used in order to estimate how slot machine will be-
have in 100 000 or 1 000 000 separate runs. The rule of elitism is also applied in
order the best individual to survive between generations.
For crossover operation pair of parent individuals are selected (individuals,
part of the selected population subset). Single point cut is used in order to recom-
bine attributes of the first and second parent in order to create child individual.
It is subject of additional research is it better to use more than two individuals as
parents. After crossover mutation is applied over the child by random selection
of symbol, which is changed with randomly selected symbol.
As termination criteria maximum number of generations is used and also
manual observation/termination of the process was implemented. Final solution,
found by GA, is an integer vector. This vector is directly used as slot machine
symbols distribution. For example if there is a slot game with 5 reels (visible on
the screen as 5 columns and 3 rows) and on each reel there are 63 symbols, the
final solution of GA would be integer vector of 5x63 values ([6] for more details).
5 Experiments and Results
Experiments were done with non-commercial slot machine (5 reels with 3 sym-
bols visible on the screen for each of the reels) with particular pay table and
combination lines. The game has paytable shown in (Tab.1) which is valid for
Fig. 1. GA convergence for different target RTPs. On the axes: x - number of genera-
tions, y - ABS(TargetRTP - ObtainedRTP).
5 wining lines shown in (Tab.2). All wining combinations are paid from left to
Table 1. Slot machine paytable. Each column represents wins of one particular symbol
(9 possible symbols in this game). Sixth row shows the win of the symbols when there
is a combination of 5 symbols, fifth row shows wins for combination of 4 symbols and
so on.
right. The lowest win is 2 for combination of 2 symbols (last column, row 3 of
Tab.1). The highest win is 750 for combination of 5 symbols (first column, last
row of Tab.1). The model of presented slot machine has 9 symbols which can
form wining combinations on the screen. Slot game pay table is presented by
this way in order to use row indexes as number of symbols on the particular
wining line. For example, if on the screen there is a wining line which consists
of 4 symbols of symbol type 3 it means that the win from this combination is 25
(3th column, 5th row).
Table 2. Slot machine win combinations. First row shows that symbols should be
presented on the middle row of the game screen (top row has index 0, middle row has
index 1 and bottom row has index 2). Second win line is presented on the second row
(all symbols should be positioned in the top row of the game screen) and so on for
third, forth and fifth line.
All experiments were done with elitism rule, population size of 17, maximum
number of generations 213, and one million separate simulation game runs in
ten separate sessions as fitness value estimation. Crossover probability is about
90%. Mutation probability is 100% and only one value in the chromosome is
changed. More information about GA parameters can be found in[6]. As initial
reels distribution handmade reels with 90.88% RTP were used.
It is visible that GA convergence is pretty fast and around 51 generations
optimal goal was achieved (Fig. 1 - Target RTP 90%). Because of the discrete
nature of the process optimisation is done on separate steps visible in generations
6, 8, 15, 19, 31 and 51. In the second experiment target RTP of 91% is very close
to initial RTP and convergence was with small steps around 15th generation and
67th generation (Fig. 1 - Target RTP 91%). Third experiment has target RTP
of 92% and it is obvious how optimization process flows (Fig. 1 - Target RTP
92%). Few steps were done in generations 7, 15, 41, 55, 63 and 71. In some of
the cases (Fig. 1 - Target RTP 93-99%) it is interesting to point initial difference
from the target percent as it is in 97% target RTP optimization (initial difference
of more than 5) and 99% target RTP optimization (initial difference of almost
8). The initial difference for 98% experiment is much smaller, because in each
experiment initial difference was calculated after first generation.
6 Conclusions
All experiments show that using GA can be very effective and can improve slot
games development by better adjustment of RTP, but not only. As it was shown
(Fig.1) in half of the experiments convergence was very fast and in the other
half slower. These results are related to the probabilistic nature of GA.
The main disadvantage of GA based optimization is the time of fitness value
calculation. In the slot reels optimization problem fitness value is calculated by
relatively slow game simulations.
The biggest advantage of GA based optimization is the possibility to opti-
mize more than single parameter. In this study RTP was optimized, but as multi
criteria optimization, symbol frequencies, free spins frequency, bonus game fre-
quency, and game volatility can be optimized.
Acknowledgements
This research is supported by AComIn ”Advanced Computing for Innovation”,grant
316087, funding by FP7 Capacity Programme, Research Potential of Conver-
gence Regions (2012-2016), the European Social Fund and Republic of Bulgaria,
Operational Programme Development of Human Resources 20072013, Grant
BG051PO001-3.3.06-0048 from 04.10.2012.
References
[1] Brysbaert, M.: Algorithms for randomness in the behavioral sciences: A tutorial
Behavior Research Methods, Instruments, and Computers vol.22 issue 1, pp.45-60,
(1991)
[2] Parke, J., Griffiths, M.: The psychology of the fruit machine: The role of structural
characteristics (revisited), Paper presented at the annual conference of The British
Psychological Society, Surrey, England (2001)
[3] Osesa, N.: Bitz and Pizzas Optimal stopping strategy for a slot machine bonus
game, OR Insight, 22, pp.3144, (2009)
[4] Eiben, A. E: Genetic algorithms with multi-parent recombination. PPSN III: Pro-
ceedings of the International Conference on Evolutionary Computation. The Third
Conference on Parallel Problem Solving from Nature: 7887. ISBN 3-540-58484-6,
(1994)
[5] Ting, Chuan-Kang: On the Mean Convergence Time of Multi-parent Genetic Algo-
rithms Without Selection. Advances in Artificial Life: 403412. ISBN 978-3-540-28848-
0, (2005)
[6] Balabanov, T: Slot Genetic Algorithm, http://drive.google.com
/file/d/0Bz5a6NKy7qNiYi1jS01ZVnFOV1U