C语言中的俄罗斯方块 C语言中俄罗斯方块怎么做

C\u8bed\u8a00\u4e2d\u7684\u4fc4\u7f57\u65af\u65b9\u5757

\u671b\u91c7\u7eb3\uff01\uff01
\uff03i nclude <stdio.h>
\uff03i nclude <dos.h>
\uff03i nclude <conio.h>
\uff03i nclude <graphics.h>
\uff03i nclude <stdlib.h>

#ifdef __cplusplus
#define __CPPARGS ...
#else
#define __CPPARGS
#endif
#define MINBOXSIZE 15 /* \u6700\u5c0f\u65b9\u5757\u7684\u5c3a\u5bf8 */
#define BGCOLOR 7 /* \u80cc\u666f\u7740\u8272 */
#define GX 200
#define GY 10
#define SJNUM 10000 /* \u6bcf\u5f53\u73a9\u5bb6\u6253\u5230\u4e00\u4e07\u5206\u7b49\u7ea7\u52a0\u4e00\u7ea7*/

/* \u6309\u952e\u7801*/
#define VK_LEFT 0x4b00
#define VK_RIGHT 0x4d00
#define VK_DOWN 0x5000
#define VK_UP 0x4800
#define VK_HOME 0x4700
#define VK_END 0x4f00
#define VK_SPACE 0x3920
#define VK_ESC 0x011b
#define VK_ENTER 0x1c0d

/* \u5b9a\u4e49\u4fc4\u7f57\u65af\u65b9\u5757\u7684\u65b9\u5411\uff08\u6211\u5b9a\u4e49\u4ed6\u4e3a4\u79cd\uff09*/
#define F_DONG 0
#define F_NAN 1
#define F_XI 2
#define F_BEI 3

#define NEXTCOL 20 /* \u8981\u51fa\u7684\u4e0b\u4e00\u4e2a\u65b9\u5757\u7684\u7eb5\u5750\u6807*/
#define NEXTROW 12 /* \u8981\u51fa\u7684\u4e0b\u4e00\u4e2a\u65b9\u5757\u7684\u6a2a\u4ece\u6807*/
#define MAXROW 14 /* \u6e38\u620f\u5c4f\u5e55\u5927\u5c0f*/
#define MAXCOL 20
#define SCCOL 100 /*\u6e38\u620f\u5c4f\u5e55\u5927\u663e\u793a\u5668\u4e0a\u7684\u76f8\u5bf9\u4f4d\u7f6e*/
#define SCROW 60



int gril[22][16]; /* \u6e38\u620f\u5c4f\u5e55\u5750\u6807*/
int col=1,row=7; /* \u5f53\u524d\u65b9\u5757\u7684\u6a2a\u7eb5\u5750\u6807*/
int boxfx=0,boxgs=0; /* \u5f53\u524d\u5bfa\u5757\u7684\u5f62\u58ee\u548c\u65b9\u5411*/
int nextboxfx=0,nextboxgs=0,maxcol=22;/*\u4e0b\u4e00\u4e2a\u65b9\u5757\u7684\u5f62\u58ee\u548c\u65b9\u5411*/
int minboxcolor=6,nextminboxcolor=6;
int num=0; /*\u6e38\u620f\u5206*/
int dj=0,gamedj[10]={18,16,14,12,10,8,6,4,2,1};/* \u6e38\u620f\u7b49\u7ea7*/
/* \u4ee5\u4e0b\u6211\u7528\u4e86\u4e00\u4e2a3\u7ef4\u6570\u7ec4\u6765\u7eaa\u5f55\u65b9\u5757\u7684\u6700\u521d\u5f62\u72b6\u548c\u65b9\u5411*/
int boxstr[7][4][16]={{
{1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0},
{0,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0},
{1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0},
{0,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0}},
{
{0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0},
{1,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0},
{0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0},
{1,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0}},
{
{1,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0},
{1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0},
{1,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0},
{0,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0}},
{
{1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0},
{1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0},
{0,1,0,0,0,1,0,0,1,1,0,0,0,0,0,0},
{1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0}},
{
{0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0},
{0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0},
{0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0},
{0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0}},
{
{1,1,0,0,1,1,0,0,0,0,0,0.0,0,0,0},
{1,1,0,0,1,1,0,0,0,0,0,0.0,0,0,0},
{1,1,0,0,1,1,0,0,0,0,0,0.0,0,0,0},
{1,1,0,0,1,1,0,0,0,0,0,0.0,0,0,0}},
{
{0,0,0,0,1,1,1,0,0,1,0,0,0,0,0,0},
{1,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0},
{0,1,0,0,1,1,1,0,0,0,0,0.0,0,0,0},
{0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0}}

};

/* \u968f\u673a\u5f97\u5230\u5f53\u524d\u65b9\u5757\u548c\u4e0b\u4e00\u4e2a\u65b9\u5757\u7684\u5f62\u72b6\u548c\u65b9\u5411*/
void boxrad(){
minboxcolor=nextminboxcolor;
boxgs=nextboxgs;
boxfx=nextboxfx;
nextminboxcolor=random(14)+1;
if(nextminboxcolor==4||nextminboxcolor==7||nextminboxcolor==8)
nextminboxcolor=9;
nextboxfx=F_DONG;
nextboxgs=random(7);
}
/*\u521d\u59cb\u5316\u56fe\u5f62\u6a21\u8bd5*/
void init(int gdrive,int gmode){
int errorcode;
initgraph(&gdrive,&gmode,"e:\tc");
errorcode=graphresult();
if(errorcode!=grOk){
printf("error of: %s",grapherrormsg(errorcode));
exit(1);
}
}

/* \u5728\u56fe\u5f62\u6a21\u5f0f\u4e0b\u7684\u6e05\u5c4f */
void cls()
{
setfillstyle(SOLID_FILL,0);
setcolor(0);
bar(0,0,640,480);
}
/*\u5728\u56fe\u5f62\u6a21\u5f0f\u4e0b\u7684\u9ad8\u7ea7\u6e05\u5c4f*/
void clscr(int a,int b,int c,int d,int color){
setfillstyle(SOLID_FILL,color);
setcolor(color);
bar(a,b,c,d);
}
/*\u6700\u5c0f\u65b9\u5757\u7684\u7ed8\u5236*/
void minbox(int asc,int bsc,int color,int bdcolor){
int a=0,b=0;
a=SCCOL+asc;
b=SCROW+bsc;
clscr(a+1,b+1,a-1+MINBOXSIZE,b-1+MINBOXSIZE,color);
if(color!=BGCOLOR){
setcolor(bdcolor);
line(a+1,b+1,a-1+MINBOXSIZE,b+1);
line(a+1,b+1,a+1,b-1+MINBOXSIZE);
line(a-1+MINBOXSIZE,b+1,a-1+MINBOXSIZE,b-1+MINBOXSIZE);
line(a+1,b-1+MINBOXSIZE,a-1+MINBOXSIZE,b-1+MINBOXSIZE);
}
}

