User:Inge Hoonte/command line type writer

From XPUB & Lens-Based wiki

Sept 7 I'm working on an online performance event called IS THIS ON? with Birgit.
It's part of the UpStage project on 11/11/11, that we will stream live at PZI on Nov 11.
Last night, we set up the video stream and experimenting with video avatars.
Earlier this week, we brainstormed and worked on code to enable random operation of the avatars on the screen.


Inge avatar.png

Commandlinestill1.png


# goofy sentence generator
    
import random
    
def make_sentence(part1, part2, part3, part4, part5, n=1):
   """return n random sentences"""
   # convert to lists
   p1 = part1.split('\n')
   p2 = part2.split('\n')
   p3 = part3.split('\n')
   p4 = part4.split('\n')
   p5 = part5.split('\n')
   # shuffle the lists
   random.shuffle(p1)
   random.shuffle(p2)
   random.shuffle(p3)
   random.shuffle(p4)
   random.shuffle(p5)
   # concatinate the sentences
   sentence = []
   for k in range(n):
   	try:
   		s = p1[k] + ', take the avatar ' + p2[k] + ' and execute ' + p3[k] + ' make a move ' + p4[k] + ' and say ' + p5[k] 
   		s = s.capitalize() + '.'
   		sentence.append(s)
   	except IndexError:
   		break
   return sentence
    
# break a typical sentence into 5 parts
# p1: who in the audienc
part1 = """\
Birgit
Inge
The neighbor"""

# p2: which avatar
part2 = """\
tail
helen
cat"""

# p3: make action
part3 = """\
/a1
/a2
/a3"""

# p4: move avatar where?
part4 = """\
up the screen
bottom
left
anywhere"""

# p5: say this text:
part5 = """\
hallo
poop
goodbye
the world is great"""

print '-'*60

sentence = make_sentence(part1, part2, part3, part4, part5, 1)
for item in sentence:
	print item
print '-'*60

"""

"""