Created
December 5, 2018 23:55
-
-
Save VorontsovIE/3bfe6ee470ebd5c45d91fc47267bdb01 to your computer and use it in GitHub Desktop.
Winnie - step 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
state = 'start' | |
Tram = 0.5 | |
param = 0.5 | |
pa = 3/8 | |
pam = 5/8 | |
Trym = 2/7 | |
Tyrym = 5/7 | |
pym = 1 | |
y_big = 0.5 | |
a_big = 0.5 | |
a_big_a_litle = 0.75 | |
a_big_a_big = 0.25 | |
a_litle_a_big = 1/7 | |
a_litle_a_litle = 4/7 | |
a_litle_K = 2/7 | |
y_big_y_big = 2/7 | |
y_big_y_litle = 5/7 | |
y_litle_a_litle = 1/8 | |
y_litle_y_big = 4/8 | |
y_litle_y_litle = 2/8 | |
y_litle_K = 1/8 | |
while state != 'finish': | |
if state == 'start': # начало | |
k = random.random() | |
if k <= y_big: | |
next_state = 'y_big' # У большое | |
else: | |
next_state = 'a_big' # А большое | |
if state == 'y_big': | |
k = random.random() | |
if k <= y_big_y_litle: | |
next_state = 'y_litle' | |
elif y_big_y_litle < k <= y_big_y_litle + y_big_y_big: | |
next_state = 'y_big' | |
k = random.random() | |
if k <= Trym: | |
print('трум', end = ' ') | |
elif Trym < k <= Trym + Tyrym: | |
print('турум', end = ' ') | |
if state == 'a_big': | |
k = random.random() | |
if k <= a_big_a_litle: | |
next_state = 'a_big' | |
elif a_big_a_litle < k <= a_big_a_litle + a_big_a_big: | |
next_state = 'a_litle' | |
k = random.random() | |
if k <= Tram: | |
print('трам', end = ' ') | |
elif Tram < k <= Tram + param: | |
print('парам', end = ' ') | |
if state == 'y_litle': | |
k = random.random() | |
if k <= y_litle_a_litle: | |
next_state = 'a_litle' | |
elif k <= y_litle_a_litle + y_litle_y_big: | |
next_state = 'y_big' | |
elif k <= y_litle_a_litle + y_litle_y_big + y_litle_y_litle: | |
next_state = 'y_litle' | |
elif k <= y_litle_a_litle + y_litle_y_big + y_litle_y_litle + y_litle_K: | |
next_state = 'finish' | |
# k = random.random() | |
print('пум', end = ' ') | |
if state == 'a_litle': | |
k = random.random() | |
if k <= a_litle_a_big: | |
next_state = 'a_big' | |
elif k <= a_litle_a_litle + a_litle_a_big: | |
next_state = 'a_litle' | |
elif k <= a_litle_a_litle + a_litle_a_big + a_litle_K: | |
next_state = 'finish' | |
k = random.random() | |
if k <= pam: | |
print('пам', end = ' ') | |
elif pam < k <= pam + pa: | |
print('па', end = ' ') | |
state = next_state |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment