User:Fabien Labeyrie/Lost in TOS

From XPUB & Lens-Based wiki


Lost in TOS



LostInTOS.JPG


Presentation


During a workshop with Nicolas Maleve where we looked at the invasion of privacy one is allowing by agreeing the Terms of Service of a website, we (Danny, Mirjam and myself) had the chance to develop the idea of a game that would explore the TOS of Facebook in a critical way. We wanted to point out how difficult it is to go through it and grasping its content.

The project


Inspired by the text adventure game Colossal Cave Adventure, we worked on a similar python script to make our own version.

The program is randomly scraping paragraphs of Facebook's TOS, implementing it in the game as elements of the gameplay.

The story


"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."
(Introduction of the game)

The player will be exploring a labyrinth where each room represents a chapter in the TOS of Facebook. The goal is find the chapter, thus the room that can help you have your picture back.

To make it through the maze, you can "look, examine (object), accept, decline, take (item), call (person)". If you "call" your "lawyer" for example, he won't help you until you found money to pay him.

The tragedy lies in that if you want to go from rooms to rooms, you have no choice but to accept every agreement you are being proposed, even if you don't understand them, otherwise you start from the beginning all over again... In fact, you only have the possibility to get lost...

The Code



#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()