91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

用tensorflow寫的麻將智能出牌的打碼,實(shí)現(xiàn)傳入手牌后自動選擇應(yīng)該出的牌。

資源截圖

代碼片段和文件信息

import?copy
import?argparse
import?xml.etree.ElementTree?as?ET
import?os

class?GameRecord:
def?__init__(self):
self.record?=?[None?for?i?in?range(4)]
self.outrecord?=?[]
self.total?=?[]

def?write_out(self?filename):
with?open(filename?mode=“w“?encoding=“utf-8“)?as?f:
for?r?in?self.total:
f.write(“{0}\n“.format(r))

def?read_one(self?child):
#U?E?1
#V?F?2
#W?G?3
#T?D?0
fmu?=?child.tag[0:1]
#print(child.tag?fmu)
if?child.tag?==?‘GO‘:
return
if?child.tag?==?‘UN‘:
return
if?child.tag?==?‘TAIKYOKU‘:
return
if?child.tag?==?‘DORA‘:
return
if?child.tag?==?‘INIT‘:
#self.total.append(self.record)
self.record?=?[None?for?i?in?range(4)]
self.record[0]?=?self.get_card_from_string(child.attrib[‘hai0‘])
self.record[1]?=?self.get_card_from_string(child.attrib[‘hai1‘])
self.record[2]?=?self.get_card_from_string(child.attrib[‘hai2‘])
self.record[3]?=?self.get_card_from_string(child.attrib[‘hai3‘])

if?fmu?==?‘U‘:
c?=?child.tag[1:len(child.tag)]
#print(“玩家1?摸牌:{0}“.format(c))
self.in_card(self.record[1]?int(c))

if?fmu?==?‘E‘:
c?=?child.tag[1:len(child.tag)]
#print(“玩家1?出牌:{0}?{1}“.format(c?self.get_out_string(self.record[1]?int(c))))
self.total.append(self.get_out_string(self.record[1]?int(c)))
self.out_card(self.record[1]?int(c))

if?fmu?==?‘V‘:
c?=?child.tag[1:len(child.tag)]
#print(“玩家2?摸牌:{0}“.format(c))
self.in_card(self.record[2]?int(c))

if?fmu?==?‘F‘:
c?=?child.tag[1:len(child.tag)]
#print(“玩家2?出牌:{0}?{1}“.format(c?self.get_out_string(self.record[2]?int(c))))
self.total.append(self.get_out_string(self.record[2]?int(c)))
self.out_card(self.record[2]?int(c))

if?fmu?==?‘W‘:
c?=?child.tag[1:len(child.tag)]
#print(“玩家3?摸牌:{0}“.format(c))
self.in_card(self.record[3]?int(c))

if?fmu?==?‘G‘:
c?=?child.tag[1:len(child.tag)]
#print(“玩家3?出牌:{0}?{1}“.format(c?self.get_out_string(self.record[3]?int(c))))
self.total.append(self.get_out_string(self.record[3]?int(c)))
self.out_card(self.record[3]?int(c))

if?fmu?==?‘T‘:
c?=?child.tag[1:len(child.tag)]
#print(“玩家0?摸牌:{0}“.format(c))
self.in_card(self.record[0]?int(c))

if?fmu?==?‘D‘:
c?=?child.tag[1:len(child.tag)]
#print(“玩家0?出牌:{0}?{1}“.format(c?self.get_out_string(self.record[0]?int(c))))
self.total.append(self.get_out_string(self.record[0]?int(c)))
self.out_card(self.record[0]?int(c))

if?child.tag?==?‘N‘:
#print(“玩家?鳴牌“)
who?=?int(child.attrib[‘who‘])
other?=?int(child.attrib[‘m‘])?&?3
ischi?=?(int(child.attrib[‘m‘])?>>?2)?&?1
ispen?=?(int(child.attrib[‘m‘])?>>?3)?&?1
isgang?=?(int(child.attrib[‘m‘])?>>?3)?&?3
if?ischi?==?1:
out?=?(int(child.attrib[‘m‘])?>>?10)?&?63
_k?=?int(out?/?3)
_h?=?int(out?%?3)
_v?=?int(_k?%?7)
_c?=?int(_k?/?7)
_ot?=?_c?*?36?+?_v?*?4

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????7913??2018-07-24?16:19??gen.py
?????文件???????10657??2018-07-24?16:34??mahjong_ai.py
?????文件???????21879??2018-05-06?09:51??mahjong_common.py
?????文件???????19355??2018-07-18?21:04??mahjong_common.pyc
?????文件????????5671??2018-07-19?21:35??mahjong_generator.py
?????文件????????2099??2018-05-06?09:51??mahjong_loader.py
?????文件?????2183690??2018-07-25?10:31??dahai_data.txt

評論

共有 條評論