BirdBrain v. 1.0 Code

#!/bin/sh
#!/usr/bin/python

import sys

import telnetlib
newline="/r/n"
bot = telnetlib.Telnet("167.114.65.195", 5000)
user = "MindlessComputer"
bot.write((user + "\n").encode('ascii'))
password = "xxxxxxx"
bot.write((password + "\n").encode('ascii'))

script = "finger"
bot.write((script + "\n").encode('ascii'))
script = "t josecapablanca hello"
bot.write((script + "\n").encode('ascii'))

while bot:
  response = bot.read_very_eager()
  import re
  # the parenthesis create a group with what was matched
  # and '\w' matches only alphanumeric charactes
  p = re.compile(rb"^\n\r(\w+)[^ ]* tells you: (.+)")
  q = re.compile(rb"Your seek matches one posted by (\w+)\.")
  # use search(), so the match doesn't have to happen
  # at the beginning of "big string"
  m = p.search(response)
  n = q.search(response)
  # search() returns a Match object with information about what was matched
  if m:
      name = m.group(1).decode('ascii')
  if n:
      name = n.group(1).decode('ascii')
  if b"JoseCapablanca tells you: seek" in response:
    bot.write(("seek 3 0" + "\n").encode('ascii'))
  if b"accepts your seek" in response:
      a = "accept"
      bot.write((a + "\n").encode('ascii'))
      bot.write(("kib I am a mindless computer -- hope you enjoy the game!" + "\n").encode('ascii'))
      bot.write(("finger" + "\n").encode('ascii'))
      from threading import Thread
      def mindlessplay():
          while True:
            import time
            time.sleep(.3)
            bot.write(("Nc3" + "\n").encode('ascii'))
            bot.write(("Nc6" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Nb1" + "\n").encode('ascii'))
            bot.write(("Nb8" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("a3" + "\n").encode('ascii'))
            bot.write(("a6" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Ra7" + "\n").encode('ascii'))
            bot.write(("Ra2" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Ra8" + "\n").encode('ascii'))
            bot.write(("Ra1" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Nf3" + "\n").encode('ascii'))
            bot.write(("Nf6" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Ng1" + "\n").encode('ascii'))
            bot.write(("Ng8" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Bd2" + "\n").encode('ascii'))
            bot.write(("Bd7" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Qd2" + "\n").encode('ascii'))
            bot.write(("Qd7" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kd1" + "\n").encode('ascii'))
            bot.write(("Kd8" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Ke1" + "\n").encode('ascii'))
            bot.write(("Ke8" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("gf" + "\n").encode('ascii'))
            bot.write(("ef" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("ed" + "\n").encode('ascii'))
            bot.write(("QxN" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kxp" + "\n").encode('ascii'))
            bot.write(("g6" + "\n").encode('ascii'))
            bot.write(("g3" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kf7" + "\n").encode('ascii'))
            bot.write(("Kf2" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kf6" + "\n").encode('ascii'))
            bot.write(("Kf3" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kg2" + "\n").encode('ascii'))
            bot.write(("Kg7" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Qe7" + "\n").encode('ascii'))
            bot.write(("Qe2" + "\n").encode('ascii'))
            bot.write(("KxQ" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kc2" + "\n").encode('ascii'))
            bot.write(("Kc7" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kb1" + "\n").encode('ascii'))
            bot.write(("Kb8" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kd2" + "\n").encode('ascii'))
            bot.write(("Kd7" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kf1" + "\n").encode('ascii'))
            bot.write(("Kf8" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kf2" + "\n").encode('ascii'))
            bot.write(("Kf7" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Be2" + "\n").encode('ascii'))
            bot.write(("Be7" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kc1" + "\n").encode('ascii'))
            bot.write(("Kc8" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kb2" + "\n").encode('ascii'))
            bot.write(("Kb7" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Ka2" + "\n").encode('ascii'))
            bot.write(("Ka7" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kh1" + "\n").encode('ascii'))
            bot.write(("Kh8" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Ka8" + "\n").encode('ascii'))
            bot.write(("Ka1" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kh3" + "\n").encode('ascii'))
            bot.write(("Kh6" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Ka3" + "\n").encode('ascii'))
            bot.write(("Ka6" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kh4" + "\n").encode('ascii'))
            bot.write(("Kh5" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kg4" + "\n").encode('ascii'))
            bot.write(("Kg5" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Ka4" + "\n").encode('ascii'))
            bot.write(("Ka5" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Qd8" + "\n").encode('ascii'))
            bot.write(("Qd1" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kb4" + "\n").encode('ascii'))
            bot.write(("Kb5" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Rg8" + "\n").encode('ascii'))
            bot.write(("Rg1" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Rh8" + "\n").encode('ascii'))
            bot.write(("Rh1" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("e6" + "\n").encode('ascii'))
            bot.write(("e3" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kg8" + "\n").encode('ascii'))
            bot.write(("Kg1" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("b4" + "\n").encode('ascii'))
            bot.write(("b5" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("g4" + "\n").encode('ascii'))
            bot.write(("g5" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("a4" + "\n").encode('ascii'))
            bot.write(("a5" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("b3" + "\n").encode('ascii'))
            bot.write(("b6" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("f4" + "\n").encode('ascii'))
            bot.write(("f5" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Bf1" + "\n").encode('ascii'))
            bot.write(("Bf8" + "\n").encode('ascii'))
            response = bot.read_very_eager()
            time.sleep(.1)
            bot.write(("Kh2" + "\n").encode('ascii'))
            bot.write(("Kh7" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("c3" + "\n").encode('ascii'))
            bot.write(("c6" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("c4" + "\n").encode('ascii'))
            bot.write(("c5" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Ke2" + "\n").encode('ascii'))
            bot.write(("Ke7" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kd3" + "\n").encode('ascii'))
            bot.write(("Kd6" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Ke3" + "\n").encode('ascii'))
            bot.write(("Ke6" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kd4" + "\n").encode('ascii'))
            bot.write(("Kd5" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Ke4" + "\n").encode('ascii'))
            bot.write(("Ke5" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kc3" + "\n").encode('ascii'))
            bot.write(("Kc6" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kc4" + "\n").encode('ascii'))
            bot.write(("Kc5" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Bb2" + "\n").encode('ascii'))
            bot.write(("Bb7" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Ba6" + "\n").encode('ascii'))
            bot.write(("Ba3" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("h3" + "\n").encode('ascii'))
            bot.write(("h6" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("h4" + "\n").encode('ascii'))
            bot.write(("h5" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("d3" + "\n").encode('ascii'))
            bot.write(("d6" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("d4" + "\n").encode('ascii'))
            bot.write(("d5" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("e4" + "\n").encode('ascii'))
            bot.write(("e5" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Rd2" + "\n").encode('ascii'))
            bot.write(("Rd7" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Ne8" + "\n").encode('ascii'))
            bot.write(("Ne1" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Nd8" + "\n").encode('ascii'))
            bot.write(("Nd1" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Ne2" + "\n").encode('ascii'))
            bot.write(("Ne7" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Nd2" + "\n").encode('ascii'))
            bot.write(("Nd7" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Bg7" + "\n").encode('ascii'))
            bot.write(("Bg2" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Bh6" + "\n").encode('ascii'))
            bot.write(("Bh3" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kf4" + "\n").encode('ascii'))
            bot.write(("Kf5" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kg3" + "\n").encode('ascii'))
            bot.write(("Kg6" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Kb3" + "\n").encode('ascii'))
            bot.write(("Kb6" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Qf8" + "\n").encode('ascii'))
            bot.write(("Qf1" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Be5" + "\n").encode('ascii'))
            bot.write(("Be4" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Bb5" + "\n").encode('ascii'))
            bot.write(("Bb4" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Bg5" + "\n").encode('ascii'))
            bot.write(("Bg4" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Nge2" + "\n").encode('ascii'))
            bot.write(("Nge7" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Nbd2" + "\n").encode('ascii'))
            bot.write(("Nbd7" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("RxQ" + "\n").encode('ascii'))
            bot.write(("NxQ" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("QxQ" + "\n").encode('ascii'))
            bot.write(("RxR" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("bc" + "\n").encode('ascii'))
            bot.write(("ab" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("BxQ" + "\n").encode('ascii'))
            bot.write(("NxR" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Ne5" + "\n").encode('ascii'))
            bot.write(("Ne4" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("Nd5" + "\n").encode('ascii'))
            bot.write(("Nd4" + "\n").encode('ascii'))
            time.sleep(.1)
            bot.write(("BxN" + "\n").encode('ascii'))
            bot.write(("NxB" + "\n").encode('ascii'))
            response = bot.read_very_eager()
            if b"Game" in response:
              break
            if b"leave" in response:
              bot.write(("logout" + "\n").encode('ascii'))
      t2 = Thread(target = mindlessplay)
      t2.start()
               
Comments