Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shuffles g1 and g2 every time through the loop: #334

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jasonmastbaum
Copy link
Collaborator

I'm pretty sure the current player assignment loop will just always pop the same two players from any given pair of games. This shuffles the player list in g1 and g2 every pass through the loop as an additional step.

@UEWBot
Copy link
Owner

UEWBot commented Feb 4, 2025

Looks like g1 and g2 are sets, not lists, so we can't shuffle them (in fact they don't have an ordering).
set.pop() apparently removes a random element.

@jasonmastbaum
Copy link
Collaborator Author

Ah. I ran a simple test of this looping through popping from a set and adding the popped element back and it looks like it's not exactly random, and just iterates through the elements of the set. But maybe for what we're doing that's close enough to random. I'd need to write more tests to try to figure out if the way _improve_fitness is set up, if every time it picks a given game, it'll start popping from the place it left off the last time it picked that game, or if it'll go back to the start of the sequence.

image

@jasonmastbaum
Copy link
Collaborator Author

If it does matter, I'm guessing it wouldn't be a big performance hit to make temp copies of g1 and g2 that are lists, do the sampling, then alter the sets if necessary, since it's just two seven-element lists on each iteration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants