Closed chucker closed 9 months ago
Game ID's could be seeded the same way the GuessGame
currently chooses a target language: it gets a seeding function injected in its constructor and seeds a PRNG to randomly select a language from all available. The game ID could just be 16 random bytes interpreted as UUID.
I'm honestly not sure if I really want to keep the GuessGame
. This was never meant to be built upon and was just prototyping what could work.
What we could do now:
GuessGame
just determine a language based on a seeding function and a list of available languages.GuessGame
to LanguageChooser
(or sth like that)PlayedGame
to GameInstance
and make it the base class for all possible game modes. It may keep track of the target language, guesses made and some other metadata not related the any specific game modePropertyGuessingGameInstance
that extends GameInstance
and keeps track of information related to the guessing game currently implementedCodeSnippetGuessingGameInstance
that also extends GameInstance
and keeps track of information for this game mode.What do you think?
edit: see also #2
Also, why only partially? It'd say this fixes #22.
Also, why only partially? It'd say this fixes #22.
Chiefly because it doesn't provide an answer to "so you can continue later with the same state." Like, if this implementation is a bad approach to make that possible later, then…
- Rename
GuessGame
toLanguageChooser
(or sth like that)
GameController
? (Pun intended.)
Or GameInitializer
, perhaps. But if we name it that, then GuessAsync()
should probably move to GameInstance
.
- Rename
PlayedGame
toGameInstance
and make it the base class for all possible game modes. It may keep track of the target language, guesses made and some other metadata not related the any specific game mode
Sure.
Or GameInitializer, perhaps.
Agreed.
GuessAsync() should probably move to GameInstance.
I'm not really sure about this change.
…no I didn't?
This partially implements #22.
This splits
GuessGame
andPlayedGame
(not sure about the name; it's used for both currently played games and previously played games), so that the former can beasync
and the latter can be serialized. Arguably,GuessGame
is a controller, andPlayedGame
a model.It then stores games in local storage, which guesses have been made vs. what the target is, and finally whether the game has been won:
The idea behind storing
TargetLanguageId
is to recover, later on, whether it's the same game. This probably isn't a foolproof way. I'm not sure how we want to distinguish game "IDs"; perhaps by seed?