Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

New bot by Nico Sarubbi. #46

Merged
merged 1 commit into from

2 participants

@nicosarubbi

No description provided.

@elachuni elachuni merged commit 94228a2 into luciotorre:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 8, 2012
  1. @nicosarubbi

    New bot: Nico.

    nicosarubbi authored
This page is out of date. Refresh to see the latest.
Showing with 23 additions and 0 deletions.
  1. +23 −0 bots/nico.py
View
23 bots/nico.py
@@ -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()
Something went wrong with that request. Please try again.