Skip to content

Latest commit

 

History

History
63 lines (39 loc) · 2.46 KB

README.md

File metadata and controls

63 lines (39 loc) · 2.46 KB

zorkdemo

Python build and test Open in Codespaces

Runs on Linux, Windows or Mac.

A (much simplified) port of a famous adventure game to help teach my daughter how to program in Python.

Two easy ways to launch the console project:

  1. Click on the Open with GitHub Codespaces badge above to launch the project in a browser or on your desktop inside Visual Studio Code, then type poetry run python zorkdemo.py in the terminal window.
  2. Download one of the binary releases and run the file on your system.

NOTE: the MacOS version does not have code signing built into it yet (that's next on my list!). To run it, you will need to set the binary as executable with chmod 755 or similar, and after trying to run it once, go through System Preferences: Security and Privacy: General and "Allow the program to run anyway".

Web (Hug) version

  • Install Python 3.8.1 or higher
  • Install Poetry
  • At a command prompt in the project directory, type poetry install to set up dependencies

Next. set the flask application environment variables:

The easiest option is to create a .env file in the root of the project with the contents:

SECRET_KEY="<some random key>"

alternatively, you can manually set your environment variables for your terminal session but you'll have to remember to do that for every new session.

EXPORT SECRET_KEY="<put something random here>"

Running the development web server

In the root of the project, run:

hug -m web.app

Navigate in your browser to:

http://localhost:8000/

Have Fun!

If you want to restart delete your sid cookie from your browser and refresh the page.

NOTE: future versions should provide a link to an endpoint to achieve something like this.

Or, you could delete your session record from the Sqlite database.

Web TODO Items

  • make endsession actually work
  • provide link to endsession
  • alignment between input and output for seamless experience
  • figure out how to handle quit/exit
  • wsgi file for hooking this up to a real web server and hosting