Skip to content

Commit

Permalink
Merge pull request #46 from nicosarubbi/master
Browse files Browse the repository at this point in the history
New bot by Nico Sarubbi.
  • Loading branch information
elachuni committed Jul 8, 2012
2 parents d5e2ea5 + c707d4d commit 94228a2
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions bots/nico.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from twisted.internet.protocol import ClientFactory
from twisted.internet import reactor
from random import random

import spacecraft


class NicoClient(spacecraft.server.ClientBase):
name = 'nico bot'
def messageReceived(self, message):
self.command("throttle", value=1)
self.command("fire")
if random() < 0.2:
self.command("turn", value=1)

def main():
factory = ClientFactory()
factory.protocol = NicoClient
reactor.connectTCP("localhost", 11106, factory)

if __name__ == "__main__":
reactor.callWhenRunning(main)
reactor.run()

0 comments on commit 94228a2

Please sign in to comment.