xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 904KB
    文件類型: .rar
    金幣: 2
    下載: 1 次
    發(fā)布日期: 2022-10-05
  • 語言: Python
  • 標(biāo)簽: python??pygame??五子棋??

資源簡(jiǎn)介

python使用pygame實(shí)現(xiàn)的單機(jī)五子棋源碼,自動(dòng)判斷輸贏

資源截圖

代碼片段和文件信息

import?socket
import?threading
import?json
import?time

receiveData??=?[]?#?存放發(fā)送的數(shù)據(jù)
sendData?????=?[]?#?存放接收的數(shù)據(jù)

rCondition?=?threading.Condition()
sCondition?=?threading.Condition()

#?收數(shù)據(jù)的
class?ChessServer(threading.Thread):

????def?__init__(self?ip=‘10.0.14.204‘?port=18090?connectSize=100):
????????‘‘‘
????????:param?port:?服務(wù)器的端口號(hào)
????????:param?connectSize:?默認(rèn)的并發(fā)數(shù)量
????????‘‘‘
????????threading.Thread.__init__(self)
????????self.__ip?=?ip
????????self.__port?=?port
????????self.__connectSize?=?connectSize
????????pass

????def?run(self):
????????‘‘‘
????????服務(wù)啟動(dòng)主程序
????????:return:
????????‘‘‘
????????server?=?None
????????try:
????????????server?=?socket.socket(socket.AF_INET?socket.SOCK_STREAM)
????????????server.setsockopt(socket.SOL_SOCKET?socket.SO_REUSEADDR?1)
????????????server.bind((self.__ip?self.__port))
????????????server.listen(self.__connectSize)
????????????while?True:
????????????????clientConn?clientAddr?=?server.accept()??#?等待客戶端請(qǐng)求
????????????????#?啟動(dòng)獨(dú)立的線程,處理每一次用戶請(qǐng)求
????????????????wt?=?WorkThread(clientConn?clientAddr)
????????????????wt.start()
????????????????pass
????????except?socket.gaierror?as?g:
????????????print(g)
????????finally:
????????????server.close()

????????pass

????pass

class?WorkThread(threading.Thread):
????def?__init__(self?connection?addr?bufferSize=8096):
????????threading.Thread.__init__(self)
????????self.__connection?=?connection
????????self.__addr?=?addr
????????self.__bufferSize?=?bufferSize
????????pass

????def?run(self):
????????while?True:
????????????receiveMsg?=?self.__connection.recv(self.__bufferSize)
????????????print(“收到的原始數(shù)據(jù):“?+?json.loads(receiveMsg.decode(“utf-8“)))
????????????if?rCondition.acquire():
????????????????print(“開始收數(shù)據(jù):“?+?json.loads(receiveMsg.decode(“utf-8“)))
????????????????obj?=?json.loads(receiveMsg.decode(“utf-8“))
????????????????print(“rev:“?obj)
????????????????receiveData.append(obj)
????????????????pass
????????????rCondition.release()
????????????pass
????????#?self.__connection.close()
????????pass
????pass

#?發(fā)數(shù)據(jù)的
class?ChessClient(threading.Thread):

????def?__init__(self?ip=‘10.0.14.204‘?port=18080?bufferSize=8096):
????????threading.Thread.__init__(self)
????????self.__ip?=?ip
????????self.__port?=?port
????????self.__bufferSize?=?8096
????????pass

????def?run(self):
????????client?=?socket.socket(socket.AF_INET?socket.SOCK_STREAM)
????????time.sleep(30)
????????client.connect((self.__ip?self.__port))
????????print(“連接服務(wù)器成功:“?self.__port)
????????while?True:
????????????if?rCondition.acquire():
????????????????print(“開始發(fā)送數(shù)據(jù):“?sendData)
????????????????if?len(sendData)?>=?1:
????????????????????client.send((json.dumps(sendData[0])).encode(“utf-8“))
????????????????????sendData.remove(sendData[0])

????????????????????print(“發(fā)送數(shù)據(jù)成功:“?sendData[0])
????????????????else:
????????????????????rCondition.wait()
????????????????????pass

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件???????3249??2019-08-16?16:33??day19\chessserver.py

?????文件???????6897??2019-08-29?14:04??day19\fivechess.py

?????文件?????448072??2019-02-28?12:57??day19\images\bg.png

?????文件???????2444??2019-08-29?13:58??day19\images\black.png

?????文件???????7451??2019-08-16?14:01??day19\images\result.jpg

?????文件???????1173??2019-02-28?12:57??day19\images\storn_black.png

?????文件???????1268??2019-02-28?12:57??day19\images\storn_white.png

?????文件???????3103??2019-08-29?13:56??day19\images\white.png

?????文件?????461091??2019-08-29?14:49??day19\images.rar

?????文件??????????0??2019-08-16?15:07??day19\__init__.py

?????目錄??????????0??2019-08-29?13:59??day19\images

?????目錄??????????0??2019-08-29?14:49??day19

-----------?---------??----------?-----??----

???????????????934748????????????????????12


評(píng)論

共有 條評(píng)論