01: #!/usr/bin/env python
02: 
03: '''
04: LIFE: THE GAME
05: '''
06: character = {'stage': 'Birth'}
07: choice = {
08:     'Birth': {
09:         'description': 'You have entered the world. What will you do?',
10:         'options': '1) Go home with a family\n2) Flee the hospital to live with cats',
11:         'exits': {'1':'one', '2':'two'}
12:     },
13:     'one': {
14:         'description': 'You have chosen to go live with your family! What to do next?',
15:         'options': '1) Get a job\n2) Go to school\n3) Go live in the woods',
16:         'exits': {'1':'three', '2':'four' , '3':'five'}
17:     },
18:     'two': {
19:         'description': 'You crawl into an alley behind the hospital, filled with cats. They embrace you as their own. What to do next?',
20:         'options': '1) Go to school\n2) Go live in the woods\n3) Become cat president',
21:         'exits': {'1':'four', '2':'five' , '3':'six'}
22:     },
23:     'three': {
24:         'description': 'You decide to go get a minimum-wage job. Now what?',
25:         'options': '1) Start a family\n2) Work toward a better job',
26:         'exits': {'1':'seven', '2':'eight'}
27:     },
28:     'four': {
29:         'description': 'You have chosen to go to school. You thoroughly enjoy spending the best years of your life studying. Now what?',
30:         'options': '1) Start a family\n2) Get a hot new job',
31:         'exits': {'1':'seven', '2':'eight'}
32:     },
33:     'five': {
34:         'description': 'You take a page from Thoreau and go live in the woods. Now what?',
35:         'options': '1) Terrorize children at summer camp\n2) Become an acorn peddlar',
36:         'exits': {'1':'nine', '2':'ten'}
37:     },
38:     'six': {
39:         'description': 'After a long campaign of handing out catnip and petting kittens, you have been elected the president of cats! Now what?',
40:         'options': '1) Become somewhat normal and start a family\n2) Retire to Cat-topia',
41:         'exits': {'1':'seven', '2':'eleven'}
42:     },
43:     'seven': {
44:         'description': 'You meet someone, and create little someones. And now?',
45:         'options': '1) And...',
46:         'exits': {'1':'thirteen'}
47:     },
48:     'eight': {
49:         'description': 'You have taken an exciting job at Technology Man Co. What do you do now?',
50:         'options': '1) Slip into insanity\n2) Handle your money reasonably',
51:         'exits': {'1':'twelve', '2':'thirteen'}
52:     },
53:     'nine': {
54:         'description': '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. And now?',
55:         'options': '1) And...',
56:         'exits': {'1':'thirteen'}
57:     },
58:     'ten': {
59:         'description': 'Unfortunately, you are the only human in the woods, and squirrels are fairly good at finding acorns on their own. And now?',
60:         'options': '1) And...',
61:         'exits': {'1':'thirteen'}
62:     },
63:     'eleven': {
64:         'description': 'You have decided to retire to Cat-topia. Cat food is shaped into your image, and birds are sacrificed to you daily. And now?',
65:         'options': '1) And...',
66:         'exits': {'1':'thirteen'}
67:     },
68:     'twelve': {
69:         'description': 'You have become a deranged millionare. Your days are spent in tribal garb, and working on your "Moustaches of the Apocalypse" diorama. And now?',
70:         'options': '1) And...',
71:         'exits': {'1':'thirteen'}
72:     },
73:     'thirteen': {
74:         'description': 'Congratulations, you are dead!',
75:         'options': 'RIP in peace',
76:         'exits': {'1':'thirteen'}
77:     }
78: }
79: print "Congratulations, you have been born!"
80: while True:
81:     next = choice[character['stage']]
82:     command = raw_input(next['description'] + ' > ')
83:     command_parts = command.split(None, 1)
84:     next_stage = command_parts[0]
85:     if next_stage in ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13']:
86:         if next_stage in next['exits']:
87:             character['stage'] = next['exits'][next_stage]
88:             next = choice[character['stage']]
89:         else:
90:             print 'You cannot do that. Enter "o" for options.'
91:     elif next_stage not in ['o', 'quit', 'exit', 'stop']:
92:             print 'You cannot do that. Enter "o" for options.'
93:     if next_stage == 'o':
94:         print next['options']
95:     if next_stage in ['quit', 'exit', 'stop']:
96:         print 'Goodbye'
97:         break
98: