用C#写的扫雷程序源代码.docVIP

  • 7
  • 0
  • 约1.92万字
  • 约 9页
  • 2017-05-12 发布于河南
  • 举报
用C#写的扫雷程序源代码

初学C#一周,老师布置了个用C#编写仿Windows扫雷游戏的作业,我用了三天才弄出来,分享出来自我满足一下。 程序是用vs 2008 控制台应用程序编的。界面有点粗糙,基本的功能倒是实现了。 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace saolei { class Program { //说明 方向键控制方向,空格键显示,按R标记地雷 static int rl = 0; //rl横坐标 static int ud = 0; //ud纵坐标 static int level = 0; //游戏难度 static int Win = 0; //根据难度赋值,用来判断是否完成游戏 static string[,] LendMine = new string[9, 9];//二维数组表示游戏界面,横纵各9格 static string[,] LendMine2 = new string[16, 16];// 横纵各16格 static Random rnd = new Random(); static bool b = true; static void Main(string[] args) { Console.Write(请选择难度(1简单,2中级):); level = int.Parse(Console.ReadLine()); switch (level) { case 1: Level1(); Win = 71; break; case 2: Level2(); Win = 216; break; default: break; } #region 绘制界面 switch (level) { case 1: for (int i = 0; i 9; i++) { for (int j = 0; j 9; j++) { Console.Write(H); } Console.WriteLine(); } break; case 2: for (int i = 0; i 16; i++) { for (int j = 0; j 16; j++) { Console.Write(H); } Console.WriteLine(); } break; default: break; } #endregion #region 进行游戏 Console.SetCursorPos

文档评论(0)

1亿VIP精品文档

相关文档