I'm learning python 2.7, im trying to finish the basic in programming to moving on to python 3.0. I came across this code from my book Learn python the hard way- Zed A. Shaw:
from sys import exit
from random import randint
class Game(object):
def __init__(self, start):
self.quips =[
"You died. You kidda suck at this."
"Your mom would be proud.If she were smarter."
"Such a luser."
"I have a small puppy that's better at this."
]
self.start = start
def play(self):
next = self.start
while True:
print "\n-------"
room = getattr(self, next)
next = room()
def central_corridor(self)
[ some other functions ]
def death(self):
print self.quips[randint(0, len(self.quips)-1)]
exit(0)
a_game = Game("central_corridor")
a_game.play()
What is "next", I see it colored blue in my editor, is "next" something special? I lose track of the program's flow from the begining ( "next = self.start" confused me the most) , please help me.