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

資源簡介

純js寫的 數字華容道 游戲,可以設置 3X3,4X4,5X5 幾個版本,有自動及時,大家可以看看。

資源截圖

代碼片段和文件信息

#?-*-?coding:?UTF-8?-*-
#?author:?anduinlee

#?腳本游戲:數字華容道
import?random?time


class?HRD(object):
????def?__init__(self?hard):
????????self.hard?=?hard
????????h?=?int(self.hard?**?0.5)
????????self.lis?=?[l?for?l?in?range(1?h?**?2)]
????????random.shuffle(self.lis)
????????self.lis.append(‘‘)
????????HRD.__show_lis(self)

????def?__show_lis(self):
????????h?=?int(self.hard?**?0.5)
????????s?=?0
????????e?=?h
????????for?i?in?range(h):
????????????print(self.lis[s:e])
????????????s?e?=?s?+?h?e?+?h

????def?move(self?mv):
????????h?=?int(self.hard?**?0.5)
????????index_space?=?self.lis.index(‘‘)
????????index_mv?=?self.lis.index(mv)
????????r0?=?True?if?abs(index_space?-?index_mv)?==?1?\
?????????????????????or?abs(index_space?-?index_mv)?==?h?else?False
????????r1?=?False?if?index_space?%?h?==?0?and?index_mv?==?index_space?-?1?else?True
????????r2?=?False?if?index_space?%?h?==?h?-?1?and?index_mv?==?index_space?+?1?else?True
????????if?r0?and?r1?and?r2:
????????????self.lis[index_mv]?=?‘‘
????????????self.lis[index_space]?=?mv
????????????HRD.__show_lis(self)
????

評論

共有 條評論