/*\u6e38\u620f\u4e2d\u51fa\u73b0\u7684\u6587\u5b57*/
void txt(int a,int b,char *txt,int font,int color){
setcolor(color);
settextstyle(0,0,font);
outtextxy(a,b,txt);
}
/*windows \u7ed8\u5236*/
void win(int a,int b,int c,int d,int bgcolor,int bordercolor){
clscr(a,b,c,d,bgcolor);
setcolor(bordercolor);
line(a,b,c,b);
line(a,b,a,d);
line(a,d,c,d);
line(c,b,c,d);

}

/* \u5f53\u524d\u65b9\u5757\u7684\u7ed8\u5236*/
void funbox(int a,int b,int color,int bdcolor){
int i,j;
int boxz[4][4];
for(i=0;i<16;i++)
boxz[i/4][i%4]=boxstr[boxgs][boxfx][i];
for(i=0;i<4;i++)
for(j=0;j<4;j++)
if(boxz[i][j]==1)
minbox((j+row+a)*MINBOXSIZE,(i+col+b)*MINBOXSIZE,color,bdcolor);
}
/*\u4e0b\u4e00\u4e2a\u65b9\u5757\u7684\u7ed8\u5236*/
void nextfunbox(int a,int b,int color,int bdcolor){
int i,j;
int boxz[4][4];
for(i=0;i<16;i++)
boxz[i/4][i%4]=boxstr[nextboxgs][nextboxfx][i];
for(i=0;i<4;i++)
for(j=0;j<4;j++)
if(boxz[i][j]==1)
minbox((j+a)*MINBOXSIZE,(i+b)*MINBOXSIZE,color,bdcolor);
}
/*\u65f6\u95f4\u4e2d\u65ad\u5b9a\u4e49*/
#define TIMER 0x1c
int TimerCounter=0;
void interrupt ( *oldhandler)(__CPPARGS);
void interrupt newhandler(__CPPARGS){
TimerCounter++;
oldhandler();
}
void SetTimer(void interrupt (*IntProc)(__CPPARGS)){
oldhandler=getvect(TIMER);
disable();
setvect(TIMER,IntProc);
enable();
}
/*\u7531\u4e8e\u6e38\u620f\u7684\u89c4\u5219\uff0c\u6d88\u6389\u90fd\u6709\u6700\u5c0f\u65b9\u5757\u7684\u4e00\u884c*/
void delcol(int a){
int i,j;
for(i=a;i>1;i--)
for(j=1;j<15;j++){
minbox(j*MINBOXSIZE,i*MINBOXSIZE,BGCOLOR,BGCOLOR);
gril[i][j]=gril[i-1][j];
if(gril[i][j]==1)
minbox(j*MINBOXSIZE,i*MINBOXSIZE,minboxcolor,0);
}
}

/*\u6d88\u6389\u6240\u6709\u90fd\u6709\u6700\u5c0f\u65b9\u5757\u7684\u884c*/
void delete(){
int i,j,zero,delgx=0;
char *nm="00000";
for(i=1;i<21;i++){
zero=0;
for(j=1;j<15;j++)
if(gril[i][j]==0)
zero=1;
if(zero==0){
delcol(i);
delgx++;
}
}
num=num+delgx*delgx*10;
dj=num/10000;

sprintf(nm,"%d",num);
clscr(456,173,500,200,4);
txt(456,173,"Number:",1,15);
txt(456,193,nm,1,15);
}
/*\u65f6\u95f4\u4e2d\u65ad\u7ed3\u675f*/
void KillTimer(){
disable();
setvect(TIMER,oldhandler);
enable();
}
/* \u6d4b\u8bd5\u5f53\u524d\u65b9\u5757\u662f\u5426\u53ef\u4ee5\u5411\u4e0b\u843d*/
int downok(){
int i,j,k=1,a[4][4];
for(i=0;i<16;i++)
a[i/4][i%4]=boxstr[boxgs][boxfx][i];
for(i=0;i<4;i++)
for(j=0;j<4;j++)
if(a[i][j] && gril[col+i+1][row+j])
k=0;
return(k);
}
/* \u6d4b\u8bd5\u5f53\u524d\u65b9\u5757\u662f\u5426\u53ef\u4ee5\u5411\u5de6\u884c*/
int leftok(){
int i,j,k=1,a[4][4];
for(i=0;i<16;i++)
a[i/4][i%4]=boxstr[boxgs][boxfx][i];
for(i=0;i<4;i++)
for(j=0;j<4;j++)
if(a[i][j] && gril[col+i][row+j-1])
k=0;
return(k);
}
/* \u6d4b\u8bd5\u5f53\u524d\u65b9\u5757\u662f\u5426\u53ef\u4ee5\u5411\u53f3\u884c*/
int rightok(){
int i,j,k=1,a[4][4];
for(i=0;i<16;i++)
a[i/4][i%4]=boxstr[boxgs][boxfx][i];
for(i=0;i<4;i++)
for(j=0;j<4;j++)
if(a[i][j] && gril[col+i][row+j+1])
k=0;
return(k);
}
/* \u6d4b\u8bd5\u5f53\u524d\u65b9\u5757\u662f\u5426\u53ef\u4ee5\u53d8\u5f62*/
int upok(){
int i,j,k=1,a[4][4];
for(i=0;i<4;i++)
for(i=0;i<16;i++)
a[i/4][i%4]=boxstr[boxgs][boxfx+1][i];
for(i=3;i>=0;i--)
for(j=3;j>=0;j--)
if(a[i][j] && gril[col+i][row+j])
k=0;
return(k);
}
/*\u5f53\u524d\u65b9\u5757\u843d\u4e0b\u4e4b\u540e\uff0c\u7ed9\u5c4f\u5e55\u5750\u6807\u4f5c\u6807\u8bb0*/
void setgril(){
int i,j,a[4][4];
funbox(0,0,minboxcolor,0);
for(i=0;i<16;i++)
a[i/4][i%4]=boxstr[boxgs][boxfx][i];
for(i=0;i<4;i++)
for(j=0;j<4;j++)
if(a[i][j])
gril[col+i][row+j]=1;
col=1;row=7;
}
/*\u6e38\u620f\u7ed3\u675f*/
void gameover(){
int i,j;

for(i=20;i>0;i--)
for(j=1;j<15;j++)
minbox(j*MINBOXSIZE,i*MINBOXSIZE,2,0);
txt(103,203,"Game Over",3,10);
}
/*\u6309\u952e\u7684\u8bbe\u7f6e*/
void call_key(int keyx){
switch(keyx){
case VK_DOWN: { /*\u4e0b\u65b9\u5411\u952e\uff0c\u6a2a\u5750\u6807\u52a0\u4e00\u3002*/
if(downok()){
col++;
funbox(0,0,minboxcolor,0);}
else{
funbox(0,0,minboxcolor,0);
setgril();
nextfunbox(NEXTCOL,NEXTROW,4,4);
boxrad();
nextfunbox(NEXTCOL,NEXTROW,nextminboxcolor,0);
delete();
}
break;
}
case VK_UP: { /*\u4e0a\u65b9\u5411\u952e\uff0c\u65b9\u5411\u5f62\u72b6\u65cb\u8f6c90\u5ea6*/
if(upok())
boxfx++;
if(boxfx>3)
boxfx=0;
funbox(0,0,minboxcolor,0);
break;
}
case VK_LEFT:{ /*\u5de6\u65b9\u5411\u952e\uff0c\u7eb5\u5750\u6807\u51cf\u4e00*/
if(leftok())
row--;
funbox(0,0,minboxcolor,0);
break;
}
case VK_RIGHT:{ /*\u53f3\u65b9\u5411\u952e\uff0c\u7eb5\u5750\u6807\u52a0\u4e00*/
if(rightok())
row++;
funbox(0,0,minboxcolor,0);
break;
}
case VK_SPACE: /*\u7a7a\u683c\u952e\uff0c\u76f4\u63a5\u843d\u5230\u6700\u540e\u53ef\u4ee5\u843d\u5230\u7684\u4eec\u7f6e*/
while(downok())
col++;
funbox(0,0,minboxcolor,0);
setgril();
nextfunbox(NEXTCOL,NEXTROW,4,4);
boxrad();
nextfunbox(NEXTCOL,NEXTROW,nextminboxcolor,0);
delete();
break;
default:
{
txt(423,53,"worng key!",1,4);
txt(428,80,"Plese Enter Anly Key AG!",1,4);
getch();
clscr(420,50,622,97,BGCOLOR);
}
}
}

/*\u65f6\u95f4\u4e2d\u65ad\u5f00\u59cb*/
void timezd(void){
int key;
SetTimer(newhandler);
boxrad();
nextfunbox(NEXTCOL,NEXTROW,nextminboxcolor,0);
for(;;){
if(bioskey(1)){
key=bioskey(0);
funbox(0,0,BGCOLOR,BGCOLOR);
if(key==VK_ESC)
break;
call_key(key);
}
if(TimerCounter>gamedj[dj]){
TimerCounter=0;
if(downok()){
funbox(0,0,BGCOLOR,BGCOLOR);
col++;
funbox(0,0,minboxcolor,0);
}
else {
if(col==1){
gameover();
getch();
break;
}
setgril();
delete();
funbox(0,0,minboxcolor,0);
col=1;row=7;
funbox(0,0,BGCOLOR,BGCOLOR);
nextfunbox(NEXTCOL,NEXTROW,4,4);
boxrad();
nextfunbox(NEXTCOL,NEXTROW,nextminboxcolor,0);
}
}
}
}

/*\u4e3b\u7a0b\u5e8f\u5f00\u59cb*/
void main(void){
int i,j;
char *nm="00000";
init(VGA,VGAHI);
cls();
/*\u5c4f\u5e55\u5750\u6807\u521d\u59cb\u5316*/
for(i=0;i<=MAXCOL+1;i++)
for(j=0;j<=MAXROW+1;j++)
gril[i][j]=0;
for(i=0;i<=MAXCOL+1;i++) {
gril[i][0]=1;
gril[i][15]=1;
}
for(j=1;j<=MAXROW;j++){
gril[0][j]=1;
gril[21][j]=1;
}
clscr(0,0,640,480,15);
win(1,1,639,479,4,15);
win(SCCOL+MINBOXSIZE-2,SCROW+MINBOXSIZE-2,SCCOL+15*MINBOXSIZE+2,SCROW+21*MINBOXSIZE+2,BGCOLOR,0);
nextboxgs=random(8);
nextboxfx=random(4);
sprintf(nm,"%d",num);
txt(456,173,"Number:",1,15);
txt(456,193,nm,1,15);
txt(456,243,"Next Box:",1,15);
timezd();
KillTimer();
closegraph();
}

\u5f53\u65f6\u505a\u5f97\u65f6\u5019\u5de5\u5177\u7528turboC 2.0\u5f00\u53d1\u7684\uff0c\u8bfe\u7a0b\u8bbe\u8ba1.
\u5177\u4f53\u7684\u4ee3\u7801\u7f51\u4e0a\u53ef\u4ee5\u641c\u5230\u5f88\u591a\uff0c\u6211\u5c31\u4e0d\u7ec6\u8bf4\u4e86.
\u5f53\u65f6\u7f16\u7801\u7684\u65f6\u5019\uff0c\u901a\u5e38\u628a\u4fc4\u7f57\u65af\u65b9\u5757\u7684\u7f16\u7801\u5de5\u4f5c\u5206\u6210\u51e0\u4e2a\u5c0f\u5757\u5b8c\u6210\uff0c\u6211\u63cf\u8ff0\u4e00\u4e0b\uff1a
1. \u5f53\u524d\u4e0b\u843d\u5757\u7684\u63a7\u5236\u903b\u8f91.
2. \u7528\u6237\u8f93\u5165\u7684\u63a7\u5236\u903b\u8f91\uff0c\u8fd9\u4e2a\u662f\u7528\u4e2d\u65ad\u63a7\u5236\uff0c\u6bd4\u5982bioskey()\u51fd\u6570\u53bb\u83b7\u53d6\u5f53\u524d\u7684\u8f93\u5165\u503c\uff0c\u5177\u4f53\u7684\u6211\u8bb0\u4e0d\u6e05\u4e86.
3. \u5224\u65ad\u4e00\u884c\u662f\u5426\u80fd\u591f\u6d88\u53bb\u903b\u8f91(\u516c\u5171\u73af\u5883\u662f\u752820*12\u7684\u6570\u7ec4\u6765\u5b58\u653e.)
4. \u96be\u5ea6\u4ee5\u53ca\u5176\u4ed6\u914d\u7f6e\u6a21\u5757\u7ba1\u7406\uff0c\u6a21\u5757\u5212\u5206\u6e05\u695a\u4e4b\u540e\uff0c\u7f16\u7801\u8f83\u4e3a\u5bb9\u6613.
\u5e0c\u671b\u53ef\u4ee5\u6709\u5e2e\u52a9: )

