Update Tetris2000.py

Correction to back to back sequence detection
This commit is contained in:
adrienmalin 2018-07-31 00:01:44 +02:00 committed by GitHub
parent b2416a9e2c
commit 470f219e74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1118,12 +1118,12 @@ class Stats(QtWidgets.QWidget):
# ============================================================================== # ==============================================================================
if score: if score:
if (t_spin and nb_complete_lines) or nb_complete_lines == 4: if (t_spin and nb_complete_lines) or nb_complete_lines == 4:
if len(self.back_to_back_scores) < 1: if len(self.back_to_back_scores) > 1:
self.back_to_back_scores.append(score // 2) self.back_to_back_scores.append(score // 2)
else: else:
# The first Line Clear in the Back-to-Back sequence # The first Line Clear in the Back-to-Back sequence
# does not receive the Back-to-Back Bonus. # does not receive the Back-to-Back Bonus.
self.back_to_back_scores.append(0) self.back_to_back_scores = [0]
elif (nb_complete_lines and not t_spin) or len( elif (nb_complete_lines and not t_spin) or len(
self.back_to_back_scores self.back_to_back_scores
) == 1: ) == 1:
@ -1134,7 +1134,7 @@ class Stats(QtWidgets.QWidget):
# do not receive the Back-to-Back Bonus; instead they are scored as normal. # do not receive the Back-to-Back Bonus; instead they are scored as normal.
# They also cannot start a Back-to-Back sequence, however, # They also cannot start a Back-to-Back sequence, however,
# they do not break an existing Back-to-Back sequence. # they do not break an existing Back-to-Back sequence.
if len(self.back_to_back_scores) < 1: if len(self.back_to_back_scores) > 1:
b2b_score = sum(self.back_to_back_scores[1:]) b2b_score = sum(self.back_to_back_scores[1:])
self.score_total += b2b_score self.score_total += b2b_score
self.nb_back_to_back += 1 self.nb_back_to_back += 1