Browse Source

Fixed full line deletion

feature/balanceutils
klonfish 8 years ago committed by klonfish
parent
commit
5f4a99fe2a
  1. 6
      ttrs.py

6
ttrs.py

@ -250,6 +250,8 @@ class TestTtrsPlayer(TtrsPlayer):
self.__process_events() self.__process_events()
return self.__quit return self.__quit
def reset_rotate(self):
pass
class BalanceTtrsPlayer(TtrsPlayer): class BalanceTtrsPlayer(TtrsPlayer):
def __init__(self, playground, addr, player_id): def __init__(self, playground, addr, player_id):
@ -359,12 +361,14 @@ class TtrsGame():
if b.pos.y in to_remove: if b.pos.y in to_remove:
self.playground.blocks.remove(b) self.playground.blocks.remove(b)
to_add = set()
for b in list(self.playground.blocks): for b in list(self.playground.blocks):
o = len(list(filter(lambda y: y > b.pos.y, to_remove))) o = len(list(filter(lambda y: y > b.pos.y, to_remove)))
if o > 0: if o > 0:
self.playground.blocks.remove(b) self.playground.blocks.remove(b)
newb = Block(b.pos + Point(0, o), b.color) newb = Block(b.pos + Point(0, o), b.color)
self.playground.blocks.add(newb) to_add.add(newb)
self.playground.blocks.update(to_add)
if ticks - lastfall >= FALL_INTERVAL or self.player.get_drop(): if ticks - lastfall >= FALL_INTERVAL or self.player.get_drop():
lastfall = ticks lastfall = ticks

Loading…
Cancel
Save