#!/usr/bin/env python

def s(*lst): return '\n'.join(lst)
def d(**lst): return dict(lst)

"""
LIFE: THE GAME
"""

character = d(stage= 'birth')
choice = d(
    birth = d(
        here= 'You have entered the world. What will you do?',
        there    = d(one='Go home with a family',
                    two='Flee the hospital to live with cats')
    ),
    one = d(
        here= 'You have chosen to go live with your family!',
        there    = d(three='Get a job',
                    four='Go to school',
                    five='Go live in the woods')
    ),
    two = d(
        here= s('You crawl into an alley behind the',
                       'hospital, filled with cats. They',
                       'embrace you as their own.'),
        there= d(four='Go to school',
                five='Go live in the woods',
                six='Become cat president')
    ),
    three = d(
        here= 'You decide to go get a minimum-wage job.',
        there= d(seven='Start a family',
                eight='work toward a better job')
    ),
    four = d(
        here= s('You have chosen to go to school. ',
                'You thoroughly enjoy spending',
                'the best years of your life studying.'),
        there= d(seven='Start a family',
                eight='Get a hot new job')
    ),
    five = d(
        here= s('You take a page from Thoreau',
                       'and go live in the woods.'),
        there = d(nine='Terrorize children at summer camp',
                ten='Become an acorn peddlar')
    ),
    six = d(
        here= s('After a long campaign of handing out',
                       'catnip and petting kittens, you have',
                       'been elected the president of cats!'),
        there= d(seven='Become somewhat normal and start a family',
                 eleven='Retire to Cat-topia')
    ),
    seven  = d(
        here= 'You meet someone, and create little someones.',
        there= d(thirteen='Smiles all around...')
    ),
    eight = d(
        here= 'You have taken an exciting job at Technology Man Co.',
        there= d(twelve='Slip into insanity',
                 thirteen=' Handle your money reasonably')
    ),
    nine = d(
        here= s('After the Summer Camp for Excitable Teens',
                'is built near your cabin--and after finding',
                'a rather menacing pickaxe--you decide to',
                'dress up as an evil dwarf and terrorize',
                'summer camp goers.'),
        there= d(thirteen,'this is going well')
    ),
    ten = d(
        here= s('Unfortunately, you are the only human',
                       'in the woods, and squirrels are fairly',
                       'good at finding acorns on their own.'),
        there= '1) And...',
        exits= {'1':'thirteen'}
    ),
    elevn = d(
        here= s('You have decided to retire to Cat-topia.',
                       'Cat food is shaped into your image,'
                       'and birds are sacrificed to you daily.'),
        there= '1) And...',
        exits= {'1':'thirteen'}
    ),
    twelve = d(
        here= s('You have become a deranged millionare.',
                       'Your days are spent in tribal garb,'
                       'and working on your "Moustaches of',
                       'the Apocalypse" diorama. And now?'),
        there= '1) And...',
        exits= {'1':'thirteen'}
    ),
    thirteen = d(
        here= 'Congratulations, you are dead!',
        there= 'RIP in peace',
        exits= {'1':'thirteen'}
    )
)
#if only one choice takie it auto

print "Congratulations, you have been born!"
while True:
    next = choice[character['stage']]
    command = raw_input(next['here'] + '\nAnd Now?  > ')
    command_parts = command.split(None, 1)
    next_stage = command_parts[0]
    if next_stage in ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13']:
        if next_stage in next['exits']:
            character['stage'] = next['exits'][next_stage]
            next = choice[character['stage']]
        else:
            print 'You cannot do that. Enter "o" for there.'
    elif next_stage not in ['o', 'quit', 'exit', 'stop']:
            print 'You cannot do that. Enter "o" for there.'
    if next_stage == 'o':
	print next['there']
    if next_stage in ['quit', 'exit', 'stop']:
        print 'Goodbye'
        break
