update litris with board detection
This commit is contained in:
2
field.py
2
field.py
@@ -153,8 +153,6 @@ class Field():
|
|||||||
|
|
||||||
def predict_gaps_in_next_rotation(self):
|
def predict_gaps_in_next_rotation(self):
|
||||||
tmp_state = copy(self.state)
|
tmp_state = copy(self.state)
|
||||||
if tmp_state[10][0] is not ' ' and tmp_state[10][1] is not ' ':
|
|
||||||
return 10
|
|
||||||
tmp_state = self.rotate_90_degree_anticlckwise(tmp_state)
|
tmp_state = self.rotate_90_degree_anticlckwise(tmp_state)
|
||||||
for row in range(int(self.HEIGHT/2)):
|
for row in range(int(self.HEIGHT/2)):
|
||||||
tmp_state[row] = [' ' for cols in range(Field.WIDTH)]
|
tmp_state[row] = [' ' for cols in range(Field.WIDTH)]
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class Litris(GameBase):
|
|||||||
self.move_stone(column - offset_col, rotation)
|
self.move_stone(column - offset_col, rotation)
|
||||||
self.drop_down()
|
self.drop_down()
|
||||||
print(self.field)
|
print(self.field)
|
||||||
if self.field.get_line_count() >= 6 and self.field.height() <= 1:
|
if self.field.get_line_count() >= 6 and self.field.height() <= 1 and self.field.state[19][9] == ' ':
|
||||||
if self.field.predict_gaps_in_next_rotation() <= 3:
|
if self.field.predict_gaps_in_next_rotation() <= 3:
|
||||||
self.update_move_mode()
|
self.update_move_mode()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user