Swapbot

From Hackers & Designers
Jump to: navigation, search
MainNavigation No

from: 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


W e t e n d t o h a c k 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 .

To the designer there is always a surplus of possibility expressed in what is actual, the surplus of the virtual.


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



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