我认为改进的扫雷器(译文)
By robot-v1.0
本文链接 https://www.kyfws.com/games/improved-minesweeper-i-think-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 3 分钟阅读 - 1222 个词 阅读量 0我认为改进的扫雷器(译文)
原文地址:https://www.codeproject.com/Articles/32682/Improved-Minesweeper-I-Think
原文作者:Eric Beijer
译文由本站 robot-v1.0 翻译
前言
A simulation of Minesweeper by Microsoft with improvement, I think
我认为Microsoft对Minesweeper进行了模拟,并进行了改进
介绍(Introduction)
这款扫雷游戏是Microsoft制作的一款模拟游戏.比赛场地,排雷和时间计数器是Microsoft制造的精确副本.我没有复制笑脸,我不喜欢.(This Minesweeper game is a simulation of the one made by Microsoft. The playing field and the mine- and time counter are an exact copy of the one made by Microsoft. I’ve not copied the smiley thing, I don’t like it.)
背景(Background)
由于我使用的是Microsoft Windows Vista或Microsoft Windows 7,因此我真的不喜欢Minesweeper游戏.我认为Microsoft Windows XP附带的那是最好的.设置一些标志后,除了同时使用向左和向右按钮来打开字段外.为什么我只想使用两个按钮,却只想使用两个按钮呢?特别是因为它没有任何其他功能.(Since I am using Microsoft Windows Vista or Microsoft Windows 7, I really dislike the Minesweeper game. I think the one shipped with Microsoft Windows XP is the best. Except the use of left and right button simultaneously for opening fields after setting some flags. Why should I want to use two buttons while using only the left button is much more useful? Especially since it’s not taken by any other function.)
使用代码(Using the Code)
扫雷机面板(MinesweeperPanel)
此JPanel根据难度创建运动场.难度分为三个级别:初学者,中级和专家.它包含字段的二维数组.(This JPanel creates the playing field based on the difficulty. There are three levels of difficulty: beginner, intermediate and expert. It contains a 2 dimensional array of fields.)
领域(Field)
一个字段知道在正确位置进行绘制的x和y坐标,有多少相邻字段包含一个地雷,是否被单击,是否为地雷,用户是否将其标记为标志以及用户是否在该位置单击了它一只旗.(A field knows its x and y coordinates for painting at the right spot, how many neighbour fields contain a mine, if it is clicked, if it is a mine, if the user made it a flag and if the user clicked it while it is a flag.)
数字,标志和我的都是手工绘制的,因此在任何OS上它们的外观都相同.至少,我希望如此.(The numbers, flag and mine are painted by hand so they will look the same on any OS. At least, I hope so.)
方法(The method) setGameOver
用于在用户单击地雷之后设置运动场.方法(is used for setting up the playing field after the user has clicked a mine. The method) setWon
用户删除所有非雷区后,用于设置比赛场地.(is used for setting up the playing field after the user has removed all non mine fields.)
显示与数字(Display & Digit)
显示内容是防雷计数器和时间显示.显示由三位数组成.(Displays are the mine counter and the time display. A display consists of three digits.)
免责声明(Disclaimer)
英语不是我的主要语言,所以它可能不可读.对不起.我在编码中不使用注释,这使我感到恐惧,我认为注释使代码不可读.毕竟,方法应该执行它们所谓的操作.(English isn’t my main language, so it can be unreadable. I’m sorry. I don’t use comments in my coding, it scares me and I think comments makes the code unreadable. After all, methods should do what they are called.)
历史(History)
- 28(28)日(th)2009年1月:初始职位(January, 2009: Initial post)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
Java JavaSE6 Java SE Swing AWT 新闻 翻译