gr8vyguy@Blogjava

          我的作品: 掃雷游戲

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

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

          先看張圖吧

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

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

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

          在程序開(kāi)發(fā)過(guò)程中,使用了單元測(cè)試JUnit,程序發(fā)布方面使用了Ant腳本和Proguard混淆壓縮器,特別值得一提的是,Windows下的 發(fā)布程序利用了JDK的pack200,使得整個(gè)程序包從2M多減到900多K。在第一次運(yùn)行的時(shí)候啟動(dòng)程序會(huì)自動(dòng)調(diào)用unpack200解開(kāi)壓縮的Jar 包,這時(shí)會(huì)出現(xiàn)幾個(gè)DOS窗口,但是這只發(fā)生在第一次運(yùn)行的時(shí)候。

          雖然我做的這個(gè)掃雷有幾個(gè)Windows自帶的那個(gè)掃雷沒(méi)有的功能,比如支持多種語(yǔ)言作弊功能,但是我覺(jué)得,只提供可運(yùn)行程序沒(méi)有太大的意義。所 以我提供了所有的Java源代碼,以供感興趣的朋友下載。作為軟件,錯(cuò)誤是難免,請(qǐng)朋友們將發(fā)現(xiàn)的錯(cuò)誤告之我,你可以通過(guò)點(diǎn)擊幫 助菜單的About對(duì)話框里我的Email鏈接給我發(fā)Email,非常感謝。

          作弊


          下載

          Windows下可執(zhí)行程序包:  Minesweeper.zip  ,解壓后,雙擊Minesweeper.exe運(yùn)行程序,需要JRE 1.4+,如果你需要其他系統(tǒng)的可執(zhí)行程序包,請(qǐng)來(lái)信聯(lián)系,或者你可以編譯下面的源代碼。

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

          如果你要運(yùn)行源碼包里的build.xml, 還需要把minesweeper_supports.zip里的supports目錄拷到你的項(xiàng)目目錄下。

          最后要說(shuō)是,加拿大心理學(xué)家PiersSteel在他的報(bào)告里, 對(duì)這款最平常的Windows小游戲感慨道, “人們?cè)趻呃子螒蛏匣ㄙM(fèi)的時(shí)間, 可以為這個(gè)社會(huì)創(chuàng)造數(shù)十億美元的財(cái)富。” 自從做了這款游戲,特別是在加上作弊功能后,就再也沒(méi)有興趣長(zhǎng)時(shí)間的玩了。

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

          掃雷相關(guān)的鏈接

                  Windows小游戲之掃雷世界紀(jì)錄到底多快

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

          評(píng)論

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

          關(guān)于ant文件中的proguard工程創(chuàng)建,想知道怎么創(chuàng)建的,我導(dǎo)入你的源碼,但會(huì)有錯(cuò)誤,在構(gòu)建ant的時(shí)候  回復(fù)  更多評(píng)論   

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

          @英明
          請(qǐng)?jiān)傧螺dminesweeper_supports.zip。另外要把swt.jar和log4j-1.2.14.jar加到你的項(xiàng)目Classpath里  回復(fù)  更多評(píng)論   

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

          Main Class Error:Jars NOT Found  回復(fù)  更多評(píng)論   

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

          @xx
          請(qǐng)問(wèn)你的操作系統(tǒng)和JRE是哪個(gè)版本的?  回復(fù)  更多評(píng)論   

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

          xp java1.5update6  回復(fù)  更多評(píng)論   

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

          @xx
          由于我是用JDK6編譯的,所以1.5update6不能運(yùn)行
          一會(huì),我重新上載一個(gè)JDK1.4編譯的,應(yīng)該就可以了  回復(fù)  更多評(píng)論   

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

          @xx
          已經(jīng)更新,請(qǐng)重新下載Minesweeper.zip,現(xiàn)在支持所有Java1.4+  回復(fù)  更多評(píng)論   

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

          老大, minesweeper不是你原創(chuàng)的吧。。

          記得這個(gè)是eclipse里的一個(gè)plugin,

          如果是你從頭一句行寫出來(lái)的話,你做的那個(gè)抓圖軟件就太太簡(jiǎn)單了。。。  回復(fù)  更多評(píng)論   

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

          @ddd
          你好, minesweeper這個(gè)游戲當(dāng)然不是我原創(chuàng)的,據(jù)說(shuō)上世紀(jì)70年代就有了, 但是上面的程序確是我原創(chuàng)的,從零寫起的。  回復(fù)  更多評(píng)論   

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

          下載了看了一下,很不錯(cuò),正在研究之中,謝謝!  回復(fù)  更多評(píng)論   

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

          為什么倒入swt.jar和log4j.1.2.14.jar后還有錯(cuò)誤 ?????
          嚴(yán)重性 描述 資源 所在文件夾 位置 創(chuàng)建時(shí)間
          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日   回復(fù)  更多評(píng)論   

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

          為什么倒入swt.jar和log4j.1.2.14.jar后還有錯(cuò)誤 ?????
          嚴(yán)重性 描述 資源 所在文件夾 位置 創(chuàng)建時(shí)間
          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
            回復(fù)  更多評(píng)論   

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

          為什么倒入swt.jar和log4j.1.2.14.jar后還有錯(cuò)誤 ?????
          嚴(yán)重性 描述 資源 所在文件夾 位置 創(chuàng)建時(shí)間
          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
            回復(fù)  更多評(píng)論   

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

          我已經(jīng)導(dǎo)入 eclipse 并且編譯運(yùn)行成功了。
          看樣子是要把 log4j 和 SWT 兩個(gè) jar 文件放到項(xiàng)目根目錄下的 \libs 里面。

          但是運(yùn)行后,和 windows 的掃雷相比,少了一個(gè)左右鍵雙擊某個(gè)方塊時(shí),根據(jù)已經(jīng)探索的情況打開(kāi)附近 8 個(gè)方塊的功能。

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

          我是一個(gè)初學(xué)者,等我學(xué)到一定程度,也會(huì)自己嘗試寫一個(gè) mineSweeper 的。:)  回復(fù)  更多評(píng)論   


          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          <2025年7月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          導(dǎo)航

          統(tǒng)計(jì)

          公告

        1. 轉(zhuǎn)載請(qǐng)注明出處.
        2. msn: gr8vyguy at live.com
        3. 常用鏈接

          留言簿(9)

          隨筆分類(68)

          隨筆檔案(80)

          文章分類(1)

          My Open Source Projects

          搜索

          積分與排名

          最新評(píng)論

          主站蜘蛛池模板: 普兰店市| 吴江市| 常熟市| 商南县| 洞头县| 尚义县| 林州市| 宝清县| 安远县| 彰化县| 新民市| 晋江市| 临湘市| 汉寿县| 临澧县| 永州市| 普格县| 天峨县| 江安县| 平舆县| 莲花县| 迁安市| 墨竹工卡县| 拉萨市| 咸宁市| 榆社县| 赤城县| 方城县| 红安县| 土默特右旗| 盖州市| 榕江县| 乌拉特前旗| 敦煌市| 文水县| 江北区| 富蕴县| 宣武区| 牡丹江市| 周宁县| 台山市|