gr8vyguy@Blogjava

          我的作品: 掃雷游戲

          掃雷是一款最經典的休閑益智小游戲之一,也許Windows最初包含它的目的是為了讓用戶練習鼠標操作。曾經 為了破記錄,和幾個朋友一起瘋狂地玩掃雷,甚至總結出了像"一二一"這樣實用的口訣。高級模式下,本人的最高記錄可是120多秒阿。

          做一款曾經非常喜歡的游戲,是一件很有成就感的事情,更有趣的是還做得幾乎一模一樣。

          先看張圖吧

          很像吧?是用Java+SWT寫的。所以不局限于Windows系統,再看一張Linux下的圖片,也很漂亮,

          Java Web Start地址
              http://daoenpan.googlepages.com/minesweeper.jnlp

          這個程序麻雀雖小,卻也五臟俱全,在這款游戲里用到了Java的很多方面,包括I18N國際化,C11N個性化,自定義SWT控件,SWT的資源管理等等,是一個學習Java編程非常好的例子

          在程序開發過程中,使用了單元測試JUnit,程序發布方面使用了Ant腳本和Proguard混淆壓縮器,特別值得一提的是,Windows下的 發布程序利用了JDK的pack200,使得整個程序包從2M多減到900多K。在第一次運行的時候啟動程序會自動調用unpack200解開壓縮的Jar 包,這時會出現幾個DOS窗口,但是這只發生在第一次運行的時候。

          雖然我做的這個掃雷有幾個Windows自帶的那個掃雷沒有的功能,比如支持多種語言,作弊功能,但是我覺得,只提供可運行程序沒有太大的意義。所 以我提供了所有的Java源代碼,以供感興趣的朋友下載。作為軟件,錯誤是難免,請朋友們將發現的錯誤告之我,你可以通過點擊幫 助菜單的About對話框里我的Email鏈接給我發Email,非常感謝。

          作弊


          下載

          Windows下可執行程序包:  Minesweeper.zip  ,解壓后,雙擊Minesweeper.exe運行程序,需要JRE 1.4+,如果你需要其他系統的可執行程序包,請來信聯系,或者你可以編譯下面的源代碼。

          Java源代碼 minesweeper_src.zip ,不包括所用的SWT和log4j包。

          如果你要運行源碼包里的build.xml, 還需要把minesweeper_supports.zip里的supports目錄拷到你的項目目錄下。

          最后要說是,加拿大心理學家PiersSteel在他的報告里, 對這款最平常的Windows小游戲感慨道, “人們在掃雷游戲上花費的時間, 可以為這個社會創造數十億美元的財富。” 自從做了這款游戲,特別是在加上作弊功能后,就再也沒有興趣長時間的玩了。

          更多的截圖 http://www.aygfsteel.com/xilaile/archive/2007/04/25/113648.html

          掃雷相關的鏈接

                  Windows小游戲之掃雷世界紀錄到底多快

          posted on 2007-04-20 22:34 gr8vyguy 閱讀(6311) 評論(14)  編輯  收藏 所屬分類: 我的作品

          評論

          # re: 我的作品: 掃雷游戲 2007-04-21 03:50 英明

          關于ant文件中的proguard工程創建,想知道怎么創建的,我導入你的源碼,但會有錯誤,在構建ant的時候  回復  更多評論   

          # re: 我的作品: 掃雷游戲 2007-04-21 07:43 pande

          @英明
          請再下載minesweeper_supports.zip。另外要把swt.jar和log4j-1.2.14.jar加到你的項目Classpath里  回復  更多評論   

          # re: 我的作品: 掃雷游戲 2007-04-21 13:01 xx

          Main Class Error:Jars NOT Found  回復  更多評論   

          # re: 我的作品: 掃雷游戲 2007-04-21 13:26 Pande

          @xx
          請問你的操作系統和JRE是哪個版本的?  回復  更多評論   

          # re: 我的作品: 掃雷游戲 2007-04-21 15:48 xx

          xp java1.5update6  回復  更多評論   

          # re: 我的作品: 掃雷游戲 2007-04-21 16:11 Pande

          @xx
          由于我是用JDK6編譯的,所以1.5update6不能運行
          一會,我重新上載一個JDK1.4編譯的,應該就可以了  回復  更多評論   

          # re: 我的作品: 掃雷游戲 2007-04-21 16:39 Pande

          @xx
          已經更新,請重新下載Minesweeper.zip,現在支持所有Java1.4+  回復  更多評論   

          # re: 我的作品: 掃雷游戲 2007-05-02 08:56 ddd

          老大, minesweeper不是你原創的吧。。

          記得這個是eclipse里的一個plugin,

          如果是你從頭一句行寫出來的話,你做的那個抓圖軟件就太太簡單了。。。  回復  更多評論   

          # re: 我的作品: 掃雷游戲 2007-05-02 10:09 Pande

          @ddd
          你好, minesweeper這個游戲當然不是我原創的,據說上世紀70年代就有了, 但是上面的程序確是我原創的,從零寫起的。  回復  更多評論   

          # re: 我的作品: 掃雷游戲[未登錄] 2007-05-18 08:59 Michael

          下載了看了一下,很不錯,正在研究之中,謝謝!  回復  更多評論   

          # re: 我的作品: 掃雷游戲 2007-06-08 08:47 再倒

          為什么倒入swt.jar和log4j.1.2.14.jar后還有錯誤 ?????
          嚴重性 描述 資源 所在文件夾 位置 創建時間
          2 emailLink cannot be resolved AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 115 行 2007年6月8日 15:37:34
          2 emailLink cannot be resolved AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 116 行 2007年6月8日 15:37:34
          2 emailLink cannot be resolved AboutDialog.java well10/src/cn/ well10/src/cn/pandaoen/game/minesweeper 第 119 行pandaoen/game/minesweeper 第 117 行 2007年6月8日   回復  更多評論   

          # re: 我的作品: 掃雷游戲 2007-06-08 08:48 再倒

          為什么倒入swt.jar和log4j.1.2.14.jar后還有錯誤 ?????
          嚴重性 描述 資源 所在文件夾 位置 創建時間
          2 emailLink cannot be resolved AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 115 行 2007年6月8日 15:37:34
          2 emailLink cannot be resolved AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 116 行 2007年6月8日 15:37:34
          2 emailLink cannot be resolved AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 117 行 2007年6月8日 15:37:34
          2 emailLink cannot be resolved AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 119 行 2007年6月8日 15:37:34
          2 emailLink cannot be resolved AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 120 行 2007年6月8日 15:37:34
          2 imageCache cannot be resolved Resources.java well10/src/cn/pandaoen/game/minesweeper/res 第 39 行 2007年6月8日 15:37:33
          2 imageCache cannot be resolved Resources.java well10/src/cn/pandaoen/game/minesweeper/res 第 47 行 2007年6月8日 15:37:33
          2 Link cannot be resolved (or is not a valid type) for the field AboutDialog.emailLink AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 31 行 2007年6月8日 15:37:34
          2 Link cannot be resolved (or is not a valid type) for the field AboutDialog.linkWeb AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 30 行 2007年6月8日 15:37:34
          2 Link cannot be resolved or is not a type AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 105 行 2007年6月8日 15:37:34
          2 Link cannot be resolved or is not a type AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 115 行 2007年6月8日 15:37:34
          2 linkWeb cannot be resolved AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 105 行 2007年6月8日 15:37:34
          2 linkWeb cannot be resolved AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 106 行 2007年6月8日 15:37:34
          2 linkWeb cannot be resolved AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 107 行 2007年6月8日 15:37:34
          2 linkWeb cannot be resolved AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 109 行 2007年6月8日 15:37:34
          2 linkWeb cannot be resolved AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 110 行 2007年6月8日 15:37:34
          2 Syntax error on token ":", ; expected Resources.java well10/src/cn/pandaoen/game/minesweeper/res 第 88 行 2007年6月8日 15:37:33
          2 Syntax error on token "(", invalid Expression Resources.java well10/src/cn/pandaoen/game/minesweeper/res 第 31 行 2007年6月8日 15:37:33
          2 Syntax error on token "(", invalid Expression LedDigit.java well10/src/cn/pandaoen/widget/swt 第 101 行 2007年6月8日 15:37:33
          2 Syntax error on token "(", invalid Expression LedDigit.java well10/src/cn/pandaoen/widget/swt 第 145 行 2007年6月8日 15:37:33
          2 Syntax error on token ")", ; expected after this token Resources.java well10/src/cn/pandaoen/game/minesweeper/res 第 88 行 2007年6月8日 15:37:33
          2 Syntax error on tokens, delete these tokens LedDigit.java well10/src/cn/pandaoen/widget/swt 第 26 行 2007年6月8日 15:37:33
          1 The import cn.pandaoen.game.minesweeper.res.Resources is never used MineSweeperListener.java well10/src/cn/pandaoen/game/minesweeper/actions 第 13 行 2007年6月8日 15:37:33
          2 The import org.eclipse.swt.graphics.Transform cannot be resolved LedDigit.java well10/src/cn/pandaoen/widget/swt 第 12 行 2007年6月8日 15:37:33
          1 The import org.eclipse.swt.layout.FillLayout is never used AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 9 行 2007年6月8日 15:37:34
          1 The import org.eclipse.swt.layout.GridData is never used AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 10 行 2007年6月8日 15:37:34
          1 The import org.eclipse.swt.layout.GridLayout is never used AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 11 行 2007年6月8日 15:37:34
          1 The import org.eclipse.swt.SWT is never used MineSweeperListener.java well10/src/cn/pandaoen/game/minesweeper/actions 第 5 行 2007年6月8日 15:37:33
          2 The import org.eclipse.swt.widgets.Link cannot be resolved AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 18 行 2007年6月8日 15:37:34
          1 The import org.eclipse.swt.widgets.MessageBox is never used MineSweeperListener.java well10/src/cn/pandaoen/game/minesweeper/actions 第 8 行 2007年6月8日 15:37:33
            回復  更多評論   

          # re: 我的作品: 掃雷游戲 2007-06-08 08:50 再倒

          為什么倒入swt.jar和log4j.1.2.14.jar后還有錯誤 ?????
          嚴重性 描述 資源 所在文件夾 位置 創建時間
          2 emailLink cannot be resolved AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 115 行 2007年6月8日 15:37:34
          2 emailLink cannot be resolved AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 116 行 2007年6月8日 15:37:34
          2 emailLink cannot be resolved AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 117 行 2007年6月8日 15:37:34
          2 emailLink cannot be resolved AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 119 行 2007年6月8日 15:37:34
          2 Syntax error on token ":", ; expected Resources.java well10/src/cn/pandaoen/game/minesweeper/res 第 88 行 2007年6月8日 15:37:33
          2 Syntax error on token "(", invalid Expression Resources.java well10/src/cn/pandaoen/game/minesweeper/res 第 31 行 2007年6月8日 15:37:33
          2 Syntax error on token "(", invalid Expression LedDigit.java well10/src/cn/pandaoen/widget/swt 第 101 行 2007年6月8日 15:37:33
          2 Syntax error on token "(", invalid Expression LedDigit.java well10/src/cn/pandaoen/widget/swt 第 145 行 2007年6月8日 15:37:33
          2 Syntax error on token ")", ; expected after this token Resources.java well10/src/cn/pandaoen/game/minesweeper/res 第 88 行 2007年6月8日 15:37:33
          2 Syntax error on token ")", invalid AssignmentOperator LedDigit.java well10/src/cn/pandaoen/widget/swt 第 167 行 2007年6月8日 15:37:33
          2 Syntax error on token "<", ( expected Resources.java well10/src/cn/pandaoen/game/minesweeper/res 第 31 行 2007年6月8日 15:37:33
          2 Syntax error on token "<", ( expected LedDigit.java well10/src/cn/pandaoen/widget/swt 第 101 行 2007年6月8日 15:37:33
          2 Syntax error on token "<", ( expected LedDigit.java well10/src/cn/pandaoen/widget/swt 第 145 行 2007年6月8日 15:37:33
          2 Syntax error on token "<", delete this token Resources.java well10/src/cn/pandaoen/game/minesweeper/res 第 31 行 2007年6月8日 15:37:33
          2 Syntax error on token ">", , expected Resources.java well10/src/cn/pandaoen/game/minesweeper/res 第 31 行 2007年6月8日 15:37:33
          2 Syntax error on token(s), misplaced construct(s) LedDigit.java well10/src/cn/pandaoen/widget/swt 第 167 行 2007年6月8日 15:37:33
          2 Syntax error on tokens, delete these tokens BestTimeDialog.java well10/src/cn/pandaoen/game/minesweeper 第 102 行 2007年6月8日 15:37:34
          2 Syntax error on tokens, delete these tokens Counter.java well10/src/cn/pandaoen/game/minesweeper 第 79 行 2007年6月8日 15:37:34
          2 Syntax error on tokens, delete these tokens MineSweeper.java well10/src/cn/pandaoen/game/minesweeper 第 265 行 2007年6月8日 15:37:34
          2 Syntax error on tokens, delete these tokens NameInputDialog.java well10/src/cn/pandaoen/game/minesweeper 第 40 行 2007年6月8日 15:37:34
          2 Syntax error on tokens, delete these tokens Timer.java well10/src/cn/pandaoen/game/minesweeper 第 72 行 2007年6月8日 15:37:33
          2 Syntax error on tokens, delete these tokens LangChangeListener.java well10/src/cn/pandaoen/game/minesweeper/actions 第 23 行 2007年6月8日 15:37:33
          2 Syntax error on tokens, delete these tokens ModeChangeListener.java well10/src/cn/pandaoen/game/minesweeper/actions 第 24 行 2007年6月8日 15:37:33
          2 Syntax error on tokens, delete these tokens LedDigit.java well10/src/cn/pandaoen/widget/swt 第 26 行 2007年6月8日 15:37:33
          1 The import cn.pandaoen.game.minesweeper.res.Resources is never used MineSweeperListener.java well10/src/cn/pandaoen/game/minesweeper/actions 第 13 行 2007年6月8日 15:37:33
          2 The import org.eclipse.swt.graphics.Transform cannot be resolved LedDigit.java well10/src/cn/pandaoen/widget/swt 第 12 行 2007年6月8日 15:37:33
          1 The import org.eclipse.swt.layout.FillLayout is never used AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 9 行 2007年6月8日 15:37:34
          1 The import org.eclipse.swt.layout.GridData is never used AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 10 行 2007年6月8日 15:37:34
          1 The import org.eclipse.swt.layout.GridLayout is never used AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 11 行 2007年6月8日 15:37:34
          1 The import org.eclipse.swt.SWT is never used MineSweeperListener.java well10/src/cn/pandaoen/game/minesweeper/actions 第 5 行 2007年6月8日 15:37:33
          2 The import org.eclipse.swt.widgets.Link cannot be resolved AboutDialog.java well10/src/cn/pandaoen/game/minesweeper 第 18 行 2007年6月8日 15:37:34
          1 The import org.eclipse.swt.widgets.MessageBox is never used MineSweeperListener.java well10/src/cn/pandaoen/game/minesweeper/actions 第 8 行 2007年6月8日 15:37:33
            回復  更多評論   

          # re: 我的作品: 掃雷游戲[未登錄] 2007-10-22 03:34 Owen

          我已經導入 eclipse 并且編譯運行成功了。
          看樣子是要把 log4j 和 SWT 兩個 jar 文件放到項目根目錄下的 \libs 里面。

          但是運行后,和 windows 的掃雷相比,少了一個左右鍵雙擊某個方塊時,根據已經探索的情況打開附近 8 個方塊的功能。

          描述的不是很清除,試試 windows 的掃雷看看。

          我是一個初學者,等我學到一定程度,也會自己嘗試寫一個 mineSweeper 的。:)  回復  更多評論   


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          <2007年4月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          導航

          統計

          公告

        1. 轉載請注明出處.
        2. msn: gr8vyguy at live.com
        3. 常用鏈接

          留言簿(9)

          隨筆分類(68)

          隨筆檔案(80)

          文章分類(1)

          My Open Source Projects

          搜索

          積分與排名

          最新評論

          主站蜘蛛池模板: 永定县| 广德县| 富宁县| 合水县| 广灵县| 西昌市| 城口县| 吴旗县| 雷山县| 壤塘县| 安阳市| 桦川县| 孙吴县| 名山县| 长沙市| 呼伦贝尔市| 泰州市| 陆良县| 木兰县| 榆林市| 洪泽县| 昂仁县| 阿城市| 兴业县| 渭源县| 榆林市| 综艺| 建德市| 山东省| 襄垣县| 大同县| 启东市| 石台县| 无为县| 泰宁县| 庄河市| 阿勒泰市| 安多县| 龙里县| 无为县| 呼和浩特市|