Ejemplo n.º 1
0
def main_process(FILES):
    frequency_1 = [24, 48, 48, 48, 47, 56, 56, 55, 54, 54, 52, 6]
    frequency_2 = [24, 48, 48, 48, 47, 56, 56, 55, 54, 54, 52, 6]
    frequency_3 = [24, 48, 48, 48, 47, 56, 56, 55, 54, 54, 52, 6]
    frequency_4 = [24, 48, 48, 48, 47, 56, 56, 55, 54, 54, 52, 6]
    frequency_5 = [24, 48, 48, 48, 47, 56, 56, 55, 54, 54, 52, 6]
    # [5, 6, 6, 6, 6, 6, 14, 16, 16, 16, 16, 4]
    frequency = [frequency_1, frequency_2, frequency_3, frequency_4, frequency_5]

    REPEAT_CNT = 100000
    #FILES = ['Games\HappyBrauer.txt']

    for sees in FILES:
        for i in range(1):
            file = open(sees, 'r')
            j = file.read()

            interim = json.loads(j)

            obj = Q.Game(interim)
            obj.delete_line(i)

            obj.base.reel_generator(frequency, obj.window[0], obj.distance)
            obj.free.reel_generator(frequency, obj.window[0], obj.distance)
            obj.base.fill_frequency(frequency)
            obj.free.fill_frequency(frequency)

            simulate_result = make_spins(obj, REPEAT_CNT)
            rtp, sd = simulate_result['rtp'], simulate_result['sd']

            print('FILE: ', sees, 10 - i, 'lines')
            print('simulation rtp = ', rtp)
            print('simulation sd = ', sd)
            file.close()
Ejemplo n.º 2
0
def parametrs(file_name, out):
    file = open(file_name, 'r')
    j = file.read()

    interim = json.loads(j)

    obj = Q.Game(interim)

    distr = freq(obj, out)

    start_time = time.time()

    obj.base.reel_generator(distr, obj.window[0], obj.window[1])
    obj.free.reel_generator(distr, obj.window[0], obj.window[1])
    obj.base.fill_frequency(distr)
    obj.free.fill_frequency(distr)

    obj.base.fill_count_killed(obj.window[0])
    obj.base.create_simple_num_comb(obj.window, obj.line)
    obj.base.fill_simple_num_comb(obj.window, obj.line)
    obj.base.fill_scatter_num_comb(obj.window)

    obj.free.fill_count_killed(obj.window[0])
    obj.free.create_simple_num_comb(obj.window, obj.line)
    obj.free.fill_simple_num_comb(obj.window, obj.line)
    obj.free.fill_scatter_num_comb(obj.window)

    root = point(distr, obj.base)
    root.baseReel = obj.base.reels
    root.freeReel = obj.free.reels

    params = obj.count_parameters()

    root.base_rtp, root.rtp, root.sdnew, root.hitrate = params['base_rtp'], params['rtp'], params['sdnew'], params['hitrate']

    roots = [root]

    roots = roots + initialDistributions(obj, out)
    print(time.time() - start_time)

    return distr, params['base_rtp'], params['rtp'], params['sdnew'], params['hitrate'], obj, roots
