Pygame-RKG-domino/settings.py

44 lines
1.6 KiB
Python

# Define constants for the screen, dominos
from random import choice
SCREEN_WIDTH = 1200
SCREEN_HEIGHT = 1000
DOMINO_W = 100
DOMINO_H = 200
DOMINOS = []
values = range(7)
for v_up in values:
for v_down in values:
if not [v_up, v_down] in DOMINOS and not [v_down, v_up] in DOMINOS:
DOMINOS.append([v_up, v_down])
# for _ in range(10):
# DOMINOS.append([[1, '1'], [1, '1']])
# print(DOMINOS)
# в каждом по 8
str_values = {
0: ["32*0", "2^2-4", "7-3.5*2", "-5+2.5*2", "0-0+0", "0/43", "False", "[1, 0][1]", "8*(3-3)", "not 3",
"6+6-6+6-6-6"],
1: ["0^0", "24/24", "True", "23>4", "1 or 0", "10-1*9", "sqrt(1)", "5^1/5", "7-6", "1!", "36/6^2", "-2+3",
"if 'str'", "bool(-3)"],
2: ["2!", "8^0.34", "int(e)", "True+True", "14/7", "sqrt(4)", "sqrt(4)^2", "int('2')", "(1<3)*2", "3-1", "1+1"],
3: ["2!*1.5", "9/3", "round(pi)", "sqrt(9)", "(18/2)^0.5", "True*3", "5-2", "6/2", "3+0^1", "0^0*3", "round(3)"],
4: ["2*2", "3+1*1", "0+4", "int(e)*2", "8/2", "6-3+1", "(8+4)/3", "int('5')-1", "int(float(str(4.9)))", "sqrt(16)"],
5: ["10/2", "25^0.5", "2*5/2", "4!-19", "True*10/2", "3+2", "100/20", "4*1.25", "int(5.839)", "5+5-5+5-5", "2.5*2"],
6: ["3!", "2+2*2", "round(pi)*2", "(if 6>1)*6", "10-4", "24/4", "sqrt(12*3)", "3^2-3", "2*(4-1)", "{1,3,6}[2]"]
}
for i in range(len(DOMINOS)):
v_up = choice(str_values[DOMINOS[i][0]])
str_values[DOMINOS[i][0]].remove(v_up)
v_down = choice(str_values[DOMINOS[i][1]])
str_values[DOMINOS[i][1]].remove(v_down)
DOMINOS[i] = [[DOMINOS[i][0], v_up], [DOMINOS[i][1], v_down]]
# print(DOMINOS)