當前位置:首頁 » 操作系統 » c棋牌游戲源碼

c棋牌游戲源碼

發布時間: 2022-05-13 04:41:43

① 求一些C語言小游戲的源代碼,謝謝

「推箱子」C代碼:

#include <stdio.h>

#include <conio.h>

#include<stdlib.h>

#include<windows.h>

int m =0; //m代表第幾關

struct maps{short a[9][11]; };

struct maps map[5]={ 0,0,0,0,0,0,0,0,0,0,0, //共5關,每關9行11列

0,1,1,1,1,1,1,1,0,0,0,

0,1,0,0,0,0,0,1,1,1,0,

1,1,4,1,1,1,0,0,0,1,0, //0空地,1牆

1,5,0,0,4,0,0,4,0,1,0, //4是箱子,5是人

1,0,3,3,1,0,4,0,1,1,0, //3是目的地

1,1,3,3,1,0,0,0,1,0,0, //7是箱子在目的地(4+3)

0,1,1,1,1,1,1,1,1,0,0, //8是人在目的地(5+3)

0,0,0,0,0,0,0,0,0,0,0,

0,0,0,0,0,0,0,0,0,0,0,

0,0,1,1,1,1,0,0,0,0,0,

0,0,1,5,0,1,1,1,0,0,0,

0,0,1,0,4,0,0,1,0,0,0,

0,1,1,1,0,1,0,1,1,0,0,

0,1,3,1,0,1,0,0,1,0,0,

0,1,3,4,0,0,1,0,1,0,0,

0,1,3,0,0,0,4,0,1,0,0,

0,1,1,1,1,1,1,1,1,0,0,

0,0,0,0,0,0,0,0,0,0,0,

0,0,0,1,1,1,1,1,1,1,0,

0,0,1,1,0,0,1,0,5,1,0,

0,0,1,0,0,0,1,0,0,1,0,

0,0,1,4,0,4,0,4,0,1,0,

0,0,1,0,4,1,1,0,0,1,0,

1,1,1,0,4,0,1,0,1,1,0,

1,3,3,3,3,3,0,0,1,0,0,

1,1,1,1,1,1,1,1,1,0,0,

0,1,1,1,1,1,1,1,1,1,0,

0,1,0,0,1,1,0,0,0,1,0,

0,1,0,0,0,4,0,0,0,1,0,

0,1,4,0,1,1,1,0,4,1,0,

0,1,0,1,3,3,3,1,0,1,0,

1,1,0,1,3,3,3,1,0,1,1,

1,0,4,0,0,4,0,0,4,0,1,

1,0,0,0,0,0,1,0,5,0,1,

1,1,1,1,1,1,1,1,1,1,1,

0,0,0,0,0,0,0,0,0,0,0,

0,0,0,1,1,1,1,1,1,0,0,

0,1,1,1,0,0,0,0,1,0,0,

1,1,3,0,4,1,1,0,1,1,0,

1,3,3,4,0,4,0,0,5,1,0,

1,3,3,0,4,0,4,0,1,1,0,

1,1,1,1,1,1,0,0,1,0,0,

0,0,0,0,0,1,1,1,1,0,0,

0,0,0,0,0,0,0,0,0,0,0 };

void DrMap( ) //繪制地圖

{ CONSOLE_CURSOR_INFO cursor_info={1,0}; //隱藏游標的設置

SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);

printf(" 推箱子");

printf(" ");

for (int i = 0; i < 9; i++)

{for (int j = 0; j < 11; j++)

{switch (map[m].a[i][j])

{case 0: printf(" "); break;

case 1: printf("■"); break;

case 3: printf("◎");break;

case 4: printf("□"); break;

case 5: printf("♀"); break; //5是人

case 7: printf("□"); break; //4 + 3箱子在目的地中

case 8: printf("♀");break; // 5 + 3人在目的地中

}

}

printf(" ");

}

}

void gtxy(int x, int y) //控制游標位置的函數

{ COORD coord;

coord.X = x;

coord.Y = y;

SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);

}

void start( ) //開始游戲

{ int r, c; //人的下標

for (int i = 0; i < 9; i++)

{ for (int j = 0; j < 11; j++)

{if (map[m].a[i][j] == 5||map[m].a[i][j]==8) { r = i; c = j; } } //i j 人的下標

}

char key;

key = getch( );

switch (key)

{case 'W':

case 'w':

case 72:

if (map[m]. a[r - 1][c] == 0|| map[m]. a [r - 1][c] == 3)

{ gtxy(2*c+8,r-1+3); printf("♀"); // gtxy(2*c+8,r-1+3)是到指定位置輸出字元

if(map[m]. a[r ][c] == 5){gtxy(2*c+8,r+3); printf(" "); }

if(map[m]. a[r ][c] == 8){gtxy(2*c+8,r+3); printf("◎");}

map[m]. a [r - 1][c] += 5; map[m]. a [r][c] -= 5; }

else if (map[m]. a [r - 1][c] == 4 || map[m]. a [r - 1][c] == 7)

{ if (map[m]. a [r - 2][c] == 0 || map[m]. a [r - 2][c] == 3)

{ gtxy(2*c+8,r-2+3); printf("□"); gtxy(2*c+8,r-1+3); printf("♀");

if(map[m]. a[r ][c] == 5){gtxy(2*c+8,r+3); printf(" "); }

if(map[m]. a[r ][c] == 8){gtxy(2*c+8,r+3); printf("◎");}

map[m]. a [r - 2][c] += 4; map[m]. a [r - 1][c] += 1;

map[m]. a [r][c] -= 5; }

} break;

case 'S':

case 's':

case 80:

if (map[m]. a [r + 1][c] == 0 || map[m]. a [r + 1][c] == 3)

{ gtxy(2*c+8,r+1+3); printf("♀");

if(map[m]. a[r ][c] == 5){gtxy(2*c+8,r+3); printf(" "); }

if(map[m]. a[r ][c] == 8){gtxy(2*c+8,r+3); printf("◎");}

map[m]. a [r + 1][c] += 5; map[m]. a [r][c] -= 5; }

else if (map[m]. a [r + 1][c] == 4 || map[m]. a [r+ 1][c] == 7)

{ if (map[m]. a [r + 2][c] == 0 || map[m]. a [r + 2][c] == 3)

{ gtxy(2*c+8,r+2+3); printf("□"); gtxy(2*c+8,r+1+3); printf("♀");

if(map[m]. a[r ][c] == 5){gtxy(2*c+8,r+3); printf(" "); }

if(map[m]. a[r ][c] == 8){gtxy(2*c+8,r+3); printf("◎");}

map[m]. a [r + 2][c] += 4; map[m]. a [r + 1][c] += 1;

map[m]. a [r][c] -= 5; }

}break;

case 'A':

case 'a':

case 75:

if (map[m]. a [r ][c - 1] == 0 || map[m]. a [r ][c - 1] == 3)

{ gtxy(2*(c-1)+8,r+3); printf("♀");

if(map[m]. a[r ][c] == 5){gtxy(2*c+8,r+3); printf(" "); }

if(map[m]. a[r ][c] == 8){gtxy(2*c+8,r+3); printf("◎");}

map[m]. a [r ][c - 1] += 5; map[m]. a [r][c] -= 5; }

else if (map[m]. a [r][c - 1] == 4 || map[m]. a [r][c - 1] == 7)

{if (map[m]. a [r ][c - 2] == 0 || map[m]. a [r ][c - 2] == 3)

{ gtxy(2*(c-2)+8,r+3); printf("□"); gtxy(2*(c-1)+8,r+3); printf("♀");

if(map[m]. a[r ][c] == 5){gtxy(2*c+8,r+3); printf(" "); }

if(map[m]. a[r ][c] == 8){gtxy(2*c+8,r+3); printf("◎");}

map[m]. a [r ][c - 2] += 4; map[m]. a [r ][c - 1] += 1;

map[m]. a [r][c] -= 5; }

}break;

case 'D':

case 'd':

case 77:

if (map[m]. a [r][c + 1] == 0 || map[m]. a [r][c + 1] == 3)

{ gtxy(2*(c+1)+8,r+3); printf("♀");

if(map[m]. a[r ][c] == 5){gtxy(2*c+8,r+3); printf(" "); }

if(map[m]. a[r ][c] == 8) {gtxy(2*c+8,r+3); printf("◎");}

map[m]. a [r][c + 1] += 5; map[m]. a [r][c] -= 5; }

else if (map[m]. a [r][c + 1] == 4 || map[m]. a [r][c + 1] == 7)

{ if (map[m]. a [r][c + 2] == 0 || map[m]. a [r][c + 2] == 3)

{ gtxy(2*(c+2)+8,r+3); printf("□"); gtxy(2*(c+1)+8,r+3); printf("♀");

if(map[m]. a[r ][c] == 5){gtxy(2*c+8,r+3); printf(" "); }

if(map[m]. a[r ][c] == 8){gtxy(2*c+8,r+3); printf("◎");}

map[m]. a [r][c + 2] += 4; map[m]. a [r][c + 1] += 1;

map[m]. a [r][c] -= 5; }

}break;

}

}

int ifwan( ) //是否完成(1是0否)

{ if(m==0){if(map[m].a[5][2]==7&& map[m].a[5][3]==7&&

map[m].a[6][2]==7&& map[m].a[6][3]==7) return 1;}

if(m==1){if(map[m].a[5][2]==7&& map[m].a[6][2]==7&&

map[m].a[7][2]==7) return 1;}

if(m==2){if(map[m].a[7][1]==7&& map[m].a[7][2]==7&& map[m].a[7][3]==7&&

map[m].a[7][4]==7&& map[m].a[7][5]==7) return 1;}

if(m==3){if(map[m].a[4][4]==7&& map[m].a[4][5]==7&& map[m].a[4][6]==7&&

map[m].a[5][4]==7&& map[m].a[5][5]==7&& map[m].a[5][6]==7) return 1;}

if(m==4){if(map[m].a[3][2]==7&& map[m].a[4][1]==7&& map[m].a[4][2]==7&&

map[m].a[5][1]==7&& map[m].a[5][2]==7) return 1;}

return 0;

}

int main( ) //主函數

{ while (1)

{ system("cls");

DrMap( );

while (1)

{ start( );

if(ifwan()){printf("07");break;} //完成後響鈴

}

m+=1;

}

return 0;

}

② 用C語言設計一個「三子棋」的游戲,要求用上下左右游標控制。要程序源代碼!

#include <iostream>
#include <string>
using namespace std;
class CGobang //棋子類
{
private:
char chSort; //棋子的類別
int nWin; //贏棋的次數
int nLose; //輸棋的次數
static int nDraw; //平局次數
static char achBoard[3][3]; //棋盤
static int nSize; //棋盤的尺寸 nSize X nSize
public:
CGobang(char chsort) //構造函數,決定一方棋子的類別
{
chSort=chsort;
nWin=nLose=nDraw=0;
}
void PlayTurn(void); //走1步棋
int Judge(); //判斷是否連成一線,是則返回1,否則返回0
void Win(void); //贏棋
void Lose(void); //輸棋
static void Draw(void); //平局
void PrintInfo(void); //輸出總體情況
static void PrintBoard(void); //輸出棋盤
static int GetFull(void); //判斷棋盤是否已布滿棋子
static void InitialBoard(void); //初始化棋盤

};
char CGobang::achBoard[3][3];
int CGobang::nSize = 3;
int CGobang::nDraw = 0;
void CGobang::Draw()
{
cout << "\n\n\t\t平局!\n\n";
nDraw++;
}

void CGobang::InitialBoard() //初始化棋盤
{
for(int i=0;i<nSize;i++)
for(int j=0;j<nSize;j++)
achBoard[i][j]=' ';
}
void CGobang::PrintBoard() //輸出棋盤
{
cout << endl;
cout << " 1 2 3 " << endl;
cout << "1 " << achBoard[0][0] << " | " << achBoard[0][1] << " | " << achBoard[0][2] << endl;
cout << " ---|---|---" << endl;
cout << "2 " << achBoard[1][0] << " | " << achBoard[1][1] << " | " << achBoard[1][2] << endl;
cout << " ---|---|---" << endl;
cout << "3 " << achBoard[2][0] << " | " << achBoard[2][1] << " | " << achBoard[2][2] << endl;
cout << endl;
cout << endl;
}
int CGobang::GetFull() //判斷棋盤是否布滿棋子,若是返回1
{
for(int i=0;i<nSize;i++)
for(int j=0;j<nSize;j++)
if(achBoard[i][j]!=' ')
return 0;

return 1;
}
void CGobang::Win() //贏棋
{
cout << "\n\n\t\t"<<chSort<<"方獲勝!\n\n";
nWin++;
}
void CGobang::Lose() //輸棋
{
nLose++;
}
void CGobang::PlayTurn(void) //走1步棋
{
int nRow,nCol;
cout <<"現在該 "<<chSort<<" 方下棋,請輸入棋盤坐標(x,y):";
do
{
cin >> nRow >> nCol; //輸入坐標
if(nRow>nSize || nCol>nSize) //判斷坐標越界
cout <<"輸入的坐標越界,x與y的范圍應小於等於"<<nSize<<",請重新輸入\n";
else if(achBoard[nRow-1][nCol-1]!=' ') //判斷坐標合理
cout <<"棋盤("<<nRow <<" ,"<<nCol <<")處已有棋子,請重新輸入\n";
else
{
achBoard[nRow-1][nCol-1]=chSort; //在坐標處放上棋子
break; //退出循環
}
}while(1);
}
int CGobang::Judge() //判斷是否棋子連成一線,若是返回1
{//以下是各種可能連成一線的情況
if(achBoard[0][0]==chSort && achBoard[1][1]==chSort && achBoard[2][2]==chSort)
return 1;
else if(achBoard[2][0]==chSort && achBoard[1][1]==chSort && achBoard[0][2]==chSort)
return 1;
else if(achBoard[0][0]==chSort && achBoard[1][0]==chSort && achBoard[2][0]==chSort)
return 1;
else if(achBoard[0][1]==chSort && achBoard[1][1]==chSort && achBoard[2][1]==chSort)
return 1;
else if(achBoard[0][2]==chSort && achBoard[1][2]==chSort && achBoard[2][2]==chSort)
return 1;
else if(achBoard[0][0]==chSort && achBoard[0][1]==chSort && achBoard[0][2]==chSort)
return 1;
else if(achBoard[1][0]==chSort && achBoard[1][1]==chSort && achBoard[1][2]==chSort)
return 1;
else if(achBoard[2][0]==chSort && achBoard[2][1]==chSort && achBoard[2][2]==chSort)
return 1;
else
return 0; //沒有連成一線則返回0
}
void CGobang::PrintInfo(void) //列印總體情況
{
cout <<"Side "<<chSort<<"方共計贏 "<<nWin<<" 局,輸 "<<nLose<<" 局,平 "<<nDraw<<" 局。"<<endl;
}
void PrintRule(void) //列印規則
{
cout << "\t\t歡迎使用三子連珠游戲!" << endl << endl;
cout << "\t游戲規則:" << endl;
cout << "\t1.每1步輸入要下棋的格子的x,y坐標,按Enter鍵\n";
cout << "\t2.有1方首先3個棋子連成一線即判獲勝\n";
cout << "\t3.當棋子布滿棋盤但仍無獲勝方即為平局\n";
cout << "\t4.X方先行\n";
cout << "\n\n\t\t請按任意鍵開始下棋!\n\n";
}
int JudgePlay(CGobang & SideX,CGobang & SideO) //每下1步要進行輸贏的判斷,有結果則返回1
{
if(SideX.Judge()) //X方獲勝
{
SideX.Win();
SideO.Lose();
return 1;
}
else if(SideO.Judge()) //O方獲勝
{
SideO.Win();
SideX.Lose();
return 1;
}
else
return 0;
}
void Play(CGobang & SideX,CGobang & SideO) //開始一局游戲
{
while(1)
{
CGobang::PrintBoard(); //輸出棋盤
SideX.PlayTurn(); //X方下棋
if(JudgePlay(SideX,SideO)) //判斷輸贏
break;
if(CGobang::GetFull()) //判斷是否平局
{
CGobang::Draw();
break;
}
CGobang::PrintBoard(); //輸出棋盤
SideO.PlayTurn(); //O方下棋
if(JudgePlay(SideX,SideO)) //判斷輸贏
break;
if(CGobang::GetFull()) //判斷是否平局
{
CGobang::Draw();
break;
}
}
}