Ejemplo n.º 3
0
def SecondMethod(hitrate, err_hitrate, file_name, base_rtp, err_base_rtp):
    file = open(file_name, 'r')
    j = file.read()
    interim = json.loads(j)
    game = Q.Game(interim)
    file.close()

    out = sm.get_scatter_frequency(file_name, hitrate, err_hitrate)
    if out == -1 and hitrate != -1:
        exit('no free spins')
    elif out == -1:

        out = sm.OutResult(game.base.scatterlist)
        out.add_symbols(game.base.symbol)
    blocked_scatters = []
    for scatter_id in game.base.scatterlist:
        if max(game.base.symbol[scatter_id].scatter) > 0:
            blocked_scatters.append(scatter_id)


    t_distr, r_base_rtp, r_rtp, r_sdnew, r_hitrate, obj, roots = parametrs(file_name, out)



    rtp, sdnew, err_rtp, err_sdnew = 0.9, 14, 0.01, 0.01

    print('INITIAL POINTS, THEIR DISTRIBUTIONS, VALUES AND PARAMETRES:')
    a = []
    # TODO когда-нибудь убрать slice из roots
    for root in roots[0:1]:
        root.fillPoint(obj, base_rtp, rtp, sdnew, err_base_rtp, err_rtp, err_sdnew)
        root.fillVal(base_rtp, rtp, sdnew, err_base_rtp, err_rtp, err_sdnew)
        print(root.frequency, ' value is ', root.value,'base_rtp, rtp, sdnew, hitrate :', root.base_rtp, root.rtp, root.sdnew, root.hitrate)
        a = a + [root.value]
    b = [i for i in range(len(a))]
    double_bouble(a, b) # здесь массив b - массив индексов начальных точек, упорядоченных по значению F


    print('assuming base rtp, rtp, sd ', base_rtp, rtp, sdnew)
    print('assuming errors for base rtp, rtp,  sd ', err_base_rtp, err_rtp, err_sdnew)

    b = [0] + b

    for i in b:
        print('TRYING POINT', roots[i].frequency, ' value is ', roots[i].value,'base_rtp, rtp, sdnew, hitrate :', roots[i].base_rtp, roots[i].rtp, roots[i].sdnew, roots[i].hitrate)

        root = roots[i]

        obj.base.create_simple_num_comb(obj.window, obj.line)
        obj.free.create_simple_num_comb(obj.window, obj.line)
        sortedSymbols = sortSymbols(obj)
        check = False
        min_is_found = False
        currentScale = 0
        while not min_is_found and currentScale < scaleLimit:
            number_of_groups = len(obj.base.wildlist) + len(obj.base.ewildlist) + 1 + \
                               len(obj.base.scatterlist) - len(blocked_scatters)
            while number_of_groups < len(sortedSymbols) + len(obj.base.wildlist) + len(obj.base.ewildlist) + 1 + \
                    len(obj.base.scatterlist) - len(blocked_scatters):
                #print('is zis e los?')
                temp_group = group(root, number_of_groups, sortedSymbols, obj, blocked_scatters)
                print('группы ', temp_group.groups)
                temp_group.fillGroup(obj, base_rtp, rtp, sdnew, err_base_rtp, err_rtp, err_sdnew )
                print('точки групп и значения в них')
                temp_group.printGroup()
                if temp_group.findMin() != -1:
                    if temp_group.findMin().value < 1:
                        min_is_found = True
                        print('ending with ', temp_group.findMin().value)
                        print('base ', temp_group.findMin().base_rtp)
                        print('rtp ', temp_group.findMin().rtp)
                        print('sdnew ', temp_group.findMin().sdnew)
                        print('hitrate ', temp_group.findMin().hitrate)
                        root = copy.deepcopy(temp_group.findMin())
                        print(root.frequency)
                        check = True
                        temp_group.findMin().printBaseReel(file_name)
                        break
                    else:
                        print('path ', temp_group.findMin().value)
                        root = copy.deepcopy(temp_group.findMin())
                else:
                    print(number_of_groups)
                    number_of_groups += 1
                    if number_of_groups > (len(obj.base.wildlist) + len(obj.base.ewildlist) + len(sortedSymbols) + 1
                                           + len(obj.base.scatterlist) - len(blocked_scatters))/2: # and number_of_groups < len(sortedSymbols):
                        number_of_groups = len(sortedSymbols) + len(obj.base.wildlist) + len(obj.base.ewildlist) + 1 \
                                           + len(obj.base.scatterlist) - len(blocked_scatters)
            #print(min_is_found)
            if not min_is_found:

                root = root.scaling()
                currentScale += 1
                print('SCALING ', currentScale)
            else:
                break
        if check:
            print('Блеск')
            break
