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

  • 大小: 0.02M
    文件類型: .py
    金幣: 1
    下載: 0 次
    發布日期: 2021-03-03
  • 語言: Python
  • 標簽:

資源簡介

8數碼問題的python解決方案(代碼)

資源截圖

代碼片段和文件信息

from?queue?import?Queue
import?copy

‘‘‘設置數據結構‘‘‘
class?Node:
????layout=[]
????depth=-1
????parent=None
????price=-1
????def?__init__(selfparentlayout=[]depth=-1price=-1):
????????self.layout=layout
????????self.depth=depth
????????self.parent=parent
????????self.price=price

????def?__repr__(self):
????????‘‘‘用來定義Node的字符輸出,print為輸出data‘‘‘
????????if?len(self.layout)==3:
????????????string=str(self.layout[0])+‘\n‘+str(self.layout[1])+‘\n‘+str(self.layout[2])
????????????return?string
????????else:
????????????return?str(self.layout)

????def?setLayout(selflayout):
????????self.layout=layout
????????return?layout

????def?setDeepth(selfdeepth):
????????self.depth=deepth
????????return?deepth

????def?setParent(selfparent):
????????self.parent=parent
????????return?parent

????def?setPrice(selfprice):
????????self.price=price
????????return?price

????def?hasParent(self):
????????return?self.parent?is?not?None

????def?toString(self):
?

評論

共有 條評論