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.blogjava.net/xilaile/archive/2007/04/25/113648.html

扫雷相关的链接

        Windows小游戏之扫雷世界纪录到底多快

posted on 2007-04-20 22:34 gr8vyguy 阅读(6272) 评论(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 的。:)  回复  更多评论   


只有注册用户登录后才能发表评论。


网站导航:
 
<2024年5月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

导航

统计

公告

  • 转载请注明出处.
  • msn: gr8vyguy at live.com
  • 常用链接

    留言簿(9)

    随笔分类(68)

    随笔档案(80)

    文章分类(1)

    My Open Source Projects

    搜索

    积分与排名

    最新评论