day11: remove another 2 dict-accesses
This commit is contained in:
parent
6df1f468d3
commit
033a31a7c0
6
day11.py
6
day11.py
@ -55,8 +55,10 @@ def simulate(layout, max_x, max_y, wide=False):
|
||||
occupied_seats += layout[(test_x, test_y)]
|
||||
break
|
||||
|
||||
if (layout[(x, y)] and occupied_seats >= max_seats_occupied) or (not layout[(x, y)] and occupied_seats == 0):
|
||||
new_layout[(x, y)] = not layout[(x, y)]
|
||||
if occupied_seats >= max_seats_occupied:
|
||||
new_layout[(x, y)] = False
|
||||
elif occupied_seats == 0:
|
||||
new_layout[(x, y)] = True
|
||||
else:
|
||||
new_layout[(x, y)] = layout[(x, y)]
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user