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()
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())