Closed chucker closed 7 months ago
Actually, the seed is determined every time a GuessGame
service instance is requested (based on the current ~hour~ minute).
I thought this way we can request different instances of this service and use it in different games, but requesting them in the same hour currently leads to the same target language...
A better way might be to add a Initialize
or Seed
function where each instance deterministically seeds the random and chooses a random target language.
So for example:
GuessGame g = new();
g.Initialize("reavealer"); // initialize for the "revealer" game
// then use g.TargetLanguage to check guesses and if the game is won
// in another file...
GuessGame g = new();
g.Initialize("snippet"); // initialize for the "snippet" game
// then use g.TargetLanguage to determine the code snippet
Both GuessGame
instance may use the same seed (the day of year for example) and the Initialize
call offsets the RNG. So in the end, the GuessGame.TargetLanguage
yields the same language every day but different languages for different games.
There's a simple implementation of this at #71. I'm not opposed to redesigning GuessGame
as described here or in #42, but I think that's scope creep.
So this is essentially fixed then? The current solution produces the same results every year, but we are fine for now.
Yes, this is IMHO fixed, but I do agree GuessGame
needs a redesign. I'm not sure where to continue that conversation, but it technically doesn't belong here.
Right now, randomness gets seeded on startup. We probably want a deterministic (but not guessable?) way to get a day's game, so that people can play it in sync.