16-03-2011 Danny Fabien Mirjam: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 38: Line 38:




Python script of text based adventure called 'LOST IN TOS V1.0'
<source lang="python">
<source lang="python">
#Text Adventure.py
#By Chris O'Leary


import html5lib, lxml, urllib2
import urllib2, urlparse, html5lib, lxml, random


url = "http://www.facebook.com/terms.php"
htmlsource = urllib2.urlopen(url)
htmlparser = html5lib.HTMLParser(tree=html5lib.treebuilders.getTreeBuilder("lxml"), namespaceHTMLElements=False)
page = htmlparser.parse(htmlsource)
p = page.xpath("/html/body/div[3]/div[3]/div/div/div/div/ol/li[1]")


print "".join(p[0].itertext()).strip()


gold=0
gotGold_reading = 0
gotGold_SQ = 0
gotGold_liv = 0
gotGold_draw = 0
gotGold_din = 0
monsterKilled_kid = 0
monsterKilled_Master = 0
statue = 0
gotStatue_serv = 0
gotStatue_Master = 0
gotStatue_kid = 0
gold_found1 = 0
gold_found2 = 0
gold_found3 = 0
gold_found4 = 0
gold_found5 = 0
monster_HP1 = 4
hp = 10
def help1():
    print "look, examine (object), accept, decline, take (item), call (person)"
    print "Examples: examine license, take gold, call lawyer"
    print
def start():
    print '''
        LOST IN TOS V1.0
    Facebook has taken down some of your pictures, and you have no idea why.
    You have begun a journey in the Terms of Services, in order to find out
    what happened to your pictures. At some point you start to feel trapped.
   
    Note: All instructions can be typed in lower or upper case letters.'''
    print
   
def foyer():
    global gold
    global statue
    print "    Current Gold = ",gold,
    print "    Current statues = ",statue
    print '''    You are at the entrance of the labyrinth.
   
    Type 'help' for a full list of commands.'''
    print
    prompt_foy()
def foy_desc():
    print '''    You are at the entrance of the labyrinth. You see a paper in the corner.'''
    print
    prompt_foy()
   
def prompt_foy():
    global gold
    prompt_f = raw_input("Type a command: ").lower()
    try:
        if prompt_f == "accept":
            reading_room()
        elif prompt_f == "decline":
            foyer()
        elif prompt_f == "help":
            help1()
            prompt_foy()
        elif prompt_f == "examine paper":
            print '''This agreement was written in English (US). To the extent any translated
            version of this agreement conflicts with the English version, the English version
            controls. Please note that Section 16 contains certain changes to the general terms
            for users outside the United States. Date of Last Revision: October 4, 2010. Statement
            of Rights and Responsibilities This Statement of Rights and Responsibilities (Statement)
            derives from the Facebook Principles, and governs our relationship with users and
            others who interact with Facebook.
           
            By using or accessing Facebook, you agree to this Statement.
           
            Do you agree?
            accept/decline
           
            '''
            print
            prompt_foy()
        elif prompt_f == "examine cabinet":
            print '''    The cabinet is lined with trophies, dating back to the 1800s.
            Seems this was a talented family.'''
            print
            prompt_foy()
        elif prompt_f == "look":
            foy_desc()
        elif prompt_f == "call lawyer":
            if gold < 50:
                print '''"Good afternoon, Gilbert-Lurie's lawyers office. I'm not gonna
                help you for free! Please call back when you have some money."
                tuuut... tuuut... tuuut...'''
                print
                prompt_foy()
            elif gold == 50:
                ending_floor1()
        elif prompt_f == "n":
            main_hall()
        elif prompt_f == "debug":
            fight_unicorn()
        else:
            print "That command is invalid"
            print
            prompt_foy()
    except ValueError:
        print "That command is invalid"
        print
        prompt_foy()
