Multiban (was Re: Sokoban)

Seo Sanghyeon unendliche at hanmail.net
Wed Aug 14 09:13:18 CEST 2002


> def rewinder(event, canvas, level, idtable):
>     ...
>     if lastmove == '+':
>         pos = curpos(level)
>         fill(canvas, level, idtable, 'player', pos, INACTIVE)
>         pid = pid - 1
>         if pid == -1:
>             pid = 0
>         level.save({'pid': pid})
>         pos = curpos(level)
>         fill(canvas, level, idtable, 'player', pos, ACTIVE)
>         return

This is wrong. It should be this way:

> def rewinder(event, canvas, level, idtable):
>     ...
>     if lastmove == '+':
>         pidlimit = len(pidtable.keys())
>         pos = curpos(level)
>         fill(canvas, level, idtable, 'player', pos, INACTIVE)
>         if pid == 0:
>             pid = pidlimit
>         pid = pid - 1
>         level.save({'pid': pid})
>         pos = curpos(level)
>         fill(canvas, level, idtable, 'player', pos, ACTIVE)
>         return



More information about the Python-list mailing list