You do not have permission to edit this page, for the following reason:
The action you have requested is limited to users in the group: Users.
Text
from: [http://92.51.132.110/~mlakova/wiki/index.php/Bot_irc_python http://92.51.132.110/~mlakova/wiki/index.php/Bot_irc_python] Introduction ------------ The Manifestos Bot/s uses Metaheaven Manifesto and Hackers Manifesto by McKenzie Wark as inputs. Each bot acts as an independent agent replacing keywords such as 'hacker/s ' with 'designer/s', 'designing' = 'hacking' etc. The aim of which is to blend them together questioning the notion of processes, approaches and roles that are often reversed. Example ------- <span style ="letter-spacing:0.5em;"> '''W e t e n d t o <u>h a c k</u> s o t h a t f o r m a n d c o n t e n t m a y o b e y d i f f e r e n t r e g i m e s .''' </span> <br> <span style ="letter-spacing:-0.08em;">'''To the <u>designer</u> there is always a surplus of possibility expressed in what is actual, the surplus of the virtual.'''</span> Run ------- * Include the txt files (HackerManifesto.txt and MetaheavenManifesto.txt) at the same dir where python scripts are. * Run the two python scripts hackerBot.py & designerBot.py at the irc chat. * Reset the time interval --sleep.time(10) / sleep.time(5) according to the rest of the bots and their behavior <pre> import sys import os from random import choice import random import re import time ################### hackerBot txt = 'MetaheavenManifesto.txt' def sentences(txt): txt = ''.join(open(txt).readlines()) basket = re.split(r' *[\.\?!][\'"\)\]]* *', txt) sentence = random.choice(basket) replaced = sentence.replace("designer" , "hacker").replace("design", "hack").replace("desiners", "hackers").replace("Designers" , "Hackers").replace("designing" , "hacking") tokens = ' '.join(replaced.replace('\n', '') +".") return tokens if tokens == '.': tokens = ' '.join(replaced.replace('.', '') ) print """ :::======= :::==== :::= === ::: :::===== :::===== :::=== :::==== :::==== ::: === === ::: === :::===== ::: ::: ::: ::: :::==== ::: === === === === ======== ======== === ====== ====== ===== === === === === === === === === ==== === === === === === === === === === === === === === === === ======== ====== === ====== """ while True: replaced = sentences(txt) tstr = time.strftime("%H:%M:%S", time.localtime()) out = u"({0}) {1}".format(tstr, "_HackerBot") sys.stdout.write(out.encode("utf-8")+"\n") sys.stdout.flush() # change a sentence every 5 sec time.sleep(10) print replaced </pre> [[Category:DIY Manual]] [[Category:WriteMe]] [[Category:Print]] [[Category:Web]]
Save page Show preview Show changes Cancel