Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
relearn
2014
Commits
2ad0c3c0
Commit
2ad0c3c0
authored
Jul 11, 2014
by
cath
Browse files
Merge branch 'master' of relearn:git/relearn
parents
3fb75e1a
1998a573
Changes
2
Hide whitespace changes
Inline
Side-by-side
circles/reporter.py
View file @
2ad0c3c0
...
...
@@ -23,36 +23,36 @@ class ReportPlotBot(irc.bot.SingleServerIRCBot):
if
e
.
target
==
self
.
observechannel
:
#this change the precision of the circle
NbUsers
=
len
(
self
.
channels
[
e
.
target
].
users
())
rng
=
randint
(
1
,
6
)
#rng=1+(randint(0,100) * .01)
rng
=
randint
(
1
,
7
)
angle
=
360
/
(
NbUsers
/
rng
)
#choose a random position
pX
=
randint
(
0
,
16158
)
pY
=
randint
(
0
,
11040
)
pX
=
randint
(
-
24050
,
24050
)
pY
=
randint
(
-
17975
,
17975
)
#radius = 5000
if
e
.
target
==
self
.
observechannel
:
msg
=
e
.
arguments
[
0
]
#this count the length of a message and draws a circle accordingly
#msg = e.arguments[0]
#count = len(msg)
#size = min(count*100, 3000)
#todo='PA3000,5000;CI{0}'.format(wordcount)+','+str(angle)
#c.privmsg(self.plotchannel,str(todo))
NbWords
=
len
(
msg
.
split
())
d
=
50
for
x
in
range
(
0
,
NbWords
):
cl
=
'PA'
+
str
(
pX
)
+
','
+
str
(
pY
)
+
';CI{0}'
.
format
((
d
*
x
)
+
d
)
+
','
+
str
(
angle
)
print
cl
cl
=
spiral
(
pX
-
radius
,
pY
-
radius
,
pX
+
radius
,
pY
+
radius
,
30
,
NbWords
,
angle
)
#for x in range(0,NbWords):
# cl='PA'+str(pX)+','+str(pY)+';CI{0}'.format((d*x)+d)+','+str(angle)
# print cl
if
self
.
plotter
==
None
:
c
.
privmsg
(
self
.
plotchannel
,
str
(
cl
))
else
:
self
.
plotter
.
write
(
cl
)
posN
=
(
NbWords
*
d
)
+
20
pos
=
'PR{0},{0}'
.
format
(
posN
)
c
.
privmsg
(
self
.
plotchannel
,
'DT*,1;SI0.15,0.2;{0};LB{1}*'
.
format
(
pos
,
e
.
source
.
nick
))
def
on_join
(
self
,
c
,
e
):
if
e
.
target
==
self
.
observechannel
:
p
=
randint
(
1
,
4
)
#
def on_join(self, c, e):
#
if e.target == self.observechannel:
#
p=randint(1,4)
#this adds the random pen select on login of new user
c
.
privmsg
(
self
.
plotchannel
,
'SP{0}'
.
format
(
p
))
#
c.privmsg(self.plotchannel, 'SP{0}'.format(p))
...
...
circles/reporterplotbot.py
View file @
2ad0c3c0
import
argparse
from
threading
import
Thread
import
chiplotle
from
plotbot
import
PlotBot
from
reporter
import
ReporterPlotBot
...
...
@@ -14,7 +16,7 @@ parser.add_argument('reportnickname', help='bot nickname', default = 'Circle')
def
main
():
args
=
parser
.
parse_args
()
plotter
=
chiplotle
.
instantiate_plotters
()[
0
]
reporter
=
ReportPlotBot
(
args
.
observechannel
,
args
.
plotchannel
,
args
.
nickname
,
args
.
host
,
args
.
port
,
plotter
=
plotter
)
plot
=
PlotBot
(
False
,
plotter
,
args
.
plotchannel
,
args
.
nickname
,
args
.
host
,
args
.
port
)
Thread
(
None
,
reporter
.
start
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment