我来教大家“红幺鸡麻将有规律吗”(确实是有挂)-哔哩哔哩

网上有关“如何用visualC++6.0编写一个贪吃蛇程序”话题很是火热,小编也是针对如何用visualC++6.0编写一个贪吃蛇程序寻找了一些与之相关的一些信息进行分析,如果能碰巧解决你现在面临的问题,希望能够帮助到您。

您好:手机麻将有挂是真的吗这款游戏可以开挂,确实是有挂的,咨询加微信【】很多玩家在这款游戏中打牌都会发现很多用户的牌特别好,总是好牌,而且好像能看到其他人的牌一样。所以很多小伙伴就怀疑这款游戏是不是有挂,实际上这款游戏确实是有挂的
http://www.boyicom.net/sheng/1.jpg
1.手机麻将有挂是真的吗这款游戏可以开挂,确实是有挂的,通过添加客服微信 2.咨询软件加微信【】在"设置DD功能DD微信手麻工具"里.点击"开启". 3.打开工具.在"设置DD新消息提醒"里.前两个选项"设置"和"连接软件"均勾选"开启"(好多人就是这一步忘记做了) 4.打开某一个微信组.点击右上角.往下拉."消息免打扰"选项.勾选"关闭"(也就是要把"群消息的提示保持在开启"的状态.这样才能触系统发底层接口)

#ifndef __COLORCONSOLE__H__

#define __COLORCONSOLE__H__

#include <windows.h>

#include <iostream>

#include <conio.h>

#include <time.h>

using namespace std;

HANDLE initiate();

BOOL textout(HANDLE hOutput,int x,int y,WORD wColors[],int nColors,LPTSTR lpszString);

#endif

#ifndef __FOOD__H__ //防止重复引用该头文件

#define __FOOD__H__

#include "colorConsole.h"

class Food

{

public:

void initfood(int); //出始化食物函数

protected:

WORD goodcolor[1]; //定义正常食物的颜色

WORD badcolor[1]; //定义变质食物的颜色

int numgood,goodx[50],goody[50]; //定义正常食物的个数、坐标

int numbad,badx[30],bady[30]; //定义变质食物的个数、坐标

};

#endif

#ifndef __FOOD__H__ //防止重复引用该头文件

#define __FOOD__H__

#include "colorConsole.h"

class Food

{

public:

void initfood(int); //出始化食物函数

protected:

WORD goodcolor[1]; //定义正常食物的颜色

WORD badcolor[1]; //定义变质食物的颜色

int numgood,goodx[50],goody[50]; //定义正常食物的个数、坐标

int numbad,badx[30],bady[30]; //定义变质食物的个数、坐标

};

#endif

#ifndef __SNAKE__H__ //防止重复引用该头文件

#define __SNAKE__H__

#include "colorConsole.h"

class Snake

{

public:

void initsnake(); //初始化蛇的函数

protected:

WORD bColor[1]; //定义蛇身的颜色

WORD hColor[1]; //定义蛇头的颜色

int headx,heady,bodyx[100],bodyy[100]; //定义蛇头和蛇身的坐标

int node; //定义蛇身的节数

};

#endif

#include "colorConsole.h"

HANDLE initiate()

{

HANDLE hOutput;

hOutput = GetStdHandle(STD_OUTPUT_HANDLE);

return hOutput;

}

BOOL textout(HANDLE hOutput,int x,int y,WORD wColors[],int nColors,LPTSTR lpszString)

{

DWORD cWritten;

BOOL fSuccess;

COORD coord;

coord.X = x; // start at first cell

coord.Y = y; // of first row

fSuccess = WriteConsoleOutputCharacter(

hOutput, // screen buffer handle

lpszString, // pointer to source string

lstrlen(lpszString), // length of string

coord, // first cell to write to

&cWritten); // actual number written

if (! fSuccess)

cout<<"error:WriteConsoleOutputCharacter"<<endl;

for (;fSuccess && coord.X < lstrlen(lpszString)+x; coord.X += nColors)

{

fSuccess = WriteConsoleOutputAttribute(

hOutput, // screen buffer handle

wColors, // pointer to source string

nColors, // length of string

coord, // first cell to write to

&cWritten); // actual number written

}

if (! fSuccess)

cout<<"error:WriteConsoleOutputAttribute"<<endl;

return 0;

}

#include "Food.h"

HANDLE handle;

void Food::initfood(int lev) //初始化食物

{

numgood=lev*5;

numbad=lev*2;

goodcolor[0]=FOREGROUND_RED|FOREGROUND_BLUE; //正常食物的颜色

badcolor[0]=FOREGROUND_RED|FOREGROUND_GREEN; //变质食物的颜色

srand((unsigned) time(NULL));

textout(handle,64,6,goodcolor,1,"正常食物为★"); //输出图例

textout(handle,64,8,badcolor,1,"变质食物为★");

for(int fgood=0;fgood<numgood;fgood++) //输出正常食物

{

goodx[fgood]=((rand()%55+4)/2)*2;

goody[fgood]=rand()%26+4;

textout(handle,goodx[fgood],goody[fgood],goodcolor,1,"★");

}

for(int fbad=0;fbad<numbad;fbad++) //输出变质食物

{

badx[fbad]=((rand()%56+4)/2)*2;

bady[fbad]=rand()%26+4;

textout(handle,badx[fbad],bady[fbad],badcolor,1,"★");

}

}

#include "Game.h"

HANDLE handle;

Game::Game()

{

node=3; //蛇的出始默认节数

headx=44,heady=4; //蛇头的出始默认坐标

controlx=-2,controly=0; //蛇的出始默认方向为向左

start=0;

scores=0;

self=0,wall=0,died=0; //游戏结束条件默认为否

sColor[0]=FOREGROUND_GREEN|FOREGROUND_INTENSITY; //围墙颜色

head[0]=FOREGROUND_RED|FOREGROUND_INTENSITY; //开始界面文字颜色

}

int Game::starting()

{

while(1)

{

textout(handle,22,16,head,1,"控制键: W-上 S-下 A-左 D-右"); //开始界面

textout(handle,16,18,head,1,"吃完所有正常食物升级 千万不要吃到变质的食物哦!");

textout(handle,30,20,head,1, "选择级数 1-9 ");

if(_kbhit())

{

int v=_getch(); //选择级数

switch(v)

{

case 49:

level=1;

break;

case 50:

level=2;

break;

case 51:

level=3;

break;

case 52:

level=4;

break;

case 53:

level=5;

break;

case 54:

level=6;

break;

case 55:

level=7;

break;

case 56:

level=8;

break;

default:

level=9;

break;

}

textout(handle,16,18,head,1," "); //清屏

textout(handle,30,20,head,1, " ");

textout(handle,22,16,head,1," ");

break;

}

}

//设置四周围墙

for(int wideup=2;wideup<60;wideup+=2) //上边

{

textout(handle,wideup,2,sColor,1,"■");

}

for(int widedown=2;widedown<60;widedown+=2) //下边

{

textout(handle,widedown,30,sColor,1,"■");

}

for(int longr=2;longr<30;longr++) //左边

{

textout(handle,2,longr,sColor,1,"■");

}

for(int longl=2;longl<31;longl++) //右边

{

textout(handle,60,longl,sColor,1,"■");

}

levelup=5*level;

return level;

}

void Game::ifstart() //由用户判断是否开始游戏

{

textout(handle,24,0,sColor,1,"按 y 开始游戏");

int v=_getch();

switch(v)

{

case 'y': start=1;break;

default : start=0;break;

}

textout(handle,24,0,sColor,1," "); //清屏

}

bool Game::getstart() //获得start

{

return start;

}

void Game::moventurn() //关于移动和转向的函数

{

int len1=0; //设置一个消除原有图形的计数器

for(int len=0;len<node;len++) //消除原有图形

{

textout(handle,bodyx[len],bodyy[len],bColor,1," ");

}

for(int len6=node-1;len6>0;len6--) //显示移动以后的图形

{

len1=len6-1;

bodyx[len6]=bodyx[len1]; //获得前一节body的坐标

bodyy[len6]=bodyy[len1];

textout(handle,bodyx[len6],bodyy[len6],bColor,1,"●"); //移动后的图形

}

bodyx[0]=headx;

bodyy[0]=heady;

textout(handle,bodyx[0],bodyy[0],bColor,1,"●"); //显示移动后的第一节

headx+=controlx;

heady+=controly;

textout(handle,headx,heady,hColor,1,"◎"); //显示移动后的头部

Sleep(165-level*17); //速度

if(kbhit()) //转向

{

char direction=getch(); //获取方向

if(direction=='w'&&direc!='s')

{

textout(handle,headx,heady,hColor,1," ");

textout(handle,headx,heady,hColor,1,"◎");

controlx=0;

controly=-1;

direc='w';

}

if(direction=='s'&&direc!='w')

{

textout(handle,headx,heady,hColor,1," ");

textout(handle,headx,heady,hColor,1,"◎");

controlx=0;

controly=1;

direc='s';

}

if(direction=='a'&&direc!='d')

{

textout(handle,headx,heady,hColor,1," ");

textout(handle,headx,heady,hColor,1,"◎");

controlx=-2;

controly=0;

direc='a';

}

if(direction=='d'&&direc!='a')

{

textout(handle,headx,heady,hColor,1," ");

textout(handle,headx,heady,hColor,1,"◎");

controlx=2;

controly=0;

direc='d';

}

}

}

