Beispiel #1
0
class Client(MobileActor):
  def birth(self):
    Keyboard().listen(self.shell)
    print "commands:\n\t l (user) \t log in as the given user \n\t q \t\t quit"
    self.attached = None

  def shell(self, command):
    opt = command[0:2] 
    param = command[2:len(command)]
    if opt == "l ":
      self.attached = Person(param)
      here = ids.loc(self.actor_id)
      self.attached.attach(param, here)
      self.help()
    if opt == "q":
       if self.attached is not None:
         self.attached.migrate_away()
       die()
    if opt == "w" and self.attached is not None:
      self.attached.print_wall()
    if opt == "y " and self.attached is not None:
      self.attached.yap(param)
    if opt == "f " and self.attached is not None:
        self.attached.follow(param)
    if opt == "h":
      self.help()

  def help(self):
    print "commands:\n\tw \t\t print wall \n\t\
Beispiel #2
0
 def shell(self, command):
   opt = command[0:2] 
   param = command[2:len(command)]
   if opt == "l ":
     self.attached = Person(param)
     here = ids.loc(self.actor_id)
     self.attached.attach(param, here)
     self.help()
   if opt == "q":
      if self.attached is not None:
        self.attached.migrate_away()
      die()
   if opt == "w" and self.attached is not None:
     self.attached.print_wall()
   if opt == "y " and self.attached is not None:
     self.attached.yap(param)
   if opt == "f " and self.attached is not None:
       self.attached.follow(param)
   if opt == "h":
     self.help()