Giter Site home page Giter Site logo

bcorfman / zorkdemo Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 1.0 142 KB

Can you code a Zork adventure game demo in Python and have fun too? Why yes.

License: MIT License

Python 94.27% HTML 5.43% Shell 0.30%
adventure-game-engine hug zork console-game rich webapp python python3 devops github-actions

zorkdemo's Introduction

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

zorkdemo's People

Contributors

bcorfman avatar swilcox avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

swilcox

zorkdemo's Issues

Fix web formatting

HTML output is missing appropriate line feeds that are in the console version, so room descriptions that should be formatted as separate paragraphs are a single paragraph instead. (See the "West of House" description in the image below.)

Screen Shot 2021-02-27 at 7 04 26 PM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.