我给你,我有源代码,可以运行
/*************************
<Russia Diamonds Ver 1.0>
Copyright by forever_chang
[email protected]
2001.11.1
*************************/
/*****************************************************************************************/
#include "graphics.h" /*头文件*/
#include "time.h"
#include "stdlib.h"
#include "bios.h"
#include "dos.h"
#include "stdio.h"
#define ESC 0x11b /*键盘扫描码*/
#define UP 0x4800
#define DOWN 0x5000
#define LEFT 0x4b00
#define F1 0x3b00
#define RIGHT 0x4d00
#define YES 0x1579
#define NO 0x316e
#define RESTART 0x1372
/*****************************************************************************************/
struct diamond /*记录每种方块每种状态的信息*/
{
int x[4];
int y[4];
int start_x;
int start_y;
int color;
struct diamond *next;
};
int grid[12][23]; /*记录所有格子的状态 (0)没有方块 (1)有固定方块 (2)有活动方块*/
int x; /*活动方块所在位置*/
int y;
int level; /*游戏难度*/
int count; /*计数器*/
int score;/*得分*/
struct diamond *nowinfo; /*当前活动方块*/
struct diamond *nextinfo; /*下一个方块*/
int color;/*画格子的颜色*/
int backcolor;/*游戏区域背景色*/
/*****************************************************************************************/
void show_interface (int mode);/*显示游戏界面*/
void show_copsign (int topx,int topy,int size,int color);/*显示公司标志--恒基伟业*/
void show_intro (int xs,int ys);/*显示软件介绍区*/
/*void print(); 测试用函数*/
void scandel();/*扫描所有格子看是否有可消除行*/
void show_down ();/*方块下落后的下一个状态*/
void show_next ();/*方块翻转后的下一个状态*/
void show_left ();/*方块向左移动后的下一个状态*/
void show_right ();/*方块向右移动后的下一个状态*/
void interrupt (*oldtimer)();/*指向未安装前的中断向量,即函数指针,指向一段可执行的代码*/
void install();/*安装新的中断向量,即将中断服务程序安装到中断向量表中*/
void interrupt newtimer();/*中断服务程序*/
struct diamond *get_diamond();/*随机得到一个方块*/
struct diamond *create_I();/*函数用来构造各种类形方块的环形链表*/
struct diamond *create_T();/*返回链表中随机一个状态的指针*/
struct diamond *create_L();
struct diamond *create_J();
struct diamond *create_Z();
struct diamond *create_N();
struct diamond *create_H();
void delinfo (struct diamond *info);/*释放当前方块所占用的空间*/
void addtobuffer(int c);/*向键盘缓冲区中增加一个DOWN*/
/*void clrkey();调用dos中断清空键盘缓冲区,未使用此方法.*/
void showsubwin(struct diamond *next);/*在小窗口显示下一个方块*/
void showscore(int scoreget);/*显示分数*/
void startset();/*初始化游戏*/
/*****************************************************************************************/
main ()
{
int driver=VGA;
int mode=VGAHI;
int i;/*计数器*/
int j;
int key;/*记录键盘扫描码*/
initgraph (&driver,&mode,"");/*初始化*/
color=8;
backcolor=7;
level=1;
score=298;
count=0;
show_interface (9);/*显示界面*/
setfillstyle(SOLID_FILL,1);
bar(0,465,640,480);
outtextxy(5,469,"Press any key to start...");
getch();
setfillstyle(SOLID_FILL,9);
bar(0,465,640,480);
showscore(0);/*显示分数*/
randomize();
nowinfo=get_diamond ();/*得到一个当前方块*/
oldtimer=getvect(0x1c);
install(newtimer);
for(i=0;i<=21;i++)/*初始化grid[12][23]*/
{
for(j=1;j<=10;j++)
grid[j][i]=0;
}
for(i=0;i<=22;i++)
{
grid[0][i]=1;
grid[11][i]=1;
}
for(i=0;i<=11;i++)
{
grid[i][22]=1;
}

x=nowinfo->start_x;/*初始化方块位置*/
y=nowinfo->start_y;
nextinfo=get_diamond ();/*得到下一个方块*/
showsubwin(nextinfo);

for (;
{
key=bioskey(0);/*得到键盘扫描码*/
if (key)
{
switch(key)
{

case DOWN:{
show_down ();
break;
}
case UP:{
show_next ();
break;
}
case LEFT:{
show_left();
break;
}
case RIGHT:{
show_right();
break;
}
case RESTART:{
install(oldtimer);
setfillstyle(SOLID_FILL,1);
bar(0,465,640,480);
outtextxy(5,469,"Are you sure to restart (Y/N)...");
for (;
{
key=bioskey(0);/*得到键盘扫描码*/
if (key==YES)
{
startset();
setfillstyle(SOLID_FILL,9);
bar(0,465,640,480);
break;
}
if (key==NO)
{
setfillstyle(SOLID_FILL,9);
bar(0,465,640,480);
install(newtimer);
break;
}
}
break;
}
/* case F1:{
print();
break;
}
*/
case ESC:{
install(oldtimer);
setfillstyle(SOLID_FILL,1);
bar(0,465,640,480);
outtextxy(5,469,"Are you sure to exit (Y/N)...");
for (;
{
key=bioskey(0);/*得到键盘扫描码*/
if (key==YES)
{
closegraph();
exit(0);
}
if (key==NO)
{
setfillstyle(SOLID_FILL,9);
bar(0,465,640,480);
install(newtimer);
break;
}
}

}
}
}
}
}
/*****************************************************************************************/
struct diamond *get_diamond()
{
struct diamond *now;
switch (random(7)+1)
{
case 1:{
now=create_I();
return now;
}
case 2:{
now=create_T();
return now;
}
case 3:{
now=create_L();
return now;
}
case 4:{
now=create_J();
return now;
}
case 5:{
now=create_Z();
return now;
}
case 6:{
now=create_N();
return now;
}
case 7:{
now=create_H();
return now;
}
}
}
/*****************************************************************************************/
void show_interface (int fill_mode)
{
int i;
setbkcolor (9);
setcolor (color);
setfillstyle (SOLID_FILL,backcolor);
bar (100,60,300,420);
bar (360,60,440,140);
rectangle (100,60,300,420);
rectangle (96,56,304,424);

rectangle (360,60,440,140);
rectangle (356,56,444,144);
setfillstyle (fill_mode,14);
floodfill (97,57,color);
floodfill (397,57,color);
setcolor(1);
rectangle(96,56,304,424);
setcolor (color);
for (i=80;i<=400;i+=20)
{
line (100,i,300,i);
}
for (i=120;i<=280;i+=20)
{
line (i,60,i,420);
}
for (i=80;i<=120;i+=20)
{
line (360,i,440,i);
}
for (i=380;i<=420;i+=20)
{
line (i,60,i,140);
}
show_intro (360,180);
show_copsign (475,320,40,1);
setfillstyle(SOLID_FILL,1);
setcolor(14);
rectangle(420,405,534,417);
floodfill (421,406,14);
outtextxy(422,408,"HI-TECH WEALTH");
}
/*****************************************************************************************/
void show_copsign (int topx,int topy,int size,int color)
{
int halfsize,qtrsize;
int xadd,xdel,yadd1,yadd2;
halfsize=0.5*size;
qtrsize=0.25*size;

xadd=topx+size;
xdel=topx-size;
yadd1=topy+size;
yadd2=topy+2*size;

setcolor(color);
line (topx,topy,xdel,yadd1);
line (xdel,yadd1,topx,yadd2);
line (topx,yadd2,xadd,yadd1);
line (xadd,yadd1,topx,topy);
rectangle (topx-halfsize,topy+halfsize,topx+halfsize,yadd1+halfsize);
setfillstyle (SOLID_FILL,color);
floodfill (topx,topy+1,color);
floodfill (xdel+1,yadd1,color);
floodfill (topx,yadd2-1,color);
floodfill (xadd-1,yadd1,color);
rectangle (topx-halfsize,yadd1-qtrsize,topx-0.75*halfsize,yadd1+qtrsize);
floodfill (topx-halfsize+1,yadd1-qtrsize+1,color);
rectangle (topx-qtrsize,yadd1-halfsize,topx+qtrsize,yadd1-0.25*halfsize);
floodfill (topx-qtrsize+1,yadd1-halfsize+1,color);
rectangle (topx+0.75*halfsize,yadd1-qtrsize,topx+halfsize,yadd1+qtrsize);
floodfill (topx+0.75*halfsize+1,yadd1-qtrsize+1,color);
rectangle (topx-qtrsize,yadd1+0.25*halfsize,topx+qtrsize,yadd2-halfsize);
floodfill (topx-qtrsize+1,yadd1+0.25*halfsize+1,color);
setcolor(14);
line (topx,topy-1,xdel-1,yadd1);
line (xdel-1,yadd1,topx,yadd2+1);
line (topx,yadd2+1,xadd+1,yadd1);
line (xadd+1,yadd1,topx,topy-1);
setfillstyle (SOLID_FILL,14);
floodfill (topx,yadd1,color);
}
/*****************************************************************************************/
void show_intro (int xs,int ys)
{
char stemp[20];
setcolor (15);
rectangle(xs-3,ys-3,xs+239,ys+115);
line (xs-3,ys+26,xs+239,ys+26);
line (xs-3,ys+72,xs+239,ys+72);
outtextxy(xs,ys,"Level:");
outtextxy(xs,ys+15,"Score:");
sprintf(stemp," -Roll -Downwards");
stemp[0]=24;
stemp[7]=25;
outtextxy(xs,ys+30,"Help:");
setcolor(14);
outtextxy(xs+40,ys+30,stemp);
outtextxy(xs+40,ys+45,"<-Turn Left >-Turn Right");
outtextxy(xs+40,ys+60,"Esc-Exit R-Restart");
outtextxy(xs,ys+75,"Russia Diamonds Ver 1.0");
outtextxy(xs,ys+90,"CopyRight By ChangYong.01-11-1");
outtextxy(xs,ys+105,"Email:[email protected]");
}
/*****************************************************************************************/
struct diamond *create_I()
{
struct diamond *info;
struct diamond *first;
first=(struct diamond *)malloc(sizeof(struct diamond));
info=(struct diamond *)malloc(sizeof(struct diamond));
first->next=info;
info->next=first;
first->x[0]=0;
first->y[0]=0;
first->x[1]=-1;
first->y[1]=0;
first->x[2]=1;
first->y[2]=0;
first->x[3]=2;
first->y[3]=0;
first->start_x=5;
first->start_y=3;
first->color=2;

info->x[0]=0;
info->y[0]=0;
info->x[1]=0;
info->y[1]=-1;
info->x[2]=0;
info->y[2]=1;
info->x[3]=0;
info->y[3]=2;
info->start_x=5;
info->start_y=1;
info->color=2;

if(random(2)==0) {return first;}
else {return first->next;}
}
/*****************************************************************************************/
struct diamond *create_T()
{
struct diamond *info;
struct diamond *first;
struct diamond *last;
int i;

info=(struct diamond *)malloc(sizeof(struct diamond));
info->x[0]=0;
info->y[0]=0;
info->x[1]=-1;
info->y[1]=0;
info->x[2]=0;
info->y[2]=-1;
info->x[3]=1;
info->y[3]=0;
info->start_x=5;
info->start_y=3;
info->color=4;
first=info;
last=info;

info=(struct diamond *)malloc(sizeof(struct diamond));
info->x[0]=0;
info->y[0]=0;
info->x[1]=0;
info->y[1]=1;
info->x[2]=0;
info->y[2]=-1;
info->x[3]=1;
info->y[3]=0;
info->start_x=5;
info->start_y=2;
info->color=4;
last->next=info;
last=info;

info=(struct diamond *)malloc(sizeof(struct diamond));
info->x[0]=0;
info->y[0]=0;
info->x[1]=-1;
info->y[1]=0;
info->x[2]=1;
info->y[2]=0;
info->x[3]=0;
info->y[3]=1;
info->start_x=5;
info->start_y=2;
info->color=4;
last->next=info;
last=info;

info=(struct diamond *)malloc(sizeof(struct diamond));
info->x[0]=0;
info->y[0]=0;
info->x[1]=0;
info->y[1]=1;
info->x[2]=0;
info->y[2]=-1;
info->x[3]=-1;
info->y[3]=0;
info->start_x=5;
info->start_y=2;
info->color=4;
last->next=info;
last=info;
last->next=first;

for (i=0;i<=random(4);i++)
{
first=first->next;
}
return first;
}
/*****************************************************************************************/
struct diamond *create_L()
{
struct diamond *info;
struct diamond *first;
struct diamond *last;
int i;

info=(struct diamond *)malloc(sizeof(struct diamond));
info->x[0]=0;
info->y[0]=0;
info->x[1]=0;
info->y[1]=1;
info->x[2]=0;
info->y[2]=-1;
info->x[3]=1;
info->y[3]=1;
info->start_x=5;
info->start_y=2;
info->color=5;
first=info;
last=info;

info=(struct diamond *)malloc(sizeof(struct diamond));
info->x[0]=0;
info->y[0]=0;
info->x[1]=-1;
info->y[1]=0;
info->x[2]=1;
info->y[2]=0;
info->x[3]=-1;
info->y[3]=1;
info->start_x=5;
info->start_y=2;
info->color=5;
last->next=info;
last=info;

info=(struct diamond *)malloc(sizeof(struct diamond));
info->x[0]=0;
info->y[0]=0;
info->x[1]=0;
info->y[1]=1;
info->x[2]=0;
info->y[2]=-1;
info->x[3]=-1;
info->y[3]=-1;
info->start_x=5;
info->start_y=2;
info->color=5;
last->next=info;
last=info;

info=(struct diamond *)malloc(sizeof(struct diamond));
info->x[0]=0;
info->y[0]=0;
info->x[1]=-1;
info->y[1]=0;
info->x[2]=1;
info->y[2]=0;
info->x[3]=1;
info->y[3]=-1;
info->start_x=5;
info->start_y=2;
info->color=5;
last->next=info;
last=info;
last->next=first;

for (i=0;i<=random(4);i++)
{
first=first->next;
}
return first;
}
/*****************************************************************************************/
struct diamond *create_J()
{
struct diamond *info;
struct diamond *first;
struct diamond *last;
int i;

info=(struct diamond *)malloc(sizeof(struct diamond));
info->x[0]=0;
info->y[0]=0;
info->x[1]=0;
info->y[1]=1;
info->x[2]=0;
info->y[2]=-1;
info->x[3]=-1;
info->y[3]=1;
info->start_x=5;
info->start_y=2;
info->color=6;
first=info;
last=info;

info=(struct diamond *)malloc(sizeof(struct diamond));
info->x[0]=0;
info->y[0]=0;
info->x[1]=-1;
info->y[1]=0;
info->x[2]=1;
info->y[2]=0;
info->x[3]=-1;
info->y[3]=-1;
info->start_x=5;
info->start_y=2;
info->color=6;
last->next=info;
last=info;

info=(struct diamond *)malloc(sizeof(struct diamond));
info->x[0]=0;
info->y[0]=0;
info->x[1]=0;
info->y[1]=1;
info->x[2]=0;
info->y[2]=-1;
info->x[3]=1;
info->y[3]=-1;
info->start_x=5;
info->start_y=2;
info->color=6;
last->next=info;
last=info;

info=(struct diamond *)malloc(sizeof(struct diamond));
info->x[0]=0;
info->y[0]=0;
info->x[1]=-1;
info->y[1]=0;
info->x[2]=1;
info->y[2]=0;
info->x[3]=1;
info->y[3]=1;
info->start_x=5;
info->start_y=2;
info->color=6;
last->next=info;
last=info;
last->next=first;

for (i=0;i<=random(4);i++)
{
first=first->next;
}
return first;
}
/*****************************************************************************************/
struct diamond *create_Z()
{
struct diamond *info;
struct diamond *first;
first=(struct diamond *)malloc(sizeof(struct diamond));
info=(struct diamond *)malloc(sizeof(struct diamond));
first->next=info;
info->next=first;
first->x[0]=0;
first->y[0]=0;
first->x[1]=-1;
first->y[1]=0;
first->x[2]=0;
first->y[2]=1;
first->x[3]=1;
first->y[3]=1;
first->start_x=5;
first->start_y=2;
first->color=9;

info->x[0]=0;
info->y[0]=0;
info->x[1]=0;
info->y[1]=1;
info->x[2]=1;
info->y[2]=0;
info->x[3]=1;
info->y[3]=-1;
info->start_x=5;
info->start_y=2;
info->color=9;

if(random(2)==0) {return first;}
else {return first->next;}
}
/*****************************************************************************************/
struct diamond *create_N()
{
struct diamond *info;
struct diamond *first;
first=(struct diamond *)malloc(sizeof(struct diamond));
info=(struct diamond *)malloc(sizeof(struct diamond));
first->next=info;
info->next=first;
first->x[0]=0;
first->y[0]=0;
first->x[1]=0;
first->y[1]=1;
first->x[2]=-1;
first->y[2]=1;
first->x[3]=1;
first->y[3]=0;
first->start_x=5;
first->start_y=2;
first->color=14;

info->x[0]=0;
info->y[0]=0;
info->x[1]=0;
info->y[1]=-1;
info->x[2]=1;
info->y[2]=0;
info->x[3]=1;
info->y[3]=1;
info->start_x=5;
info->start_y=2;
info->color=14;

if(random(2)==0) {return first;}
else {return first->next;}
}
/*****************************************************************************************/
struct diamond *create_H()
{
struct diamond *first;
first=(struct diamond *)malloc(sizeof(struct diamond));
first->next=first;
first->x[0]=0;
first->y[0]=0;
first->x[1]=0;
first->y[1]=1;
first->x[2]=1;
first->y[2]=0;
first->x[3]=1;
first->y[3]=1;
first->start_x=5;
first->start_y=2;
first->color=1;
return first;
}
/*****************************************************************************************/
void show_next ()
{
int nowx;/*记录当前每个格子的位置*/
int nowy;
int i;/*计数器*/
int j;
int haveit;/*当前格子是否已经显示*/
struct diamond *next;/*当前方块的翻转后的下一个状态*/
next=nowinfo->next;
if (next==NULL) {gotoxy(1,1);printf("null");}
for (i=0;i<=3;i++)/*判断是否能够翻转,若不能,就直接退出该函数*/
{
if (grid[x+next->x[i]][y+next->y[i]]==1)
{
return;
}
}

setfillstyle(SOLID_FILL,backcolor);/*设置背景色以消除不需要的格子*/
for (i=0;i<=3;i++)
{
haveit=0;
for (j=0;j<=3;j++)
{
if (next->x[j]==nowinfo->x[i]&&next->y[j]==nowinfo->y[i]) {haveit=1;break;}
}
if (haveit==0) /*判断翻转后该格子是否显示,若不显示,将该格子设为背景色*/
{
grid[x+nowinfo->x[i]][y+nowinfo->y[i]]=0;
if (y+nowinfo->y[i]>=4)/*判断该格子是否到了可以显示的区域*/
floodfill(80+(nowinfo->x[i]+x)*20+1,-20+(nowinfo->y[i]+y)*20+1,color);
}
}

nowinfo=next;
nowx=x;
nowy=y;
setfillstyle(SOLID_FILL,nowinfo->color);/*设置填冲色为方块的颜色*/
for (i=0;i<=3;i++)
{
if (grid[x+nowinfo->x[i]][y+nowinfo->y[i]]!=2)/*如果该格子还没有被显示*/
{
nowx=x+nowinfo->x[i];
nowy=y+nowinfo->y[i];
if (y+nowinfo->y[i]>=4)
floodfill(80+nowx*20+1,-20+nowy*20+1,color);
grid[nowx][nowy]=2; /*设置该格子当前有活动方块*/
}
}
return;
}
/*****************************************************************************************/
void show_left ()
{
int i;/*计数器*/
int j;
int haveit;/*当前格子是否已经显示*/
int nowx;/*记录当前每个格子的位置*/
int nowy;
for (i=0;i<=3;i++)/*判断是否可以向左移动*/
{
if (grid[x-1+nowinfo->x[i]][y+nowinfo->y[i]]==1)
{
return;
}
}

setfillstyle(SOLID_FILL,backcolor);/*设置背景色以消除不需要的格子*/
for (i=0;i<=3;i++)
{
haveit=0;
for (j=0;j<=3;j++)
{
if (nowinfo->x[i]==nowinfo->x[j]-1&&nowinfo->y[i]==nowinfo->y[j]) {haveit=1;break;}
}
if (haveit==0) /*判断翻转后该格子是否显示,若不显示,将该格子设为背景色*/
{
grid[x+nowinfo->x[i]][y+nowinfo->y[i]]=0;
if (y+nowinfo->y[i]>=4)/*判断该格子是否到了可以显示的区域*/
floodfill(80+(nowinfo->x[i]+x)*20+1,-20+(nowinfo->y[i]+y)*20+1,color);
}
}

setfillstyle(SOLID_FILL,nowinfo->color);/*设置填冲色为方块的颜色*/
for (i=0;i<=3;i++)
{
nowx=x+nowinfo->x[i]-1;
nowy=y+nowinfo->y[i];
if (grid[nowx][nowy]!=2)/*如果该格子还没有被显示*/
{
if (nowy>=4)
floodfill(80+nowx*20+1,-20+nowy*20+1,color);
grid[nowx][nowy]=2;
}
}
x=x-1;
return;
}
/*****************************************************************************************/
void show_right ()
{
int i;/*计数器*/
int j;
int haveit;/*当前格子是否已经显示*/
int nowx;/*记录当前每个格子的位置*/
int nowy;
for (i=0;i<=3;i++)
{
if (grid[x+1+nowinfo->x[i]][y+nowinfo->y[i]]==1)
{
return;/*判断是否可以向右移动*/
}
}

setfillstyle(SOLID_FILL,backcolor);/*设置背景色以消除不需要的格子*/
for (i=0;i<=3;i++)
{
haveit=0;
for (j=0;j<=3;j++)
{
if (nowinfo->x[i]==nowinfo->x[j]+1&&nowinfo->y[i]==nowinfo->y[j]) {haveit=1;break;}
}
if (haveit==0)/*判断翻转后该格子是否显示,若不显示,将该格子设为背景色*/
{
grid[x+nowinfo->x[i]][y+nowinfo->y[i]]=0;
if (y+nowinfo->y[i]>=4)/*判断该格子是否到了可以显示的区域*/
floodfill(80+(nowinfo->x[i]+x)*20+1,-20+(nowinfo->y[i]+y)*20+1,color);
}
}

setfillstyle(SOLID_FILL,nowinfo->color);/*设置填冲色为方块的颜色*/
for (i=0;i<=3;i++)
{
nowx=x+nowinfo->x[i]+1;
nowy=y+nowinfo->y[i];
if (grid[nowx][nowy]!=2)
{
if (nowy>=4)/*判断该格子是否到了可以显示的区域*/
floodfill(80+nowx*20+1,-20+nowy*20+1,color);
grid[nowx][nowy]=2;
}
}
x=x+1;
return;
}
/*****************************************************************************************/
void show_down ()
{

int i;/*计数器*/
int j;
int haveit;/*当前格子是否已经显示*/
int nowx;/*记录当前每个格子的位置*/
int nowy;
int key;
for (i=0;i<=3;i++)
{
if (grid[x+nowinfo->x[i]][y+nowinfo->y[i]+1]==1)/*判断方块是否能够下落*/
{
for (j=0;j<=3;j++)
{
grid[x+nowinfo->x[j]][y+nowinfo->y[j]]=1;
if (y+nowinfo->y[j]<=3)
{/*判断游戏是否已经玩完*/
install(oldtimer);
setfillstyle(SOLID_FILL,1);
bar(0,465,640,480);
outtextxy(5,469,"Do you want to restart (Y/N)...");
for (;
{
key=bioskey(0);
if (key==YES)
{
startset();
setfillstyle(SOLID_FILL,9);
bar(0,465,640,480);
return;
}
if (key==NO)
{
closegraph();
exit (0);}
}
}
}

delinfo(nowinfo);
scandel();/*扫描,删除*/
delay(2500);
while(bioskey(1)) bioskey(0);/*清除键盘缓冲区*/
/* clrkey();*/
nowinfo=nextinfo;/*得到新的方块*/
nextinfo=get_diamond();/*得到下一个方块*/
showsubwin(nextinfo);
x=nowinfo->start_x;/*重新设置方块位置*/
y=nowinfo->start_y;
return;
}
}

setfillstyle(SOLID_FILL,backcolor);/*设置背景色以消除不需要的格子*/

for (i=0;i<=3;i++)
{
haveit=0;
for (j=0;j<=3;j++)
{
if (nowinfo->x[i]==nowinfo->x[j]&&nowinfo->y[i]==nowinfo->y[j]+1) {haveit=1;break;}
}
......
详见:
http://topic.csdn.net/t/20030409/15/1638691.html
http://www.anyter.com/doc/doc.asp?doc_id=87

  • c璇█鍐淇勭綏鏂柟鍧浠g爜
    绛旓細涓銆佹垜浠彲浠ョ敤缂栧彿锛屼笉鍚岀殑缂栧彿浠h〃涓嶅悓鐨勪縿缃楁柉鏂瑰潡锛屾牴鎹紪鍙锋妸涓嶅悓鏂瑰潡鐨勭敾娉曞啓鍦ㄤ唬鐮佷腑锛岃繖鏍19绉嶃傛柟鍧楀氨寰楁湁19绉嶇浉搴旂殑浠g爜鏉ユ弿缁樸傝屼笖杩欐牱鎵╁睍鎬т笉濂斤紝鑻ヤ互鍚庤璁′簡鏂扮殑鏂瑰潡锛屽垯闇瑕佹洿鏀瑰ぇ閲忔簮浠g爜銆備簩銆佹垜浠緢鑷劧鐨勬兂鍒板彲鐢ㄥ瓧妯$偣闃电殑褰㈠紡鏉ヨ〃绀猴紝鍗宠缃竴涓4琛4鍒楃殑鏁扮粍锛屽厓绱犵疆1鍗充唬琛ㄨ繖...
  • c璇█淇勭綏鏂柟鍧浠g爜
    绛旓細#define VK_ENTER 0x1c0d /* 瀹氫箟淇勭綏鏂柟鍧鐨勬柟鍚(鎴戝畾涔変粬涓4绉)*/ #define F_DONG 0 #define F_NAN 1 #define F_XI 2 #define F_BEI 3 #define NEXTCOL 20 /* 瑕佸嚭鐨勪笅涓涓柟鍧楃殑绾靛潗鏍*/ #define NEXTROW 12 /* 瑕佸嚭鐨勪笅涓涓柟鍧楃殑妯粠鏍*/ #define MAXROW 14 /* 娓告垙灞忓箷澶у皬*/...
  • C璇█浠g爜淇勭綏鏂柟鍧(yCodeBlocks)?
    绛旓細include "mywindows.h"HANDLE handle;// 鍒濆鍖栧彞鏌 void initHandle(){ handle = GetStdHandle(STD_OUTPUT_HANDLE);} // 璁剧疆棰滆壊 void setColor(int color){ SetConsoleTextAttribute(handle, color);} void setPos(int x, int y){ //, 锛孋OORD coord = {x*2, y};SetConsoleCursorPosition...
  • 淇勭綏鏂柟鍧桟璇█浠g爜
    绛旓細case 2: { a[x-2][y]=b[1]; a[x+2][y]=b[2]; a[x+4][y]=b[3]; break; } //鐩寸嚎鏂瑰潡:--- case 3: { a[x][y-1]=b[1]; a[x][y-2]=b[2]; a[x][y+1]=b[3]; break; } //鐩寸嚎鏂瑰潡: | case 4: { a[x-2][y]=b[1]; a[x+2][y]=b[2]; a[x][y+...
  • c璇█鍐淇勭綏鏂柟鍧浠涔堟按骞
    绛旓細c璇█鍐欎縿缃楁柉鏂瑰潡楂樻按骞炽傛牴鎹煡璇㈢浉鍏宠祫鏂欎俊鎭樉绀猴紝淇勭綏鏂柟鍧楁槸涓绉嶇畝鍗曠殑娓告垙锛岃鎯充娇鐢C璇█鏉ュ啓杩欎釜娓告垙锛岄渶瑕佸叿澶囦竴瀹氱殑缂栫▼鑳藉姏锛屼粠鍏ラ棬鍒扮啛缁冩按骞冲ぇ姒傞渶瑕1~2涓湀鐨勬椂闂淬
  • 鎬庢牱鐢c璇█缂栧啓淇勭綏鏂柟鍧绋嬪簭?
    绛旓細淇勭綏鏂柟鍧桟婧愪唬鐮 #include <stdio.h> #include <windows.h> #include <conio.h> #include #define ZL 4 //鍧愭爣澧為噺, 涓嶄娇娓告垙绐楀彛闈犺竟 #define WID 36 //娓告垙绐楀彛鐨勫搴 #define HEI 20 //娓告垙绐楀彛鐨勯珮搴 int i,j,Ta,Tb,Tc; // Ta,Tb,Tc鐢ㄤ簬璁颁綇鍜岃浆鎹㈡柟鍧楀彉閲忕殑鍊 int a[60][60]={0};...
  • 濡備綍鐢C璇█缂栦竴涓淇勭綏鏂柟鍧
    绛旓細public void Draw(System.IntPtr winHandle) //鍦ㄦ寚瀹氳澶囦笂鐢鏂瑰潡 { 鈥︹ } public void Erase(System.IntPtr winHandle)//鎿﹂櫎鏂瑰潡 { 鈥︹ } } Block绫伙細杩欎釜绫绘弿杩扮殑瀵硅薄鏄煇涓涓ぇ鏂瑰潡鐨勫疄浣撱傛瘡涓ぇ鏂瑰潡鐢卞洓涓皬姝f柟褰㈢粍鎴愶紝涓鍏辨湁7绉嶇粍鍚堟柟寮忋傝繖涓被闇瑕佸疄鐜颁竴涓ぇ鏂瑰潡瀹炰綋鎵鏈夌殑...
  • 鐢c璇█缂栧啓淇勭綏鏂柟鍧绋嬪簭 姹傝瑙
    绛旓細姣忎竴涓瓧鑺傛槸8浣嶏紝鐢ㄦ瘡4浣嶈〃绀鏂瑰潡涓殑涓琛)unsigned int rockShapeBits ;int nextRockIndex ; //涓嬩竴涓柟鍧楋紝鍦ㄦ暟缁勪腑鐨勪笅鏍 } RockType ;杩欐牱锛屽綋鎴戜滑鎸変笅涓婃柟鍚戦敭鏃讹紝鎶婁紶鍏ュ嚱鏁癉rawRock涓殑rockIndex鍙樹负褰撳墠鏂瑰潡缁撴瀯浣撲腑鐨刵extRockIndex鍗冲彲銆傚弬鑰冭祫鏂欙細C璇█鍥惧舰鐣岄潰绡 ...
  • 涓涓畝鍗曠殑c璇█鍐鐨勪縿缃楁柉鏂瑰潡绋嬪簭?
    绛旓細鎴戜滑鎶淇勭綏鏂柟鍧鐐归樀鐨勬暟浣嶅瓨鍦╮ockArray涓紝鎴戜滑鍙互浜嬪厛鎶婅繖19绉嶆柟鍧楃殑瀛楁ā鐐归樀鑷繁杞寲鎴愬崄鍏繘鍒讹紝鐒跺悗鍦╮ockArray鏁扮粍鐨勫垵濮嬪寲鏃惰祴鍊艰繘鍘汇 浣嗘槸杩欑鏂瑰紡鎵╁睍鎬т笉濂斤紝姣忓綋鏈変竴绉嶆柊鏂瑰潡鏃堕渶瑕佹敼鍔紝 鎵浠ュ彲浠ュ啓涓涓厤缃枃浠舵潵琛ㄧず19绉嶆柟鍧椼(RockShape.ini)1234 浠庨厤缃枃浠朵腑璇诲彇鏂瑰潡鐨勭被鍨嬬殑浠g爜鍦紙...
  • 淇勭綏鏂柟鍧梒璇█鐨浠g爜
    绛旓細淇勭綏鏂柟鍧梒璇█鐨浠g爜 闄や簡绠鍗曠殑鍩烘湰瑕佹眰澶栬繕鏈:1.骞冲彴vc6.02.鑳藉瀹炵幇璁╂柟鍧椾笂鏈夋垜鎯宠鎹㈢殑鐓х墖3.鑳藉鎻掑叆鎴戞兂瑕佽缃殑澹伴煶甯屾湜2鍜3杩欎袱鐐瑰鐨勪唬鐮佷笂娓歌缁嗙殑瑙i噴... 闄や簡绠鍗曠殑鍩烘湰瑕佹眰澶栬繕鏈:1.骞冲彴vc6.0 2.鑳藉瀹炵幇璁╂柟鍧椾笂鏈夋垜鎯宠鎹㈢殑鐓х墖 3.鑳藉鎻掑叆鎴戞兂瑕佽缃殑澹伴煶 甯屾湜2鍜3杩欎袱鐐瑰鐨勪唬鐮佷笂娓歌缁...
  • 扩展阅读:免费版俄罗斯方块下载 ... 俄罗斯方块苹果版下载 ... 俄罗斯方块全免费 ... 俄罗斯方块游戏免费版 ... 俄罗斯方块儿下载 ... 俄罗斯方块经典版 ... 下载俄罗斯方块并安装 ... 俄罗斯方块下载老版本 ... 俄罗斯方块怀旧版下载 ...

    本站交流只代表网友个人观点,与本站立场无关
    欢迎反馈与建议,请联系电邮
    2024© 车视网