cetragm 0.1.5__py3-none-any.whl → 0.1.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cetragm might be problematic. Click here for more details.
- cetragm/game.py +3 -0
- cetragm/main.py +27 -24
- cetragm/srs.py +4 -4
- cetragm/tables.py +22 -18
- {cetragm-0.1.5.dist-info → cetragm-0.1.6.dist-info}/METADATA +1 -1
- {cetragm-0.1.5.dist-info → cetragm-0.1.6.dist-info}/RECORD +9 -9
- {cetragm-0.1.5.dist-info → cetragm-0.1.6.dist-info}/WHEEL +0 -0
- {cetragm-0.1.5.dist-info → cetragm-0.1.6.dist-info}/entry_points.txt +0 -0
- {cetragm-0.1.5.dist-info → cetragm-0.1.6.dist-info}/licenses/LICENSE +0 -0
cetragm/game.py
CHANGED
|
@@ -32,6 +32,9 @@ def lock_piece(piece, board, player):
|
|
|
32
32
|
board_empty = all(cell[0] for row in board for cell in row)
|
|
33
33
|
soft = player.soft # TODO: ADD SOFT, OR SOFT DROP CALC
|
|
34
34
|
|
|
35
|
+
if board_empty:
|
|
36
|
+
player.score += 2500
|
|
37
|
+
|
|
35
38
|
score_gain, player.combo = get_score(player.level, cleared, player.combo, board_empty, soft)
|
|
36
39
|
player.score += score_gain
|
|
37
40
|
|
cetragm/main.py
CHANGED
|
@@ -21,7 +21,6 @@ def sigint_handler(sig, frame):
|
|
|
21
21
|
sigint = threading.Event()
|
|
22
22
|
lose = threading.Event()
|
|
23
23
|
board_lock = threading.Lock()
|
|
24
|
-
ROT_SEQ = ["0", "r", "2", "l"]
|
|
25
24
|
|
|
26
25
|
signal.signal(signal.SIGINT, sigint_handler)
|
|
27
26
|
|
|
@@ -30,16 +29,19 @@ def setup_board(rows, cols):
|
|
|
30
29
|
return board
|
|
31
30
|
|
|
32
31
|
def is_grounded(active_piece, board):
|
|
33
|
-
if not active_piece:
|
|
32
|
+
if not active_piece or "pos" not in active_piece:
|
|
34
33
|
return False
|
|
35
|
-
temp_pos =
|
|
34
|
+
temp_pos = active_piece["pos"][:]
|
|
36
35
|
temp_pos[1] += 1
|
|
37
36
|
return collides({"name": active_piece["name"], "rotation": active_piece["rotation"], "pos": temp_pos}, board)
|
|
38
37
|
|
|
39
38
|
def get_minos(active_piece):
|
|
40
|
-
if not active_piece:
|
|
39
|
+
if not active_piece or "name" not in active_piece:
|
|
40
|
+
return set()
|
|
41
|
+
try:
|
|
42
|
+
rot_matrix = pieces[active_piece["name"].lower()]["rotations"][active_piece["rotation"]]
|
|
43
|
+
except KeyError:
|
|
41
44
|
return set()
|
|
42
|
-
rot_matrix = pieces[active_piece["name"].lower()]["rotations"][active_piece["rotation"]]
|
|
43
45
|
minos = set()
|
|
44
46
|
for dy, row in enumerate(rot_matrix):
|
|
45
47
|
for dx, cell in enumerate(row):
|
|
@@ -59,6 +61,7 @@ def lock_and_are(player, board, shared):
|
|
|
59
61
|
player.fall_progress = 0.0
|
|
60
62
|
player.hold_lock = False
|
|
61
63
|
player.soft = 0
|
|
64
|
+
player.lock_resets = 0
|
|
62
65
|
|
|
63
66
|
if cleared:
|
|
64
67
|
return "line_clear", 0.0
|
|
@@ -77,17 +80,16 @@ def lock_now(player, board, shared, bag):
|
|
|
77
80
|
if loss:
|
|
78
81
|
lose.set()
|
|
79
82
|
return "loss"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
|
|
84
|
+
player.active_piece = {}
|
|
85
|
+
player.fall_progress = 0.0
|
|
86
|
+
player.soft = 0
|
|
87
|
+
player.hold_lock = False
|
|
88
|
+
player.lock_resets = 0
|
|
89
|
+
if cleared:
|
|
84
90
|
return "line_clear"
|
|
85
91
|
else:
|
|
86
92
|
player.active_piece = {"name": bag.get_piece(), "pos": [3, 0], "rotation": "0"}
|
|
87
|
-
player.fall_progress = 0.0
|
|
88
|
-
player.soft = 0
|
|
89
|
-
player.hold_lock = False
|
|
90
|
-
player.lock_resets = 0
|
|
91
93
|
return "active"
|
|
92
94
|
|
|
93
95
|
def input_handler(player, board, action, bag, shared, LOCK_DELAY, FRAME):
|
|
@@ -283,17 +285,18 @@ def game_loop(shared, player, bag, inputs, fps):
|
|
|
283
285
|
break
|
|
284
286
|
else:
|
|
285
287
|
lock_timer = 0.0
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
288
|
+
|
|
289
|
+
if state == "active":
|
|
290
|
+
piece = player.active_piece
|
|
291
|
+
temp_pos = piece["pos"].copy()
|
|
292
|
+
temp_pos[1] += 1
|
|
293
|
+
if collides({"name": piece["name"], "pos": temp_pos, "rotation": piece["rotation"]}, board):
|
|
294
|
+
lock_timer += dt
|
|
295
|
+
if lock_timer >= LOCK_DELAY:
|
|
296
|
+
state, lock_timer = lock_and_are(player, board, shared)
|
|
297
|
+
if state == "loss":
|
|
298
|
+
return
|
|
299
|
+
phase_timer = 0.0
|
|
297
300
|
|
|
298
301
|
# pause after line clear
|
|
299
302
|
elif state == "line_clear":
|
cetragm/srs.py
CHANGED
|
@@ -12,10 +12,10 @@ ROT_180 = {"0": "2", "2": "0", "r": "l", "l": "r"}
|
|
|
12
12
|
JLSTZ_OFFSETS = {"0": (0,0), "r": (0,0), "2": (0,0), "l": (0,0)}
|
|
13
13
|
|
|
14
14
|
I_OFFSETS = {
|
|
15
|
-
"0": (
|
|
16
|
-
"r": (
|
|
17
|
-
"2": (0,
|
|
18
|
-
"l": (0,
|
|
15
|
+
"0": (0, 0),
|
|
16
|
+
"r": (0, 0),
|
|
17
|
+
"2": (0, 0),
|
|
18
|
+
"l": (0, 0),
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
# These kick tables are not my values, they're from the Super Rotation System (or Tetris Guideline)
|
cetragm/tables.py
CHANGED
|
@@ -390,25 +390,29 @@ gravity = {
|
|
|
390
390
|
90: 64,
|
|
391
391
|
100: 80,
|
|
392
392
|
120: 96,
|
|
393
|
-
140:
|
|
394
|
-
160:
|
|
395
|
-
170:
|
|
393
|
+
140: 100,
|
|
394
|
+
160: 112,
|
|
395
|
+
170: 120,
|
|
396
396
|
200: 4,
|
|
397
|
-
220:
|
|
398
|
-
230:
|
|
399
|
-
233:
|
|
400
|
-
236:
|
|
401
|
-
239:
|
|
402
|
-
243:
|
|
403
|
-
247:
|
|
404
|
-
251:
|
|
405
|
-
300:
|
|
406
|
-
330:
|
|
407
|
-
360:
|
|
408
|
-
400:
|
|
409
|
-
420:
|
|
410
|
-
450:
|
|
411
|
-
500:
|
|
397
|
+
220: 16,
|
|
398
|
+
230: 32,
|
|
399
|
+
233: 64,
|
|
400
|
+
236: 96,
|
|
401
|
+
239: 100,
|
|
402
|
+
243: 120,
|
|
403
|
+
247: 130,
|
|
404
|
+
251: 140,
|
|
405
|
+
300: 180,
|
|
406
|
+
330: 200,
|
|
407
|
+
360: 220,
|
|
408
|
+
400: 256, # 1g
|
|
409
|
+
420: 300,
|
|
410
|
+
450: 340,
|
|
411
|
+
500: 512,
|
|
412
|
+
600: 768,
|
|
413
|
+
700: 1024,
|
|
414
|
+
750: 1280,
|
|
415
|
+
800: 5120 # 20g
|
|
412
416
|
}
|
|
413
417
|
|
|
414
418
|
ROT_CW = {"0": "r", "r": "2", "2": "l", "l": "0"}
|
|
@@ -4,14 +4,14 @@ cetragm/bag.py,sha256=qPvDmKoduJPZuwz5DMhh9rp85MUEfUPuiFsqOfJNq2U,704
|
|
|
4
4
|
cetragm/config.py,sha256=tJjbKxtwIWb3AMmIyBUosWkyHFO0OEzpYbqO5PHxz84,550
|
|
5
5
|
cetragm/controls.py,sha256=iR-ZpudiE6J92FMZmOwZlZpcOUhxfc1bWvb18VR4Cbk,3165
|
|
6
6
|
cetragm/draw.py,sha256=F4GZhNAXhxyPCksY0Pq4wjJQ904pgqCrCZ2ZDfgZHlU,6459
|
|
7
|
-
cetragm/game.py,sha256=
|
|
8
|
-
cetragm/main.py,sha256=
|
|
7
|
+
cetragm/game.py,sha256=tfIEEbtZc6VxxARGdlJ7C_jBzw-rsJU2dM8I7gPqMLk,3164
|
|
8
|
+
cetragm/main.py,sha256=G2ce_4AsKDHd6GU5oig5ScUfSqa2uaEVVoHn85C6fhw,11624
|
|
9
9
|
cetragm/player.py,sha256=9KL5cNDYCp98OB7AiVdKISCbnmSqMn0StM2Ve3OHWGE,2469
|
|
10
|
-
cetragm/srs.py,sha256=
|
|
11
|
-
cetragm/tables.py,sha256=
|
|
10
|
+
cetragm/srs.py,sha256=Fi4mOkaM_Qq716XUa1V4W1W2j4P7WsZmGnkOMbj7H2o,4865
|
|
11
|
+
cetragm/tables.py,sha256=X3XBkTqQ7mX_jYDoDD5DfhW_cM8NOp-EU6tUY5PnoSE,12285
|
|
12
12
|
cetragm/ui.txt,sha256=7wSQU8ht-5A2Fz5iFbuLTdzc1Cl6otcnqIRUw5_wZoM,2006
|
|
13
|
-
cetragm-0.1.
|
|
14
|
-
cetragm-0.1.
|
|
15
|
-
cetragm-0.1.
|
|
16
|
-
cetragm-0.1.
|
|
17
|
-
cetragm-0.1.
|
|
13
|
+
cetragm-0.1.6.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
14
|
+
cetragm-0.1.6.dist-info/WHEEL,sha256=Jb20R3Ili4n9P1fcwuLup21eQ5r9WXhs4_qy7VTrgPI,79
|
|
15
|
+
cetragm-0.1.6.dist-info/entry_points.txt,sha256=m6wjlRzXqvDPFceo250KJO4LDsEp_q2rBcCZa2lDcpo,73
|
|
16
|
+
cetragm-0.1.6.dist-info/METADATA,sha256=Hi6l9TgKtRhRz6F2UZFLvBu7g-b7W3lKav0_pHCRcuE,3134
|
|
17
|
+
cetragm-0.1.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|