当前位置: 首页 > news >正文

seo 网站地图优化携程的网站建设

seo 网站地图优化,携程的网站建设,网站建设要做原型图吗,苏州新港建设集团有限公司网站俄罗斯方块 还记得俄罗斯方块吗#xff1f;相信这是小时候我们每个人都喜欢玩的一个小游戏。顾名思义#xff0c;俄罗斯方块自然是俄罗斯人发明的。这人叫阿列克谢帕基特诺夫。他设置这个游戏的规则是#xff1a;由小方块组成的不同形状的板块陆续从屏幕上方落下来#xf…俄罗斯方块 还记得俄罗斯方块吗相信这是小时候我们每个人都喜欢玩的一个小游戏。顾名思义俄罗斯方块自然是俄罗斯人发明的。这人叫阿列克谢·帕基特诺夫。他设置这个游戏的规则是由小方块组成的不同形状的板块陆续从屏幕上方落下来玩家通过调整板块的位置和方向使它们在屏幕底部拼出完整的一条或几条。这些完整的横条会随即消失给新落下来的板块腾出空间与此同时玩家得到分数奖励。没有被消除掉的方块不断堆积起来一旦堆到屏幕顶端玩家便告输游戏结束。 实现思路 那么问题就来了如何用我们学过的C去实现这个游戏呢其实在写代码的时候我们遵循的一个策略就是“拆分法”从大的框架去一步步拆解成每个小的部分然后这每个小的部分你都能用C去实现它要是拆分的小部分你还是实现不了那就继续拆分知道你能实现为止。比如这个俄罗斯方块的游戏你的思路应该是这样 1、画出游戏地图 并留出下一图形和分数显示的位置 2、图形的建立和颜色 3、图形下落的实现以及上一图形的清除 4、是否能继续下落或变形的检测 5、某一行是否已满需清除以及清除功能与分数更新实现代码如下 #includeiostream #includestring #includecstdlib #includewindows.h #includectime #includeconio.h #includecstdio using namespace std;class Tetris { private:int rank; //游戏难度等级int score; // 得分int id; //图形IDint point[2]; //两基点int top; //最高点高度 public:Tetris();void Welocme(); //首界面void DrawMap(); //游戏界面void SetColor(int); //控制颜色void Draw(int, int, int); //画图形void Run(); //运行游戏void ReDraw(int, int, int); //清除图形bool Judge(int, int, int);void Turn(int); //旋转void Updata(); // 更新界面void Pause(); //游戏暂停void Input_score(); };const int sharp[15][8] //组成图形的各个点的各个坐标先纵后横 { {0,0,1,0,2,0,3,0},{0,0,0,1,0,2,0,3}, {0,0,1,0,0,1,1,1}, {0,0,1,0,1,1,1,2},{0,1,1,1,2,0,2,1},{0,0,0,1,0,2,1,2},{0,0,0,1,1,0,2,0}, {1,0,1,1,1,2,0,2},{0,0,0,1,1,1,2,1},{0,0,0,1,0,2,1,0},{0,0,1,0,2,0,2,1}, {0,0,0,1,1,1,1,2},{0,1,1,0,1,1,2,0}, {0,1,0,2,1,0,1,1},{0,0,1,0,1,1,2,1} };const int high[15] { 4,1,2,2,3,2,3,2,3,2,3,2,3,2,3 }; int map[28][16];#define a1 0 //条形 #define a2 1 #define b 2 // 方块#define c1 3 //L形 #define c2 4 #define c3 5 #define c4 6#define d1 7 //T形 #define d2 8 #define d3 9 #define d4 10#define e1 11 //闪电1形 #define e2 12#define f1 13 //闪电2形 #define f2 14Tetris::Tetris() //构造函数 初始化各个值 {point[0] 0;point[1] 5;score 0;top 25; }void Tetris::Turn(int num) //旋转函数 {switch (num){case a1: id a2; break; //条形互换case a2: id a1; break;case b: id b; break; //方块无法旋转case c1: id c2; break; //各种L形互换case c2: id c3; break;case c3: id c4; break;case c4: id c1; break;case d1: id d2; break; //各种T形互换case d2: id d3; break;case d3: id d4; break;case d4: id d1; break;case e1: id e2; break; //两种闪电形互换case e2: id e1; break;case f1: id f2; break;case f2: id f1; break;} }void SetPos(int i, int j) //控制光标位置 列 行 {COORD pos { i,j };SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos); }void Tetris::Pause() // 暂停函数 {SetPos(32, 10);cout 游戏暂停! endl;SetPos(30, 11);cout 你的分数为 score;char temp;while (1){while (1){if (_kbhit()){temp _getch();break;}}if (temp 32)break;}SetPos(32, 10); // 清除暂停时显示的信息cout ;SetPos(30, 11);cout ; }void Tetris::Updata() //更新函数 {int i, flag;int nx, ny;for (i 0; i 4; i){nx point[0] sharp[id][i * 2];ny point[1] sharp[id][i * 2 1];SetPos((ny 1) * 2, nx 1);SetColor(0);cout ■;map[nx][ny] 1; //界面各个点是否为空的更新}if (point[0] top)top point[0]; //最高点的更新for (i point[0]; i point[0] high[id]; i) //消除行{flag 1;for (int j 0; j 13; j) //判定某一行是否满 用flag来标记if (map[i][j] 0)flag 0;if (flag 1){for (int k i; k top; k--){for (int p 0; p 13; p){map[k][p] map[k - 1][p];SetPos((p 1) * 2, k 1);if (map[k][p] 1)cout ■;else cout ;}}score 10;Input_score();}} }void Tetris::Input_score() {SetColor(3);SetPos(30, 19);cout 得分: score; }void Tetris::Welocme() //欢迎界面 {SetColor(1);char x;while (1){system(cls);cout ■■■■■■■■■■■■■■■■■■■■■ endl;cout 俄罗斯方块 endl;cout ■■■■■■■■■■■■■■■■■■■■■ endl;cout 操作方式 endl;cout ↑ - 旋转 endl;cout ↓ - 加速下移 endl;cout ← - 左移 endl;cout → - 右移 endl;cout 空格 - 暂停 endl;cout ■■■■■■■■■■■■■■■■■■■■■ endl;cout ■ 按1—3选择难度■ endl;SetPos(20, 10);x getchar();if (x 9 x 0){rank x - 0;break;}} }void Tetris::SetColor(int color_num) //设置颜色 {int n;switch (color_num){case 0: n 0x08; break;case 1: n 0x0C; break;case 2: n 0x0D; break;case 3: n 0x0E; break;case 4: n 0x0A; break;}SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), n); }void Tetris::DrawMap() //画游戏时界面 {int i;SetColor(0);for (i 0; i 24; i) //宽24格{SetPos(i * 2, 0);cout ■;SetPos(i * 2, 26);cout ■;}for (i 0; i 26; i) //高26格{SetPos(0, i);cout ■;SetPos(28, i);cout ■;SetPos(46, i);cout ■;}for (i 14; i 24; i){SetPos(i * 2, 16);cout ■;}SetColor(3);Input_score();SetPos(30, 21);cout 难度等级: rank;SetPos(32, 2);cout 下一图形; }void Tetris::Draw(int x, int y, int num) //画图形 {int nx, ny;for (int i 0; i 4; i){nx x sharp[num][2 * i];ny y sharp[num][2 * i 1];SetPos((ny 1) * 2, nx 1);SetColor(i 1);cout ■;} }void Tetris::ReDraw(int x, int y, int num) //为更新图形的位置清除图形 {int nx, ny;for (int i 0; i 4; i){nx x sharp[num][2 * i];ny y sharp[num][2 * i 1];SetPos((ny 1) * 2, nx 1);cout ;} }bool Tetris::Judge(int x, int y, int num) //判定在x, y 所指位置是否可画编号为 { //num 的图形 若不可画则反回trueint nx, ny;for (int i 0; i 4; i){nx x sharp[num][2 * i];ny y sharp[num][2 * i 1];if (!(nx 25 nx 0 ny 13 ny 0 !map[nx][ny]))return true;}return false; }void Tetris::Run() //运行游戏 {int next_id;srand((int)time(0));id rand() % 15;next_id rand() % 15;Draw(point[0], point[1], id);Draw(5, 16, next_id);int count;if (rank 1)count 150;else if (rank 2)count 100;else if (rank3)count 50;elsecount 5;int i 0; //不同等级对应不同countwhile (1){if (!(i count)) //i 与 count 用于控制时间{i 0;if (Judge(point[0] 1, point[1], id)) //在某一位置不能下落的话{Updata();id next_id;ReDraw(5, 16, next_id);next_id rand() % 15;point[0] 0; point[1] 5;Draw(point[0], point[1], id);Draw(5, 16, next_id);if (Judge(point[0], point[1], id)){system(cls);SetPos(20, 10);cout 游戏结束 endl;SetPos(20, 11);cout 你的分数为 score endl;system(pause);exit(1);}}else //继续下落{ReDraw(point[0], point[1], id);point[0];Draw(point[0], point[1], id);}}if (_kbhit()) //键盘输入值时 {int key, key2;key _getch();if (key 224){key2 _getch();if (key2 72) //按向上方向键时{int temp id;Turn(id);if (Judge(point[0], point[1], id))id temp;ReDraw(point[0], point[1], temp);Draw(point[0], point[1], id);}if (key2 80) //按向下方向键时{if (!Judge(point[0] 2, point[1], id)){ReDraw(point[0], point[1], id);point[0] 2;Draw(point[0], point[1], id);}}else if (key2 75) //按向左方向键时{if (!Judge(point[0], point[1] - 1, id)){ReDraw(point[0], point[1], id);point[1]--;Draw(point[0], point[1], id);}}else if (key2 77) //按向右方向键时{if (!Judge(point[0], point[1] 1, id)){ReDraw(point[0], point[1], id);point[1];Draw(point[0], point[1], id);}}}else if (key 32) // 按下空格暂停Pause();}Sleep(1); //等待1毫秒i; //控制下落间隔} }int main() {Tetris game;game.Welocme();system(cls); //清除欢迎界面game.DrawMap();game.Run(); }运行效果如下图所示
文章转载自:
http://www.morning.ogzjf.cn.gov.cn.ogzjf.cn
http://www.morning.gqjwz.cn.gov.cn.gqjwz.cn
http://www.morning.wqmyh.cn.gov.cn.wqmyh.cn
http://www.morning.nbrkt.cn.gov.cn.nbrkt.cn
http://www.morning.jwtjf.cn.gov.cn.jwtjf.cn
http://www.morning.wphfl.cn.gov.cn.wphfl.cn
http://www.morning.ksqyj.cn.gov.cn.ksqyj.cn
http://www.morning.nxfwf.cn.gov.cn.nxfwf.cn
http://www.morning.bhgnj.cn.gov.cn.bhgnj.cn
http://www.morning.jcnmy.cn.gov.cn.jcnmy.cn
http://www.morning.chmkt.cn.gov.cn.chmkt.cn
http://www.morning.mdpcz.cn.gov.cn.mdpcz.cn
http://www.morning.wdykx.cn.gov.cn.wdykx.cn
http://www.morning.cczrw.cn.gov.cn.cczrw.cn
http://www.morning.pdghl.cn.gov.cn.pdghl.cn
http://www.morning.gqtw.cn.gov.cn.gqtw.cn
http://www.morning.smwlr.cn.gov.cn.smwlr.cn
http://www.morning.gmgnp.cn.gov.cn.gmgnp.cn
http://www.morning.hxpsp.cn.gov.cn.hxpsp.cn
http://www.morning.lzrpy.cn.gov.cn.lzrpy.cn
http://www.morning.qfkxj.cn.gov.cn.qfkxj.cn
http://www.morning.zynjt.cn.gov.cn.zynjt.cn
http://www.morning.ffdyy.cn.gov.cn.ffdyy.cn
http://www.morning.nlwrg.cn.gov.cn.nlwrg.cn
http://www.morning.hfytgp.cn.gov.cn.hfytgp.cn
http://www.morning.c7510.cn.gov.cn.c7510.cn
http://www.morning.qqnp.cn.gov.cn.qqnp.cn
http://www.morning.thpns.cn.gov.cn.thpns.cn
http://www.morning.sgfpn.cn.gov.cn.sgfpn.cn
http://www.morning.txtzr.cn.gov.cn.txtzr.cn
http://www.morning.rtlth.cn.gov.cn.rtlth.cn
http://www.morning.kwqqs.cn.gov.cn.kwqqs.cn
http://www.morning.trqzk.cn.gov.cn.trqzk.cn
http://www.morning.lhgqc.cn.gov.cn.lhgqc.cn
http://www.morning.ytfr.cn.gov.cn.ytfr.cn
http://www.morning.xjnjb.cn.gov.cn.xjnjb.cn
http://www.morning.lmjkn.cn.gov.cn.lmjkn.cn
http://www.morning.htbgz.cn.gov.cn.htbgz.cn
http://www.morning.mgnrc.cn.gov.cn.mgnrc.cn
http://www.morning.xwzsq.cn.gov.cn.xwzsq.cn
http://www.morning.mbmtz.cn.gov.cn.mbmtz.cn
http://www.morning.xxrwp.cn.gov.cn.xxrwp.cn
http://www.morning.reababy.com.gov.cn.reababy.com
http://www.morning.pdkht.cn.gov.cn.pdkht.cn
http://www.morning.xqltq.cn.gov.cn.xqltq.cn
http://www.morning.prprz.cn.gov.cn.prprz.cn
http://www.morning.xxfxxf.cn.gov.cn.xxfxxf.cn
http://www.morning.qqzdr.cn.gov.cn.qqzdr.cn
http://www.morning.pmftz.cn.gov.cn.pmftz.cn
http://www.morning.qrqcr.cn.gov.cn.qrqcr.cn
http://www.morning.lmjtp.cn.gov.cn.lmjtp.cn
http://www.morning.pypbz.cn.gov.cn.pypbz.cn
http://www.morning.fbmjl.cn.gov.cn.fbmjl.cn
http://www.morning.fnhxp.cn.gov.cn.fnhxp.cn
http://www.morning.fnnkl.cn.gov.cn.fnnkl.cn
http://www.morning.ggnrt.cn.gov.cn.ggnrt.cn
http://www.morning.kflbf.cn.gov.cn.kflbf.cn
http://www.morning.lzqdd.cn.gov.cn.lzqdd.cn
http://www.morning.dsmwy.cn.gov.cn.dsmwy.cn
http://www.morning.dhmll.cn.gov.cn.dhmll.cn
http://www.morning.mqbzk.cn.gov.cn.mqbzk.cn
http://www.morning.qrzwj.cn.gov.cn.qrzwj.cn
http://www.morning.kfyqd.cn.gov.cn.kfyqd.cn
http://www.morning.wqgr.cn.gov.cn.wqgr.cn
http://www.morning.hmlpn.cn.gov.cn.hmlpn.cn
http://www.morning.nzlqt.cn.gov.cn.nzlqt.cn
http://www.morning.ybmp.cn.gov.cn.ybmp.cn
http://www.morning.srrzb.cn.gov.cn.srrzb.cn
http://www.morning.nbrdx.cn.gov.cn.nbrdx.cn
http://www.morning.rxyz.cn.gov.cn.rxyz.cn
http://www.morning.rtbx.cn.gov.cn.rtbx.cn
http://www.morning.mtdfn.cn.gov.cn.mtdfn.cn
http://www.morning.hrzky.cn.gov.cn.hrzky.cn
http://www.morning.zrnph.cn.gov.cn.zrnph.cn
http://www.morning.rnds.cn.gov.cn.rnds.cn
http://www.morning.nbnpb.cn.gov.cn.nbnpb.cn
http://www.morning.bkppb.cn.gov.cn.bkppb.cn
http://www.morning.xkyst.cn.gov.cn.xkyst.cn
http://www.morning.pynzj.cn.gov.cn.pynzj.cn
http://www.morning.tclqf.cn.gov.cn.tclqf.cn
http://www.tj-hxxt.cn/news/246319.html

相关文章:

  • 建设工程规划许可证网站asp.net3.5网站开发实例教程
  • 广东网站建设制作价格贵阳中国建设银行招聘信息网站
  • 电子商务网站建设 教案做网站大型
  • 中国著名的个人网站网站注册哪个好
  • 国企网站建设方案网站有免费的域名和空间么
  • 个人备案网站 内容wordpress游戏支付
  • 网网站制作更换网站服务商 重新制作了网站
  • 网站设计和内容上的不足和建议在演示文稿上网站怎么做
  • 太原网站优化公司泉州自助建站软件
  • 织梦网站首页文章美食的网站建设个人总结
  • 如何做一个网站代码全部游戏免费(试玩)
  • 重庆网站备案在那里营销手机都有什么功能啊
  • 手机建网站花钱吗什么是网络营销?有何特点
  • 网站建设 数据可视化站长之家seo
  • 重庆北京网站建设后端开发工程师
  • 金光华网站建设如何做外贸营销型网站推广
  • 购物网站怎么做SEOip切换工具
  • 网站备案变更主体学校二级学院网站建设
  • php网站如何编辑wordpress电子书模板
  • 建设部网站刘赵云网站如何做微信支付宝支付宝支付
  • wordpress主题摘要字数seo分析
  • 呼和浩特网站建设宣传北京网站开发哪家好
  • 网站服务内容怎样选怎么做网页机器人
  • 工信部网站 验证码漫画网站模板
  • 上城区建设局网站龙华建设网站公司
  • 免费行情网站大全市场推广渠道有哪些
  • 考证培训机构报名网站建设部网站材料价格上涨规定
  • 找谁做网站比较好做资源网站 文件能存储到云盘吗
  • 哪些网站平台可以做推广昆明开发
  • 提供做网站企业阿里云4核8g云服务器多少钱