Subject: Re: programming
From: "Karen Lancaster" <lancaster.karen@gmail.com>
Date: 7/21/08, 10:49
To: "Barrett Brown" <barriticus@gmail.com>

Geez, that's very cool. What are you going to do with this game -- try to market it or is it just for fun?

On Mon, Jul 21, 2008 at 9:47 AM, Barrett Brown <barriticus@gmail.com> wrote:
Here's another version with notations I made to describe each function (notations are designated by "#"):


health = 10
money = 1
population = 0

def goblinshot(dmg): # An action whereby a goblin attacks the "player," reducing global health and printing out its new value.

    global health
    health = health - dmg
    print "You're now down to", health,"health!"

def goblinheal(healing): # An action whereby a goblin heals the "player," increasing global health and printing out its new value.

    global health
    health = health + healing
    print "You now have", health,"health! Hooray!"

class Character: # Characters that exist in the world.
   
    "These are characters! They're such characters!"
              
class Goblin(Character): # A class of character with 5 hp.
   
    def _del_(self):

        global population
        population = population - 1
        print "No, really."
        print population
       
    def checkDeath(self):
        if self.hitPoints < 1:
            print "This goblin has died!"
       
    def __init__(self): # Prints news of arrival, name of goblin; removes name from global goblinList; states remaining hitPoints

        self.hitPoints = 5
        self.name = goblinList[0]
        print "Someone new shows up!"
        print "He says, 'Hi, I'm", self.name,"'"
        goblinList[0:1] = []
        print goblinList
        print "'I have", self.hitPoints,"hit points left!', he says for some reason."

        global population
        population = population + 1
        print "'There are",population,"goblins here!' he notes."
        running = True
        while running:
            if self.hitPoints < 1:
                print "This goblin has died!"
                running = False
            else:
                running = False
               
               
   

       
    def regattack(self): # Activates goblinshot with parameter of one, announces this

        print "The goblin punches you!"
        goblinshot(1)

class GoodGoblin(Goblin): # A class of goblin with five dollars and the ability to heal "player," add money to global total

    money = 5

    def _init_(self):
        self.money = money
   
    def healsyou(self): # Activates goblinheal with parameter of one, announces this

        print "The goblin heals you a little bit!"
        goblinheal(1)
   
    def giveMoney(self): # Subtracts a dollar from goblin, adds to global money total, announces this

        print "The goblin drops a dollar!"
        self.money = self.money - 1
        print "He now has",
        print self.money, "dollars!"
        global money
        money = money + 1
        print "You pick up the dollar!"
        print "You now have", money,"dollars!"
       
class NigerianGoblin(Goblin): # A class of goblin with no money
    money = 0
    hitPoints = 4
   
    def _init_(self):
        self.money = money
        self.hitPoints = hitPoints

   
    def goChoppa(self):
        print "The goblin go choppa your dolla!"
        global money
        money = money - 1
        print "You now have", money,"dollars!"
        self.money = self.money + 1
        print "The goblin now has",self.money,"dollars!"

class monkGoblin(Goblin): # A class of goblin that punches the fuck out of itself and dies.
    money = 0
   
    def _init_(self):
        self.money = money
        self.hitPoints = hitPoints   
   
    def hurtMe(self):
        self.hitPoints = self.hitPoints - 1
        print "The goblin punches itself!"
        print "The goblin only has", self.hitPoints,"hit points left!"
        self.checkDeath()
   
   
class goblinWorld: #The environment in which the goblins act.
    running = True
    while running:
        print "Let there be light!"
        global health
        print "You have", health,"health."
        global money
        print "You have", money,"money."
        running = False


goblinList = ['Grandmaster Flash', 'Thuggy McPicklephile', 'Bob Deathstrike', 'Loki Lackluster', 'Cyberviking X', 'Chuck D', 'Osama bin Smokin']

yoko = monkGoblin()
yoko.hurtMe()
yoko.hurtMe()
yoko.hurtMe()
yoko.hurtMe()
yoko.hurtMe()
yoko.hurtMe()







On Mon, Jul 21, 2008 at 10:45 AM, Karen Lancaster <lancaster.karen@gmail.com> wrote:
Wow, how can I see it in layman's terms?


On Mon, Jul 21, 2008 at 9:44 AM, Barrett Brown <barriticus@gmail.com> wrote:
I wrote this:

health = 10
money = 1
population = 0

def goblinshot(dmg):
    global health
    health = health - dmg
    print "You're now down to", health,"health!"

def goblinheal(healing):
    global health
    health = health + healing
    print "You now have", health,"health! Hooray!"

class Character:
   
    def __init__():
        self.name = name
        self.hitPoints = hitPoints
       
    def printName(self):
        global population
        population = population + 1
   
    def howMany(self):
        global population
        if population == 1:
            print "'It's just me and you!' he exclaims."
        else:
            print "'I'm here with", population - 1,"other characters.'"
       
    def regAttack(self):
        print "Attack"
       
    def healsYou(self):
        print "Heals"
              
class Goblin(Character):
   
    def __init__(self):
        self.hitPoints = 5
        self.name = goblinList[0]
        print "Someone new shows up!"
        print "He says, 'Hi, I'm", self.name,"'"
        goblinList[0:1] = []
        print goblinList
        print "'I have", self.hitPoints,"hit points left!', he says."
           
    def regattack(self):
        print "The goblin punches you!"
        goblinshot(1)

class GoodGoblin(Goblin):
    money = 5
   
    def _init_(self):
        self.hitPoints = 3
        print "I have",money,"money!"
   
    def healsyou(self):
        print "The goblin heals you a little bit!"
        goblinheal(1)
    def giveMoney(self):
        print "The goblin drops a dollar!"
        self.money = self.money - 1
        print "He now has",
        print self.money, "dollars!"
        global money
        money = money + 1
        print "You pick up the dollar!"
        print "You now have", money,"dollars!"
       
class NigerianGoblin(Goblin):
   
    def goChoppa(self):
        print "The goblin go choppa your dolla!"
        global money
        money = money - 1
        print "You now have", money,"dollars!"
   

goblinList = ['Grandmaster Flash', 'Thuggy McPicklephile', 'Bob Deathstrike', 'Loki Lackluster', 'Cyberviking X', 'Chuck D', 'Osama bin Smokin']


Bob = Goblin()
Bob.printName()
Bob.howMany()
Bob.regattack()
Bob.regattack()
Bob.regattack()
Bob.regattack()


barrett = GoodGoblin()
barrett.printName()
barrett.howMany()
barrett.healsyou()
barrett.giveMoney()

Berkman = NigerianGoblin()
Berkman.printName()
Berkman.regattack()
Berkman.goChoppa()


       



--
KAREN LANCASTER, WRITER/EDITOR
3419 Westminster Ave., Box 25
Dallas, TX 75205
(214) 914-0455
lancaster.karen@gmail.com




--
KAREN LANCASTER, WRITER/EDITOR
3419 Westminster Ave., Box 25
Dallas, TX 75205
(214) 914-0455
lancaster.karen@gmail.com