bool Game::ifgameover() //判断是否结束游戏

{

if(headx==2||headx==60||heady==2||heady==30) //撞墙

{

wall=1;

return 1;

}

for(int sbody=1;sbody<node;sbody++) //咬到自己

{

if(headx==bodyx[sbody]&&heady==bodyy[sbody])

{

self=1;

return 1;

}

}

for(int countbad=0;countbad<numbad;countbad++) //吃到变质食物

{

if(headx==badx[countbad]&&heady==bady[countbad])

{

died=1;

return 1;

}

}

return 0;

}

void Game::gameover() //输出游戏结束界面

{

//sndPlaySound("DOWN.wav",SND_ASYNC);

if(wall==1)

textout(handle,20,14,sColor,1,"撞到墙了 游戏结束");

if(self==1)

textout(handle,20,14,sColor,1,"咬到自己了 游戏结束");

if(died==1)

textout(handle,19,14,sColor,1,"吃到变质食物了 游戏结束");

}

void Game::scorenlevelup()

{

char marks[5],Level[5]; //准备输出级数和分数

for(int eatgood=0;eatgood<numgood;eatgood++) //判断是否咬到正常食物以加分

{

if(headx==goodx[eatgood]&&heady==goody[eatgood])

{

//sndPlaySound("LASER.wav",SND_ASYNC);

goodx[eatgood]=74; //防止以后走到已吃过食物点的时候会判断为吃到而加分以影响升级

goody[eatgood]=6;

node++; //长一截

scores+=10; //加十分

itoa(scores,marks,10); //转换数据类型,准备输出

itoa(level,Level,10);

textout(handle,64,11,hColor,1,"分数:"); //输出分数

textout(handle,70,11,hColor,1,marks);

textout(handle,64,13,hColor,1,"级数:"); //输出级数

textout(handle,70,13,hColor,1,Level);

levelup--;

if(levelup==4)

{

for(int fgood=0;fgood<numgood;fgood++) //再次输出正常食物

{

textout(handle,goodx[fgood],goody[fgood],goodcolor,1,"★");

}

}

}

}

if(levelup==0) //升级

{

level++;

levelup=5*level;

for(int i=4;i<58;i+=2) //清屏

{

for(int j=4;j<30;j++)

{

textout(handle,i,j,sColor,1," ");

}

}

initfood(level); //输出食物

textout(handle,headx,heady,hColor,1,"◎"); //打印蛇头

for(int j=0;j<node;j++) //打印蛇身

{

textout(handle,bodyx[j],bodyy[j],bColor,1,"●");

}

textout(handle,18,0,hColor,1,"按任意键开始更高的等级");

itoa(level,Level,10);

textout(handle,70,13,hColor,1,Level); //输出新的级数

while(1) //由用户控制是否开始更高等级

{

if (_kbhit())

{

textout(handle,18,0,sColor,1, " ");

break;

}

}

}

}

#include "Snake.h"

extern HANDLE handle;

void Snake::initsnake() //初始化蛇

{

hColor[0]=FOREGROUND_RED|FOREGROUND_INTENSITY; //蛇头颜色

bColor[0]=FOREGROUND_BLUE|FOREGROUND_INTENSITY; //蛇身颜色

for(int i=0;i<node;i++) //蛇身各节的坐标定义

{

bodyx[i]=(i+1)*2+headx;

bodyy[i]=heady;

}

textout(handle,headx,heady,hColor,1,"◎"); //打印蛇头

for(int j=0;j<node;j++) //打印蛇身

{

textout(handle,bodyx[j],bodyy[j],bColor,1,"●");

}

}

#include "Snake.h"

#include "Food.h"

#include "Game.h"

Game game;

HANDLE handle; //窗口句柄

void main()

{

//sndPlaySound("BACKGROUND.wav",SND_LOOP|SND_ASYNC);

handle=initiate(); //初始化窗口句柄

game.initfood(game.starting()); //初始化食物

game.initsnake(); //初始化蛇

game.ifstart(); //玩家是否开始游戏

if(game.getstart())

{ while(1)

{

game.moventurn(); //蛇的移动和转向

game.scorenlevelup(); //得分和升级

if(game.ifgameover()) //判断是否中止游戏

break;

}

game.gameover(); //输出游戏结束原因

}

}

