-
Notifications
You must be signed in to change notification settings - Fork 0
/
_test.py
68 lines (58 loc) · 1.57 KB
/
_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import pygame
from settings import *
from game_field import GameField
pygame.init()
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
playfield = GameField()
last_x_index = len(playfield.map[0]) - 1
last_y_index = len(playfield.map) - 1
s_a = []
s_b = []
# Incres diaf
# Move diagonal to the right
for k in range(len(playfield.map[0])):
s = ''
for i in range(len(playfield.map)):
x = i + k
y = i
if 0 <= x <= last_x_index and 0 <= y <= last_y_index:
s += str(playfield.map[-y][x])
if '11111' in s or '22222' in s:
pass
s_a.append(s)
# Move diagonal up
for k in range(1, len(playfield.map)):
s = ''
for i in range(len(playfield.map)):
x = i
y = i + k
if 0 <= x <= last_x_index and 0 <= y <= last_y_index:
s += str(playfield.map[-y][x])
if '11111' in s or '22222' in s:
pass
s_a.append(s)
# Deced diag
# Move diagonal to the right
for k in range(len(playfield.map[0])):
s = ''
for i in range(len(playfield.map)):
x = i + k
y = i
if 0 <= x <= last_x_index and 0 <= y <= last_y_index:
s += str(playfield.map[y][x])
if '11111' in s or '22222' in s:
pass
s_b.append(s)
# Move diagonal down
for k in range(1, len(playfield.map)):
s = ''
for i in range(len(playfield.map)):
x = i
y = i + k
if 0 <= x <= last_x_index and 0 <= y <= last_y_index:
s += str(playfield.map[y][x])
if '11111' in s or '22222' in s:
pass
s_b.append(s)
print(s_a)
print(s_b)