-
Notifications
You must be signed in to change notification settings - Fork 77
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
Answers will partially repeat every ~110 days #78
Comments
Today's country is a good example of why I think the selection should be more random. Hunting around in the Pacific is no joke, took me 7 honest guesses to locate today's mystery country. I play against my brother, who today avoided wasting guesses on recent mystery countries (before I started playing with him) and got it in 3. If the selection process were more random, knowing the recent countries wouldn't be a viable strategy. |
Super late in responding to this, but I have an update. For starters, using Math.random isn't an option for this game because everyone needs to have a the same mystery country for the day, and it cannot change when you refresh the page. However, the mystery countries have indeed begun to repeat, so I just updated the code with a line that will "reshuffle" the answers at the end of the month. The reason that it cannot go into effect right away is because, since the game is entirely client-side rendered, players' browsers cache the js files, and so not every player receives updates at the same time. With just over 2 weeks for the change to go into effect, I believe that all players' browsers will get the new code before the reshuffle happens. |
The country selection is only as random as the length of countries allows and periodic updates to an env value. Suggest moving to a more-random RNG instead, try: https://github.com/bryc/code/blob/master/jshash/PRNGs.md#mulberry32 |
Added a quick PR: #149 |
Due to the specific PRNG method of selecting each day's answer, on any given day, about half the time, the same answer will be chosen as 110 days previous. For example, today's (4/20's) answer would have also been the answer for 12/31. Same for 4/19 and 12/30, and 4/18 and 12/29. 4/17 and 12/28 are different: but only off by one from each other in the sorted order of countries.
Depending on your design goals, this might not even be an issue, who's going to notice. But you don't get any duplicates in a given interval of 110 answers - or at least we haven't in the last 110 days, which would be extremely unlikely with true randomness. Maybe that's a good thing though? I generated a few thousand and it looks like all the countries do get hit with equal probability in the long run, at least.
This kind of issue is pretty common to PRNGs like this,
maybe you can get better behavior just by using a prime number instead of what you're using now.[nah, mistaken.] Or just change techniques entirely, maybe just use Math.random?If you run something like this, put the output in both panels of a difftool, and delete the first 110 lines from one of them, you'll see what I mean. Probably. Difftools are stubborn sometimes
Thanks for the fun game, just got my average down to 4 today. Got curious because there hadn't been a single duplicate yet. Anyway close/delete this if it's working as intended or near enough. I guess I'm just curious if you meant for it to work this way to intentionally avoid recent duplicates.
The text was updated successfully, but these errors were encountered: