当前位置:网站首页>c语言实现扫雷游戏:
c语言实现扫雷游戏:
2022-07-26 22:43:00 【奔跑的y先生】
(一)游戏的基本逻辑

通过该循环判断语句可实现游戏的开始与退出;

游戏的实现可分为初始化棋盘--放置雷--打印棋盘--查找雷;
初始化棋盘:

打印棋盘:
在打印棋盘的过程中一定要注意我们定义的11*11的数组,但是我们调用的是9*9的数组;
所以在我们调用的时候下标初始值为1;每次打印一行或者输出提示语句时要记得打上\n;
雷的放置:

雷的查找:

对于循环的跳出有可能有多个条件,所以应先用判断语句加上条件;
在实现的过程中一定要小搞清楚你的意图,理好思绪;
对与该坐标周围8个数的查找,并减去‘0’化为数字;

好了!到此扫雷游戏就成功啦!!!
边栏推荐
- 随着5G越来越普及,我们的生活会受到哪些积极的影响
- 力扣刷题量300记录帖
- Flinksql multi table (three table) join/interval join
- SQL学习(1)——表相关操作
- Redis -- cache avalanche, cache penetration, cache breakdown
- Solve the problem that CUDA cannot accelerate GPU in pytoch
- In depth learning report (1)
- Android——LitePal数据库框架的基本用法
- The shortest way to realize video applets: from bringing goods to brand marketing
- Flink1.11 intervaljoin watermark generation, state cleaning mechanism source code understanding & demo analysis
猜你喜欢

4.root用户登录

解决Pytorch中Cuda无法GPU加速问题

Li Hongyi machine learning (2017 Edition)_ P21: convolutional neural network CNN

VSCode2015下编译darknet生成darknet.ext时error MSB3721:XXX已退出,返回代码为 1。

深度学习报告(3)

Android -- basic usage of litepal database framework

Li Hongyi machine learning (2017 Edition)_ P1-2: introduction to machine learning

Uni app applet app's advertising realization path: banner information flow advertising

Understanding of Flink interval join source code

Android——LitePal数据库框架的基本用法
随机推荐
7. F1方程式冠军
New experience of mlvb cloud live broadcast: millisecond low latency live broadcast solution (with live broadcast performance comparison)
Contextcompat. Checkselfpermission() method
腾讯云MLVB技术如何在移动直播服务中突出重围之基础概念
4.root用户登录
Jenkins--基础--04--安装中文插件
Neo4j Basic Guide (installation, node and relationship data import, data query)
Keil开发环境的搭建送安装包
Cannot find a valid baseurl for repo: HDP-3.1-repo-1
SQL learning (2) -- basic query and sorting of tables
In 2022, will there be opportunities for mobile Internet apps and short video live tracks?
What are the necessary functions of short video app development?
25 common questions in Flink interview (no answer)
When a transaction encounters a distributed lock
Flink1.11 intervaljoin watermark generation, state cleaning mechanism source code understanding & demo analysis
5. Xshell connection server denied access, password error
以赛促练-力扣第303场周赛反思
Come and help you understand the Internet of things in three minutes
3. 拳王阿里
The basic concept of how Tencent cloud mlvb technology can highlight the siege in mobile live broadcasting services