问题标签 [minesweeper]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - 调用 getContentPane().removeAll() 后 JFrame 冻结
这个问题的标题不言自明。我正在使用 JFrame 制作扫雷游戏的克隆,并且刚刚完成了玩家选择游戏大小的起始屏幕。单击按钮时,应该清除框架以准备进入游戏屏幕。当我单击一个按钮时,该按钮仍处于“按下”状态,JFrame 冻结,我必须将其关闭。我究竟做错了什么?
代码:
java - 将 JButtons 数组添加到 JFrame 时出现 Nullpointerexception
我正在使用(稍作修改)JButtons 制作扫雷游戏的克隆。因为扫雷中有很多游戏图块,所以我将它们存储为一个数组。当我尝试使用 for 循环将按钮添加到 Frame 时,按钮上出现 nullpointerexception。ButtonObject 类是从 JButton 类扩展而来的,只有两个额外的变量和 getter/setter 方法。出了什么问题?
代码:
javascript - 扫雷的Javascript递归
更新:我不认为这是重复的,请看看它现在做了什么http://808md.net/miner/?n=12
我正在开发一个扫雷克隆,一个函数检查单击的单元格是否为空,如果是,则以递归方式检查周围的单元格,但我无法使其工作......
我将添加检查以确保没有无限循环,但现在它只是对角左上角直到遇到一个非 0 单元格,而不是检查所有周围的单元格。
c - 我在类型转换方面遇到了一些麻烦
我在一个大学项目中工作,我应该用一些数组编写一个扫雷游戏......我已经编写了我的程序,程序将打印扫雷表,表中的某个单元格有炸弹,程序应该*
在那个单元格中打印。和其他单元格应该在八个周围的单元格中打印炸弹数量我不知道如何打印这个可以打印字符和数字的双下标数组。
python - 我用 Python 编写的扫雷程序揭示了整个电路板 - 递归问题
我正在尝试使用 Python 编写扫雷程序。除了我的级联显示之外,一切都运行良好。这是我所拥有的:
ActualBoard 包含所有显示的列表列表,即:
对于一个带有一个地雷的 4x4 板。
GameBoard 也包含一个列表列表,但是当游戏开始时,它看起来像这样:
java - 扫雷地雷不会放置或出现
为什么这段代码在运行时不会加载按钮?我知道这个问题非常模糊,但我对 Java 很陌生,并且试图一次理解很多东西。此代码基于我之前两次成功尝试编写井字游戏和连接四的代码,这两种代码都有效。
java - 如何使用 JMenuItem 重置 JFrame(重启游戏)?
我正在做一个扫雷,随时使用actionPerformed
方法(我知道怎么用),我想重置游戏,制作一个全新JFrame
的游戏并关闭旧游戏。(地图是JuegoBuca()
由另一个类中的对象生成的)。游戏已经开始了。我也知道如何使用JMenu
、JMenuBar
和JMenuItem
。
我的“主要课程”的代码,一切都发生在这里。
如果有人需要更多信息或其他信息,请告诉我。谢谢。
java - 小程序不会初始化,但需要抽象
试图让扫雷器通过右键单击工作,到目前为止一切正常;
发现我需要使用 MouseListener ....这似乎很好,但我的主要错误是我无法让小程序初始化并且不明白为什么。我读了这个,但无法理解解决方案: Java 中的抽象类错误
任何帮助将不胜感激,我知道错误源于抽象类,但没有它,小程序将无法运行。
python - hiding a widget according to x, y coordinates
I'm quite a newbie when it comes to programming, and in our programming excercise in school I'm making a minesweeper game in python using TKinter as GUI. The game works, except my "floodfill" algorithm, to clear any adjacent blank spaces. I have made the board, printed a previously created list, according to choices(height, width and amount of mines) chosen by the user, with labels, and hidden these labels behind buttons.
I can bind events to hide these buttons when clicked on, but what I also want is to be able to hide the buttons nearby, with the help of my floodfill algorithm. I feel like all I need anymore is the line of code that will hide the button according to x and y coordinates, and not just the one that's clicked upon. I think you've got the idea,
the long line of # is where I believe is all I need anymore to get this system to work, in something like "button.position(x, y). I attempted to save the button in the blist, and maybe I could get the correct button that needs to be hidden from it, with the help of x and y coordinates?
of course, if you have a better idea how to solve this problem, I'd love to hear it.
algorithm - 扫雷特例
我需要为一项任务制作扫雷,但我找不到关于这个特殊案例的任何信息。
0 是空格,数字是数字,* 是我的。考虑到顶部 0 和右侧 0 没有相互接触,单击任何 0 应该会显示对角相邻的 0?我在玩在线游戏时没有遇到这种情况。