17 lines
441 B
Python
17 lines
441 B
Python
|
class TalkingStick:
|
||
|
def __init__(self):
|
||
|
self.chat_by_talking = dict()
|
||
|
self.talking_by_chat = dict()
|
||
|
|
||
|
def holder(self, cid):
|
||
|
return self.talking_by_chat[cid]
|
||
|
|
||
|
def take(self, uid, cid):
|
||
|
self.chat_by_talking[uid] = cid
|
||
|
self.talking_by_chat[cid] = uid
|
||
|
|
||
|
def aho(self, uid):
|
||
|
cid = self.chat_by_talking[uid]
|
||
|
del self.talking_by_chat[cid]
|
||
|
del self.chat_by_talking[uid]
|