diff options
author | Olivier Gayot <olivier.gayot@sigexec.com> | 2021-12-22 14:36:43 +0100 |
---|---|---|
committer | Olivier Gayot <olivier.gayot@sigexec.com> | 2021-12-22 14:41:56 +0100 |
commit | 35014b1f291045fbe37afd8601072a9c5856cbf4 (patch) | |
tree | 6543aa2d7cf8b14c94b4f5ecf8e56aefd7a98c88 /cameltris/playfield.py | |
parent | e80345eb462bb78eb691db9aec4e34995dc8b8c7 (diff) |
Construct new empty rows using list repetition
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'cameltris/playfield.py')
-rw-r--r-- | cameltris/playfield.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cameltris/playfield.py b/cameltris/playfield.py index d1f4e9d..2e432b2 100644 --- a/cameltris/playfield.py +++ b/cameltris/playfield.py @@ -1,6 +1,6 @@ class PlayField: def __init__(self): - self.grid = [[None for _ in range(10)] for _ in range(20)] + self.grid = [[None] * 10 for _ in range(20)] def burn_rows(self) -> int: """ Burn rows that can be filled and return how many of them were burnt """ @@ -11,7 +11,7 @@ class PlayField: rows_to_burn.append(row) for row in rows_to_burn: - self.grid.insert(0, [None for _ in range(10)]) + self.grid.insert(0, [None] * 10) self.grid.remove(row) return len(rows_to_burn) |