added async stone detection thread
This commit is contained in:
15
field.py
15
field.py
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
from copy import copy
|
||||
|
||||
from tetromino import Tetromino
|
||||
|
||||
@@ -59,7 +60,7 @@ class Field():
|
||||
def rotate_state(self):
|
||||
self.state = self.rotate_90_degree_anticlckwise(self.state)
|
||||
#self.state = self.matrixflip(self.state, 'v')
|
||||
print(self.state)
|
||||
#print(self.state)
|
||||
|
||||
def get_line_count(self):
|
||||
return self.cleared_rows
|
||||
@@ -148,6 +149,18 @@ class Field():
|
||||
self._line_clear()
|
||||
return row
|
||||
|
||||
|
||||
|
||||
def predict_gaps_in_next_rotation(self):
|
||||
tmp_state = copy(self.state)
|
||||
tmp_state = self.rotate_90_degree_anticlckwise(tmp_state)
|
||||
for row in range(int(self.HEIGHT/2)):
|
||||
tmp_state[row] = [' ' for cols in range(Field.WIDTH)]
|
||||
return sum(
|
||||
["".join([row[col] for row in tmp_state]).lstrip().count(' ')
|
||||
for col in range(Field.WIDTH)])
|
||||
|
||||
|
||||
def count_gaps(self):
|
||||
"""
|
||||
Check each column one by one to make sure there are no gaps in the
|
||||
|
||||
Reference in New Issue
Block a user