int main(void)
{
CGobang SideX('X'),SideO('O'); //定義兩個棋子類對象,分別代表X方與O方
PrintRule();
cin.get();
string strChoice;
do
{
CGobang::InitialBoard(); //初始化棋盤
Play(SideX,SideO); //開始下一局
cout << "是否繼續(Y/N)?";
cin >> strChoice;
}while(strChoice == "Y" || strChoice == "y");

SideX.PrintInfo();
SideO.PrintInfo();
cout << "\n\n\t歡迎再次使用三子連珠游戲!" << endl << endl;
return 0;
}

③ (完整word版)純C語言寫的一個小型游戲 源代碼

"掃雷"小游戲C代碼

#include<stdio.h>
#include<math.h>
#include<time.h>
#include<stdlib.h>
main( )
{char a[102][102],b[102][102],c[102][102],w;
int i,j; /*循環變數*/
int x,y,z[999]; /*雷的位置*/
int t,s; /*標記*/
int m,n,lei; /*計數*/
int u,v; /*輸入*/
int hang,lie,ge,mo; /*自定義變數*/
srand((int)time(NULL)); /*啟動隨機數發生器*/
leb1: /*選擇模式*/
printf(" 請選擇模式: 1.標准 2.自定義 ");
scanf("%d",&mo);
if(mo==2) /*若選擇自定義模式,要輸入三個參數*/
{do
{t=0; printf("請輸入 行數 列數 雷的個數 ");
scanf("%d%d%d",&hang,&lie,&ge);
if(hang<2){printf("行數太少 "); t=1;}
if(hang>100){printf("行數太多 ");t=1;}
if(lie<2){printf("列數太少 ");t=1;}
if(lie>100){printf("列數太多 ");t=1;}
if(ge<1){printf("至少要有一個雷 ");t=1;}
if(ge>=(hang*lie)){printf("雷太多了 ");t=1;}
}while(t==1);
}
else{hang=10,lie=10,ge=10;} /*否則就是選擇了標准模式(默認參數)*/
for(i=1;i<=ge;i=i+1) /*確定雷的位置*/
{do
{t=0; z[i]=rand( )%(hang*lie);
for(j=1;j<i;j=j+1){if(z[i]==z[j]) t=1;}
}while(t==1);
}
for(i=0;i<=hang+1;i=i+1) /*初始化a,b,c*/
{for(j=0;j<=lie+1;j=j+1) {a[i][j]='1'; b[i][j]='1'; c[i][j]='0';} }
for(i=1;i<=hang;i=i+1)
{for(j=1;j<=lie;j=j+1) {a[i][j]='+';} }
for(i=1;i<=ge;i=i+1) /*把雷放入c*/
{x=z[i]/lie+1; y=z[i]%lie+1; c[x][y]='#';}
for(i=1;i<=hang;i=i+1) /*計算b中數字*/
{for(j=1;j<=lie;j=j+1)
{m=48;
if(c[i-1][j-1]=='#')m=m+1; if(c[i][j-1]=='#')m=m+1;
if(c[i-1][j]=='#')m=m+1; if(c[i+1][j+1]=='#')m=m+1;
if(c[i][j+1]=='#')m=m+1; if(c[i+1][j]=='#')m=m+1;
if(c[i+1][j-1]=='#')m=m+1; if(c[i-1][j+1]=='#')m=m+1;
b[i][j]=m;
}
}
for(i=1;i<=ge;i=i+1) /*把雷放入b中*/
{x=z[i]/lie+1; y=z[i]%lie+1; b[x][y]='#';}

lei=ge; /*以下是游戲設計*/
do
{leb2: /*輸出*/
system("cls");printf(" ");

printf(" ");
for(i=1;i<=lie;i=i+1)
{w=(i-1)/10+48; printf("%c",w);
w=(i-1)%10+48; printf("%c ",w);
}
printf(" |");
for(i=1;i<=lie;i=i+1){printf("---|");}
printf(" ");
for(i=1;i<=hang;i=i+1)
{w=(i-1)/10+48; printf("%c",w);
w=(i-1)%10+48; printf("%c |",w);
for(j=1;j<=lie;j=j+1)
{if(a[i][j]=='0')printf(" |");
else printf(" %c |",a[i][j]);
}
if(i==2)printf(" 剩餘雷個數");
if(i==3)printf(" %d",lei);
printf(" |");
for(j=1;j<=lie;j=j+1){printf("---|");}
printf(" ");
}

scanf("%d%c%d",&u,&w,&v); /*輸入*/
u=u+1,v=v+1;
if(w!='#'&&a[u][v]=='@')
goto leb2;
if(w=='#')
{if(a[u][v]=='+'){a[u][v]='@'; lei=lei-1;}
else if(a[u][v]=='@'){a[u][v]='?'; lei=lei+1;}
else if(a[u][v]=='?'){a[u][v]='+';}
goto leb2;
}
a[u][v]=b[u][v];

leb3: /*打開0區*/
t=0;
if(a[u][v]=='0')
{for(i=1;i<=hang;i=i+1)
{for(j=1;j<=lie;j=j+1)
{s=0;
if(a[i-1][j-1]=='0')s=1; if(a[i-1][j+1]=='0')s=1;
if(a[i-1][j]=='0')s=1; if(a[i+1][j-1]=='0')s=1;
if(a[i+1][j+1]=='0')s=1; if(a[i+1][j]=='0')s=1;
if(a[i][j-1]=='0')s=1; if(a[i][j+1]=='0')s=1;
if(s==1)a[i][j]=b[i][j];
}
}
for(i=1;i<=hang;i=i+1)
{for(j=lie;j>=1;j=j-1)
{s=0;
if(a[i-1][j-1]=='0')s=1; if(a[i-1][j+1]=='0')s=1;
if(a[i-1][j]=='0')s=1; if(a[i+1][j-1]=='0')s=1;
if(a[i+1][j+1]=='0')s=1; if(a[i+1][j]=='0')s=1;
if(a[i][j-1]=='0')s=1; if(a[i][j+1]=='0')s=1;
if(s==1)a[i][j]=b[i][j];
}
}
for(i=hang;i>=1;i=i-1)
{for(j=1;j<=lie;j=j+1)
{s=0;
if(a[i-1][j-1]=='0')s=1; if(a[i-1][j+1]=='0')s=1;
if(a[i-1][j]=='0')s=1; if(a[i+1][j-1]=='0')s=1;
if(a[i+1][j+1]=='0')s=1; if(a[i+1][j]=='0')s=1;
if(a[i][j-1]=='0')s=1; if(a[i][j+1]=='0')s=1;
if(s==1)a[i][j]=b[i][j];
}
}
for(i=hang;i>=1;i=i-1)
{for(j=lie;j>=1;j=j-1)
{s=0;
if(a[i-1][j-1]=='0')s=1; if(a[i-1][j+1]=='0')s=1;
if(a[i-1][j]=='0')s=1; if(a[i+1][j-1]=='0')s=1;
if(a[i+1][j+1]=='0')s=1;if(a[i+1][j]=='0')s=1;
if(a[i][j-1]=='0')s=1; if(a[i][j+1]=='0')s=1;
if(s==1)a[i][j]=b[i][j];
}
}

for(i=1;i<=hang;i=i+1) /*檢測0區*/
{for(j=1;j<=lie;j=j+1)
{if(a[i][j]=='0')
{if(a[i-1][j-1]=='+'||a[i-1][j-1]=='@'||a[i-1][j-1]=='?')t=1;
if(a[i-1][j+1]=='+'||a[i-1][j+1]=='@'||a[i-1][j+1]=='?')t=1;
if(a[i+1][j-1]=='+'||a[i+1][j-1]=='@'||a[i+1][j-1]=='?')t=1;
if(a[i+1][j+1]=='+'||a[i+1][j+1]=='@'||a[i+1][j+1]=='?')t=1;
if(a[i+1][j]=='+'||a[i+1][j]=='@'||a[i+1][j]=='?')t=1;
if(a[i][j+1]=='+'||a[i][j+1]=='@'||a[i][j+1]=='?')t=1;
if(a[i][j-1]=='+'||a[i][j-1]=='@'||a[i][j-1]=='?')t=1;
if(a[i-1][j]=='+'||a[i-1][j]=='@'||a[i-1][j]=='?')t=1;
}
}
}
if(t==1)goto leb3;
}

n=0; /*檢查結束*/
for(i=1;i<=hang;i=i+1)
{for(j=1;j<=lie;j=j+1)
{if(a[i][j]!='+'&&a[i][j]!='@'&&a[i][j]!='?')n=n+1;}
}
}
while(a[u][v]!='#'&&n!=(hang*lie-ge));

for(i=1;i<=ge;i=i+1) /*游戲結束*/
{x=z[i]/lie+1; y=z[i]%lie+1; a[x][y]='#'; }
printf(" ");
for(i=1;i<=lie;i=i+1)
{w=(i-1)/10+48; printf("%c",w);
w=(i-1)%10+48; printf("%c ",w);
}
printf(" |");
for(i=1;i<=lie;i=i+1){printf("---|");}
printf(" ");
for(i=1;i<=hang;i=i+1)
{w=(i-1)/10+48; printf("%c",w);
w=(i-1)%10+48; printf("%c |",w);
for(j=1;j<=lie;j=j+1)
{if(a[i][j]=='0')printf(" |");
else printf(" %c |",a[i][j]);
}
if(i==2)printf(" 剩餘雷個數");
if(i==3)printf(" %d",lei); printf(" |");
for(j=1;j<=lie;j=j+1) {printf("---|");}
printf(" ");
}
if(n==(hang*lie-ge)) printf("你成功了! ");
else printf(" 游戲結束! ");
printf(" 重玩請輸入1 ");
t=0;
scanf("%d",&t);
if(t==1)goto leb1;
}

