Python Game

Inspired by an ancient computer book I wrote a simple python game. In 1978 David H. Ahl edited BASIC Computer Games: Microcomputer Edition 101 Great Games to play on your home computer. I wrote a simple computer game in python.

#!/usr/bin/python3

import random

cont = True
dist = 0
mummies = 0
trvl = 0
water = 3
thirst = 5
act = 0
trbl = 0 #distance of mummies to you
life = True

print(“You stolen the necklace of Rameses III. Mummies are after you!”)

while cont == True:

print("Distance Traveled : " + str(dist))
print("0 Drink.")
print("1 Medium Pace.")
print("2 Dash.")
print("\n")
act = input("What do you do?")

print("\n\n")

if act == "1":
    print("You march through the desert...")
    dist = dist + 2
    thirst = thirst - 2

elif act == "2":
    print("You dash trough the desert...")
    dist = dist + 3
    thirst = thirst - 3    

elif act == "0":

    if water > 0:
        print("You drink water.")
        water = water - 1
        thirst = thirst + 3
        print("You have..." + str(water))
        print("drinks of water left.")

    if water <= 0:
        print("You've nothing to drink.")

else:
    print ("---Thanks for Playing---")
    cont = False

if int(act) == 1 or int(act) == 2:
    dice = random.randint(1, 6)
    if dice == 1 or dice == 2:
        print("The desert stretches beyond you.")
    elif dice == 3 or dice == 4:
        print("You are running among the sand dunes.")
    elif dice == 5:
        print("Skull of a camel stairs at you as you pass.")
    elif dice == 6:
        print("You found an oasis.")
        print("You fill your cantine water.")
        print("You have..." + str(water))
        print("drinks of water left.")




if thirst <= 1:
    print("\a---YOU NEED TO DRINK BADLY---")

if thirst < 0:
    print("---And the desert is getting to you!!!---")
    print("\a")

if thirst < -5:
    print("You surcome to thirst.")
    life = False
    cont = False


trvl = random.randint(1, 2)
mummies = mummies + trvl

trbl = dist - mummies

if trbl == 3:
    print("You do not hear the MUMMIES.")

if trbl == 2:
    print("You see the MUMMIES in the distance behind you.")

if trbl == 1:
    print("You MUMMIES are yipping at your heels.")


if mummies >= dist:
    print("The MUMMIES capture you.")
    life = False
    cont = False

if dist >= 20 and cont == True:
    print("---YOU MADE IT---")
    print("---YOU'VE FOUND THE EDGE OF THE DESERT---")
    cont = False    

print(“—-GAME OVER—“)

if life == True:
print(“You traveled ” + str(dist))
print(“With ” + str(water) + ” drinks of water remaining.”)

Leave a Reply

Your email address will not be published. Required fields are marked *