这是一个控制台的贪吃蛇 比较简单

只要楼主了解几个API函数就可以 至于算法 有好多 我这个不怎么样

我建议用链表来表示蛇体 下面是我的一个snake 类 函数体没给 楼主自己想吧

struct node

{node* pre;

Cpoint point;

node* next;

};

node::node()

{ point(0,0);

pre=NULL;

next=NULL;

};

class snake

{ private:

node* snakehead;

node snakebody[100];

int length

int direction;

public:

void go();

bool fail();

void textout();

} ;

用c++实现的"贪吃蛇"游戏源码

// greedsnake.cpp

#include <bios.h>

#include <conio.h>

#include <dos.h>

#include <graphics.h>

#include <stdlib.h>

#include <time.h>

#include "conf.h"

typedef struct node

{

int x,y;

struct node *next;

}Node;

typedef struct

{

Node *head,*tail;

int length;

}Snake;

typedef struct

{

int left,top,right,bottom;

}Frame;

typedef enum

//四个方向

{

up,down,left,right

}Direction;

typedef enum

{

false,true

}bool;//*/

void InitGraphMode();

//初始化图形驱动

void CloseGraphMode();

void Foot(int,int);

void Head(int,int);

void CreateFrame();

//完成整个游戏框架的绘制

void CreateSnake();

//创建一条两个节点的蛇,蛇的每一节是队列中的一个节点

bool PlayGame();

//游戏的主体函数,

int Hit(int,int);

//判断是否越界,或者撞到自身,两个参数分别是新的头接点的x,y坐标

bool GameOver();

//绘制游戏结束时弹出的对话框

void Enqueue(Node);

//入队函数

Node Dequeue();

//出队函数

void ClearKeyBuf();

//清除键盘缓冲,此函数可以消除不停的按无效键的影响

Snake snake;

Frame frame;

void main()

{

InitGraphMode();

do

{

CreateFrame();

}while(PlayGame());

CloseGraphMode();

}

void InitGraphMode()

{

int gdriver=DETECT,gmode;

initgraph(&gdriver,&gmode,"../bgi/");

cleardevice();

}

void CloseGraphMode()

{

cleardevice();

closegraph();

}

void CreateFrame()

{

setbkcolor(CYAN);

//下面的四行代码用于计算主框架的左上角和右下角的坐标

frame.left=(getmaxx()+1-BlockWidth*RowOfFrame)/2;

frame.top=(getmaxy()+1-BlockHeight*ColumnOfFrame)/2;

frame.right=frame.left+BlockWidth*RowOfFrame;

frame.bottom=frame.top+BlockHeight*ColumnOfFrame;

Head(frame.left+100,frame.top-20);

setfillstyle(SOLID_FILL,LIGHTGRAY);

bar(frame.left,frame.top,frame.right,frame.bottom);

setlinestyle(SOLID_LINE,1,1);

setcolor(DARKGRAY);

line(frame.left,frame.top,frame.right,frame.top);

line(frame.left,frame.top,frame.left,frame.bottom);

setlinestyle(SOLID_LINE,1,1);

setcolor(WHITE);

line(frame.left,frame.bottom,frame.right,frame.bottom);

line(frame.right,frame.top,frame.right,frame.bottom);

setlinestyle(DOTTED_LINE,1,1);

setcolor(BLUE);

for(int row=1;row<RowOfFrame;row++)

line(frame.left+row*BlockWidth,frame.top,frame.left+row*BlockWidth,frame.bottom);

for(int column=1;column<ColumnOfFrame;column++)

line(frame.left,frame.top+column*BlockHeight,frame.right,frame.top+column*BlockHeight);

Foot(frame.left,frame.bottom+20);

}

void CreateSnake()

{

Node *node1=new Node;

Node *node2=new Node;

node1->x=frame.left+BlockWidth;

node1->y=frame.top;

node1->next=NULL;

snake.tail=node1;

node2->x=frame.left;

node2->y=frame.top;

node2->next=snake.tail;

snake.head=node2;

snake.length=2;

<br

关于“如何用visualC++6.0编写一个贪吃蛇程序”这个话题的介绍,今天小编就给大家分享完了,如果对你有所帮助请保持对本站的关注!

(0)
上一篇 2024年05月16日
下一篇 2024年05月16日

相关推荐