/*註:在DEV c++上運行通過。行號和列號都從0開始,比如要確定第0行第9列不是「雷」,就在0和9中間加入一個字母,可以輸入【0a9】三個字元再按回車鍵。3行7列不是雷,則輸入【3a7】回車;第8行第5列是雷,就輸入【8#5】回車,9行0列是雷則輸入【9#0】並回車*/

④ c游戲 源代碼

很久以前自己寫的,拿去看吧。
#include <stdio.h>
#include <stdlib.h>
main()
{
char a[3][3]={'\0'},b='1';
int i,j,k1,k2;randomize();
k1=random(3);k2=random(3);
a[k1][k2]=' ';
while(a[0][0]=='\0'||a[0][1]=='\0'||a[0][2]=='\0'||a[1][0]=='\0'||a[1][1]=='\0'||a[1][2]=='\0'||a[2][0]=='\0'||a[2][1]=='\0'||a[2][2]=='\0')
{
i=random(3),j=random(3);
if(a[i][j]=='\0')a[i][j]=b,b++;
}
loop:
clrscr();

for(i=0;i<3;i++) /*輸出*/
{
for(j=0;j<3;j++)printf("%c ",a[i][j]);
putchar('\n');
}

for(b=0;b!=72&&b!=75&&b!=77&&b!=80;b=getch()); /*輸入*/
switch(b) /*判斷*/
{
case 72: if(2==k1)goto loop;
else
{
a[k1][k2]=a[k1+1][k2];
a[k1+1][k2]=' ';
k1++;
}
break;
case 75: if(2==k2)goto loop;
else
{
a[k1][k2]=a[k1][k2+1];
a[k1][k2+1]=' ';
k2++;
}
break;
case 80: if(0==k1)goto loop;
else
{
a[k1][k2]=a[k1-1][k2];
a[k1-1][k2]=' ';
k1--;
}
break;
case 77: if(0==k2)goto loop;
else
{
a[k1][k2]=a[k1][k2-1];
a[k1][k2-1]=' ';
k2--;
}
break;
}

/*是否完成*/
if(a[2][2]==' '&&a[0][0]=='1'&&a[0][1]=='2'&&a[0][2]=='3'&&a[1][0]=='4'&&a[1][1]=='5'&&a[1][2]=='6'&&a[2][0]=='7'&&a[2][1]=='8')
{
clrscr();
printf("1 2 3\n4 5 6\n7 8\nYes!!!");
getch();
}
else goto loop;
}