Ejemplo n.º 4
0
frequency_4 = [24, 48, 48, 48, 47, 56, 56, 55, 54, 54, 52, 6]
frequency_5 = [24, 48, 48, 48, 47, 56, 56, 55, 54, 54, 52, 6]

frequency = [frequency_1, frequency_2, frequency_3, frequency_4, frequency_5]

FILES = ['Games\HappyBrauer.txt']

for sees in FILES:
    for i in range(10):
        start_time = time.time()
        file = open(sees, 'r')
        j = file.read()

        interim = json.loads(j)

        obj = Q.Game(interim)
        obj.delete_line(i)

        obj.base.reel_generator(frequency, obj.window[0], obj.distance)
        obj.free.reel_generator(frequency, obj.window[0], obj.distance)
        obj.base.fill_frequency(frequency)
        obj.free.fill_frequency(frequency)

        obj.base.fill_count_killed(obj.window[0])
        obj.base.create_simple_num_comb(obj.window, obj.line)
        obj.base.fill_simple_num_comb(obj.window, obj.line)
        obj.base.fill_scatter_num_comb(obj.window)

        obj.free.fill_count_killed(obj.window[0])
        obj.free.create_simple_num_comb(obj.window, obj.line)
        obj.free.fill_simple_num_comb(obj.window, obj.line)
Ejemplo n.º 5
0
import numpy as np
import json
import FrontEnd.structure_alpha as Q
import time
from simulate import make_spins
from simulate import greedy_simulate
import math

file = open('Games/PrinceOfPersia.json', 'r')
j = file.read()
interim = json.loads(j)
game = Q.Game(interim)
file.close()

frequency = [[0, 3, 4, 6, 6, 8, 8, 12, 14, 15, 16, 16],
             [0, 3, 4, 6, 6, 8, 8, 12, 14, 15, 16, 16],
             [0, 3, 4, 6, 6, 8, 8, 12, 14, 15, 16, 16],
             [0, 3, 4, 6, 6, 8, 8, 12, 14, 15, 16, 16],
             [0, 3, 4, 6, 6, 8, 8, 12, 14, 15, 16, 16]]

game.base.fill_frequency(frequency)
game.free.fill_frequency(frequency)

game.base.reel_generator(game.base.frequency,
                         game.window[0],
                         game.distance,
                         validate=True)
game.free.reel_generator(game.free.frequency,
                         game.window[0],
                         game.distance,
                         validate=True)
Ejemplo n.º 6
0
import json
import FrontEnd.structure as Q
import FrontEnd.structure_alpha as A

file = open('D:\\PyCharm\\PycharmProjects\\reel\\Games\\Garage.txt', 'r')
j = file.read()
file2 = open('D:\\PyCharm\\PycharmProjects\\reel\\Games\\Garage.txt', 'r')
h = file2.read()

interim = json.loads(j)
interim2 = json.loads(h)

joj = A.Game(interim)
obj = Q.Game(interim2)

try:
    print("window = ", obj.window, '\t\t|\t\t', joj.window)
    print(
        "____________________________________________________________________________________________________"
    )
    for i in range(len(obj.symbol)):
        print("\tnumber : ", i, '\t\t|\t\t', i)
        print("\tname : ", obj.symbol[i].name, '\t\t|\t\t',
              joj.base.symbol[i].name)
        print("\tpayment : ", obj.symbol[i].payment, '\t\t|\t\t',
              joj.base.symbol[i].payment)
        print("\tbase")
        print("\t\tbase_direction : ", obj.symbol[i].base.direction,
              '\t\t|\t\t', joj.base.symbol[i].direction)
        print("\t\tbase_position : ", obj.symbol[i].base.position, '\t\t|\t\t',
              joj.base.symbol[i].position)