#randomizer readingroom
def reading_room():
#extract the terms
url = "http://www.facebook.com/terms.php"
htmlsource = urllib2.urlopen(url)
htmlparser = html5lib.HTMLParser(tree=html5lib.treebuilders.getTreeBuilder("lxml"), namespaceHTMLElements=False)
page = htmlparser.parse(htmlsource)
x = random.randint(1, 18)
p = page.xpath("/html/body/div[3]/div[3]/div/div/div/div/ol/li["+str(x)+"]/b")
l = page.xpath("/html/body/div[3]/div[3]/div/div/div/div/ol/li["+str(x)+"]")
p2 = "".join(p[0].itertext()).strip()
print "Welcome to the "+str(p2)+" room"
print "    Current Gold = ",gold,
print "    Current statues = ",statue
print
prompt_reading()
def reading_desc():
url = "http://www.facebook.com/terms.php"
htmlsource = urllib2.urlopen(url)
htmlparser = html5lib.HTMLParser(tree=html5lib.treebuilders.getTreeBuilder("lxml"), namespaceHTMLElements=False)
page = htmlparser.parse(htmlsource)
x = random.randint(1, 18)
p = page.xpath("/html/body/div[3]/div[3]/div/div/div/div/ol/li["+str(x)+"]/b")
l = page.xpath("/html/body/div[3]/div[3]/div/div/div/div/ol/li["+str(x)+"]")
print "".join(l[0].itertext()).strip()
print
prompt_reading()
def prompt_reading():
    global gold
    prompt_f = raw_input("Type a command: ").lower()
    try:
        if prompt_f == "accept":
            reading_room()
        elif prompt_f == "decline":
            foyer()
        elif prompt_f == "help":
            help1()
            prompt_reading()
        elif prompt_f == "examine paper":
            print '''This agreement was written in English (US). To the extent any translated
            version of this agreement conflicts with the English version, the English version
            controls. Please note that Section 16 contains certain changes to the general terms
            for users outside the United States. Date of Last Revision: October 4, 2010. Statement
            of Rights and Responsibilities This Statement of Rights and Responsibilities (Statement)
            derives from the Facebook Principles, and governs our relationship with users and
            others who interact with Facebook.
           
            By using or accessing Facebook, you agree to this Statement.
           
            Do you agree?
            accept/decline
           
            '''
            print
            prompt_reading()
        elif prompt_f == "examine cabinet":
            print '''    The cabinet is lined with trophies, dating back to the 1800s.
            Seems this was a talented family.'''
            print
            prompt_reading()
        elif prompt_f == "look":
            reading_desc()
        elif prompt_f == "call lawyer":
            if gold < 50:
                print '''"Good afternoon, Gilbert-Lurie's lawyers office. I'm not gonna
                help you for free! Please call back when you have some money."
                tuuut... tuuut... tuuut...'''
                print
                prompt_reading()
            elif gold == 50:
                ending_floor1()
        elif prompt_f == "n":
            main_hall()
        elif prompt_f == "debug":
            fight_unicorn()
        else:
            print "That command is invalid"
            print
            prompt_reading()
    except ValueError:
        print "That command is invalid"
        print
        prompt_reading()
start()
foyer()
</source>
</source>

Latest revision as of 16:26, 16 March 2011

Game Labyrinth / Lexicon

Mirjam, Danny, Fabien


TO DO:

- make time machine to go back in time and have extra time to work - write intro dialog

Links:
- play zork online
- python textbased adventure


Notes:
- you are in a fantasy world. you are lost in the terms of service of Facebook and you are trying to navigate through it.
- you are presented with the index of the TOS of Facebook, which corresponds to different rooms. - Quest: you've subscribed you a website, your photo's have been taken down and you're looking in the TOS to see if that was legitimate.
-- Stuff that can happen:
--- you've read 3 paragraphs and now you're too tired to read any further.
--- after a while they change the TOS again.
--- if you type 'look', you can get a reply like 'by user we mean blablabla'
--- n, s, e and w can become scroll up and down. every time a small excerpt of the TOS is presented, you feel totally lost in the documents.
--- monsters in a room that steal data (you've been tagged, you want to take your tag down but you can't) you can tag with a dagger.
--- angry email from your friend 'where are the photo's from the party??'
--- you find a note with a lawyers number on it. when you call with your cellphone you find out you need 50 gold to hire the lawyer to get your photo back. (this is a wildcard, when you call the lawyer he fixes the problems for you by going through the TOS for you. Otherwise you have to play the game/go through the TOS yourself).

How to make money?:
Expansion could be: you can ascii draw paintings and sell them on Etsy >> another TOS!
Objects you find, you can sell them on Ebay >> another TOS

Levels :
First floor :
Room1 Privacy, Room2 Sharing Content and Information, Room3 Safety, Room4 Registration and Account Security.
Second floor



Python script of text based adventure called 'LOST IN TOS V1.0'

#Text Adventure.py
#By Chris O'Leary

import urllib2, urlparse, html5lib, lxml, random




gold=0
gotGold_reading = 0
gotGold_SQ = 0
gotGold_liv = 0
gotGold_draw = 0
gotGold_din = 0
monsterKilled_kid = 0
monsterKilled_Master = 0
statue = 0
gotStatue_serv = 0
gotStatue_Master = 0
gotStatue_kid = 0
gold_found1 = 0
gold_found2 = 0
gold_found3 = 0
gold_found4 = 0
gold_found5 = 0
monster_HP1 = 4
hp = 10
def help1():
    print "look, examine (object), accept, decline, take (item), call (person)"
    print "Examples: examine license, take gold, call lawyer"
    print
def start():
    print '''
        LOST IN TOS V1.0
    Facebook has taken down some of your pictures, and you have no idea why.
    You have begun a journey in the Terms of Services, in order to find out
    what happened to your pictures. At some point you start to feel trapped.
    
    Note: All instructions can be typed in lower or upper case letters.'''
    print
    
def foyer():
    global gold
    global statue
    print "     Current Gold = ",gold,
    print "     Current statues = ",statue 
    print '''    You are at the entrance of the labyrinth.
    
    Type 'help' for a full list of commands.'''
    print
    prompt_foy()
def foy_desc():
    print '''    You are at the entrance of the labyrinth. You see a paper in the corner.'''
    print
    prompt_foy()
    
def prompt_foy():
    global gold
    prompt_f = raw_input("Type a command: ").lower()
    try:
        if prompt_f == "accept":
            reading_room()
        elif prompt_f == "decline":
            foyer()
        elif prompt_f == "help":
            help1()
            prompt_foy()
        elif prompt_f == "examine paper":
            print '''This agreement was written in English (US). To the extent any translated 
            version of this agreement conflicts with the English version, the English version 
            controls. Please note that Section 16 contains certain changes to the general terms 
            for users outside the United States. Date of Last Revision: October 4, 2010. Statement 
            of Rights and Responsibilities This Statement of Rights and Responsibilities (Statement)
            derives from the Facebook Principles, and governs our relationship with users and 
            others who interact with Facebook. 
            
            By using or accessing Facebook, you agree to this Statement.
            
            Do you agree?
            accept/decline
            
            '''
            print
            prompt_foy()
        elif prompt_f == "examine cabinet":
            print '''    The cabinet is lined with trophies, dating back to the 1800s.
            Seems this was a talented family.'''
            print
            prompt_foy()
        elif prompt_f == "look":
            foy_desc()
        elif prompt_f == "call lawyer":
            if gold < 50:
                print '''"Good afternoon, Gilbert-Lurie's lawyers office. I'm not gonna 
                help you for free! Please call back when you have some money."
                tuuut... tuuut... tuuut...'''
                print
                prompt_foy()
            elif gold == 50:
                ending_floor1()
        elif prompt_f == "n":
            main_hall()
        elif prompt_f == "debug":
            fight_unicorn()
        else:
            print "That command is invalid"
            print
            prompt_foy()
    except ValueError:
        print "That command is invalid"
        print
        prompt_foy()

#randomizer readingroom
def reading_room():
#extract the terms
	
	url = "http://www.facebook.com/terms.php"
	 
	htmlsource = urllib2.urlopen(url)
	htmlparser = html5lib.HTMLParser(tree=html5lib.treebuilders.getTreeBuilder("lxml"), namespaceHTMLElements=False)
	page = htmlparser.parse(htmlsource)
	x = random.randint(1, 18)
	p = page.xpath("/html/body/div[3]/div[3]/div/div/div/div/ol/li["+str(x)+"]/b")
	l = page.xpath("/html/body/div[3]/div[3]/div/div/div/div/ol/li["+str(x)+"]")
	
	p2 = "".join(p[0].itertext()).strip()
	print "Welcome to the "+str(p2)+" room" 


	print "     Current Gold = ",gold,
	print "     Current statues = ",statue 
	print
	prompt_reading()
def reading_desc():
	url = "http://www.facebook.com/terms.php"
	 
	htmlsource = urllib2.urlopen(url)
	htmlparser = html5lib.HTMLParser(tree=html5lib.treebuilders.getTreeBuilder("lxml"), namespaceHTMLElements=False)
	page = htmlparser.parse(htmlsource)
	x = random.randint(1, 18)
	p = page.xpath("/html/body/div[3]/div[3]/div/div/div/div/ol/li["+str(x)+"]/b")
	l = page.xpath("/html/body/div[3]/div[3]/div/div/div/div/ol/li["+str(x)+"]")
	
	print "".join(l[0].itertext()).strip()
	
	print
	prompt_reading()
	
def prompt_reading():
    global gold
    prompt_f = raw_input("Type a command: ").lower()
    try:
        if prompt_f == "accept":
            reading_room()
        elif prompt_f == "decline":
            foyer()
        elif prompt_f == "help":
            help1()
            prompt_reading()
        elif prompt_f == "examine paper":
            print '''This agreement was written in English (US). To the extent any translated 
            version of this agreement conflicts with the English version, the English version 
            controls. Please note that Section 16 contains certain changes to the general terms 
            for users outside the United States. Date of Last Revision: October 4, 2010. Statement 
            of Rights and Responsibilities This Statement of Rights and Responsibilities (Statement)
            derives from the Facebook Principles, and governs our relationship with users and 
            others who interact with Facebook. 
            
            By using or accessing Facebook, you agree to this Statement.
            
            Do you agree?
            accept/decline
            
            '''
            print
            prompt_reading()
        elif prompt_f == "examine cabinet":
            print '''    The cabinet is lined with trophies, dating back to the 1800s.
            Seems this was a talented family.'''
            print
            prompt_reading()
        elif prompt_f == "look":
            reading_desc()
        elif prompt_f == "call lawyer":
            if gold < 50:
                print '''"Good afternoon, Gilbert-Lurie's lawyers office. I'm not gonna 
                help you for free! Please call back when you have some money."
                tuuut... tuuut... tuuut...'''
                print
                prompt_reading()
            elif gold == 50:
                ending_floor1()
        elif prompt_f == "n":
            main_hall()
        elif prompt_f == "debug":
            fight_unicorn()
        else:
            print "That command is invalid"
            print
            prompt_reading()
    except ValueError:
        print "That command is invalid"
        print
        prompt_reading()



start()
foyer()