Swapbot: Difference between revisions

From Hackers & Designers
No edit summary
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Article
|MainNavigation=No
}}
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:WriteMe]]
[[Category:Print]]
[[Category:Print]]
[[Category:Web]]

Latest revision as of 00:43, 28 April 2017

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