Skip to content

Commit

Permalink
fixed some constraint randomizer problems
Browse files Browse the repository at this point in the history
  • Loading branch information
orithena committed Jun 23, 2017
1 parent d57c14c commit b292cd0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/moerderklassen.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,14 +420,15 @@ def start(self, players, rounds):
if round.getInitialVictim(k.player) is not None and self.getInitialVictim(k.player).player.id == round.getInitialVictim(k.player).player.id:
reshuffles.add(k)
for k in self.participants:
if self.getInitialVictim(k).player.info == k.player.info:
# TODO: analyze info buckets. if not enough buckets, it shouldn't be a constraint.
if len(k.player.info) > 1 and self.getInitialVictim(k).player.info == k.player.info:
reshuffles.add(k)
if len(reshuffles) == 0:
break
for k in reshuffles:
self.participants.remove(k)
for k in reshuffles:
self.participants.insert( random.randint(0, len(self.participants)-1), k )
self.participants.insert( max(len(self.participants)-1, random.randint(0, len(self.participants))), k )
iterations += 1


Expand Down

0 comments on commit b292cd0

Please sign in to comment.