jeudi 27 août 2015

Block choice of same data pool when random.shuffle

I am working on a code that looks at choices in a mutliple trial game. There are four choice (A,B,C,D) options and four payoff pools (pool_1, pool_2, pool_3 and pool_4). Each choice is asssigned to one pool (A - pool_1 etc). I want to randomly shuffle the pools once 5 in 6 choices have been the same (e.g. AAABAA -> change pool_1 to any other BUT pool_1).

For now I have coded it the way that after 5 streaks (5 choices in a row) the pools change. I just do not manage to have the pools change after 5 in 6 choices have been the same and also sometimes the same pool gets randomly selected again, which I do not want.

if (streak % 5) == 0 : pools = [pool_1, pool_2, pool_3, pool_4] random.shuffle(pools)

work1 = pools[0]
work2 = pools[1]
work3 = pools[2]
work4 = pools[3]

Any help is appreaciated -thank you!




Aucun commentaire:

Enregistrer un commentaire