The "Game World interface" is basically just a way to not keep facts about the world in the global scope, instead using an optional game argument to functions that (in theory) includes data about the player and world state and stuff. Also, say is now game.say, and different input/output interfaces can be used (terminal by default, but any object that inherits from adventurelib.Interface and defines obj.say(string) and obj.get_command(prompt) -> str can be used for input/output.
I also updated the demo to match, deleted unused imports, and fixed an apparent error with the fallback for getting terminal size (it was try-except-else, but that would mean that the fallback is used if shutil is present iirc; it should've been try-except(try-except)).
The "Game World interface" is basically just a way to not keep facts about the world in the global scope, instead using an optional
game
argument to functions that (in theory) includes data about the player and world state and stuff. Also,say
is nowgame.say
, and different input/output interfaces can be used (terminal by default, but any object that inherits fromadventurelib.Interface
and definesobj.say(string)
andobj.get_command(prompt) -> str
can be used for input/output.I also updated the demo to match, deleted unused imports, and fixed an apparent error with the fallback for getting terminal size (it was
try-except-else
, but that would mean that the fallback is used ifshutil
is present iirc; it should've beentry-except(try-except)
).