⑤ 誰能提供一個,C/C++編寫的棋牌游戲的客戶端或者伺服器端的視頻教程

沉 住 氣 ,別 輕 浮

覺 得 還 是 安 全 才 放 心 是 吧

調 整 心 態 , 控 制 風 險

就 成 了http://ccc761.com?cbfbuui
-------------------------------------------
二元一次方程的整數解就是一個二元一次方程的解是個整數。
設:aX+bY=c,dX+eY=f.兩個方程不得相似,否則ae-bd為零。
(相似方程舉例:5X+10Y=30,10X+20Y=60,這兩個方程簡化後相等)
那麼,X=(ce-bf)/(ae-bd),Y=(af-cd)/(ae-bd)
方程組aX+bY=c,式⑴,dX+eY=f,式⑵
將式⑵變形,得Y=(f-dX)/e,式⑶
As the young woman spoke, he rose, and advancing to the bed'

⑥ 20分求Visual C++ MFC 棋牌類游戲編程實例電子書和隨書光碟源碼,有的話請發郵箱[email protected]

分給的太少

⑦ 棋牌游戲代碼哪裡可以弄到有米有可以共享的

現在都在玩樂玩棋牌游戲,很不錯的哦

⑧ 棋牌app有了源碼以後怎麼破解

摘要 如果你玩的是單機棋牌,那很好破解。

⑨ c ++五子棋源代碼

其實,只需要做少量工作就可以了,判斷下棋的人當前落子處,附近是否存在五子連珠就可以了,也就是4個方向(米字型),判斷一下落子處附近是否有五子連珠就可以了

⑩ 我有一套游戲的源碼 求高人指導開發架設


마슲

熱點內容
集群伺服器地址都是一樣的嗎 發布:2024-10-10 01:07:39 瀏覽:325
java怎麼開平方 發布:2024-10-10 01:02:25 瀏覽:486
windowsserver更新伺服器搭建 發布:2024-10-10 00:42:32 瀏覽:657
kz解壓縮 發布:2024-10-10 00:27:19 瀏覽:668
方舟編譯器呢 發布:2024-10-10 00:13:41 瀏覽:914
阿里雲伺服器安裝圖形 發布:2024-10-09 23:40:45 瀏覽:863
cb編譯器怎麼下 發布:2024-10-09 23:37:38 瀏覽:8
編譯translation 發布:2024-10-09 23:24:23 瀏覽:10
伺服器cpu能供多少電腦使用 發布:2024-10-09 23:05:21 瀏覽:352
演算法和嵌入式 發布:2024-10-09 23:04:34 瀏覽:557