예제 #1
0
 def move(self, ctx):
   sendersqueue = ctx.fgpsession.getSendersQueue()
   lastsender = ctx.fgpsession.getLastSender()
   droppdu = DropPDU()
   droppdu.setSendersays("Opponent quit!")
   if lastsender == sendersqueue[0]:
     ctx.fgpsession.send(droppdu, 0)
   else:
     ctx.fgpsession.send(droppdu, 1)
   ctx.stopListening()
예제 #2
0
 def drop(self, ctx):
   sendersqueue = ctx.fgpsession.getSendersQueue()
   lastsender = ctx.fgpsession.getLastSender()
   
   if lastsender == sendersqueue[0]:           # who sent the drop? reply to the other one.
     droppdu = DropPDU()
     droppdu.setSendersays("Opponent quit!")
     ctx.fgpsession.send(droppdu, 1)
     ctx.stopListening()
   else:
     ctx.setState(DROP_PENDING())