資源簡介
學習python和AI,用wxPython寫了這個游戲包含求解,共享出來,歡迎喜歡AI的人交流
截圖
http://highler.blogspot.com/2009/03/blog-post.html

代碼片段和文件信息
#?-*-?coding:?gbk?-*-
import?sys
import?wx
import?wx.html
import?wx.lib.wxpTag
#---------------------------------------------------------------------------
class?NGAboutBox(wx.Dialog):
????NGOverview?=?“““
Number?Game
填數字游戲規則:
九行九列共八十一格,分成九個三乘三的九宮格
需要將一到九數字填入八十一格中,使得每行每列
和每個九宮中包含一到九所有數字。
This?is?a?game?to?enter?numbers?from?1?to?9.
It?has?one?board?which?has?9?rows?and?9?columns.?Total?81?squares.
Rows?and?columns?are?using?index?0?to?8
The?board?is?also?divided?into?9?regions?each?region?has?3?rows?and?3?columns.
region=[startRowendRowstartColumnendColumn]
9?regions?are
[0202][0235][0258]
[3502][3535][3558]
[5802][5835][5858]
The?game?rule?is?simple:
Each?number?must?appear?in?rowscolumns?and?regions?once.
Additional?shortcut?keys:
- Move?cursor:?ijklspace
- Enter?number:?12..9
- Delete?number:?dbackspace
- Highlight?number:?.
Platform:?%s
Python?verion:?%s
Written?by?highlertech@gmail.com
????
????
“““
????def?__init__(self?parent):
????????wx.Dialog.__init__(self?parent?-1?‘About?The?Number?Game‘)
????????html?=?wx.html.HtmlWindow(self?-1?size=(420?-1))
????????if?“gtk2“?in?wx.PlatformInfo:
????????????html.SetStandardFonts()
????????py_version?=?sys.version.split()[0]
????????txt?=?self.NGOverview?%?(“?“.join(wx.PlatformInfo[1:])py_version)
????????html.SetPage(txt)
????????btn?=?html.FindWindowById(wx.ID_OK)
????????ir?=?html.GetInternalRepresentation()
????????html.SetSize(?(ir.GetWidth()+25?ir.GetHeight()+25)?)
????????self.SetClientSize(html.GetSize())
????????self.CentreOnParent(wx.BOTH)
if?__name__?==?‘__main__‘:
????app?=?wx.PySimpleApp()
????dlg?=?NGAboutBox(None)
????dlg.ShowModal()
????dlg.Destroy()
????app.MainLoop()
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????2113??2009-04-01?00:11??NGAbout.py
?????文件???????23659??2009-04-01?00:22??NGBoard.py
?????文件????????3181??2008-11-08?23:38??NGBoardPanel.py
?????文件????????2966??2009-03-15?20:20??NGControlPanel.py
?????文件?????2000004??2008-11-05?18:52??NGData.ngb
?????文件????????6758??2009-03-01?00:09??NGMain.pyw
?????文件??????174056??2009-03-21?23:17??NGRes.py
評論
共有 條評論