Giter Club home page Giter Club logo

python-game's Introduction

My text-based console game of chance, written in Python as an exercise from Zed A. Shaw's Learn Python the Hard Way book. Written during Hacker School, Batch[4], Fall 2012.

Usage

Run this command: python my_game.py. The rest is pretty straightforward. Type your response when prompted. The rules are outlined below.

Rules

  • Win when you reach level 10
  • Die if you run out of health points (10 max)

Minigames

All the minigames are based on chance.

Fight a Monster

Fight a monster whose level is randomly chosen between 1 and 10

  • If your level is higher, you automatically win and gain a level.
  • Otherwise if you fight:
    • you have a 30% chance of defeating the monster and gaining 2 levels.
    • or you lose a level and 4 health points.
  • Or you run away:
    • you have a 50% chance of running away unharmed
    • else you lose 2 health points

Coin Flip

Guess heads or tails.

  • If you are right, you gain a level.

Rock Paper Scissors

Best of 1. Your hand against the computer.

  • If you win, you gain a level.

Todo/Extension Ideas

  • Use re regex module for better text input handling.
  • Add help to explain rules.

Resources

python-game's People

Contributors

heyhuyen avatar

Watchers

James Cloos avatar  avatar

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.