1.俄罗斯方块的俄罗俄罗代码
2.求一份用C语言编写的俄罗斯方块的源代码!
3.俄罗斯方块的斯方斯方源代码?
4.C++教程:俄罗斯方块源码+注释+解答
5.求俄罗斯方块源代码
俄罗斯方块的代码
一个俄罗斯方块的源代码,自己写的块安块源一秀源码,有点笨的卓源……
#include<dos.h>
#include<stdlib.h>
#include<conio.h>
#include<graphics.h>
#include<stdio.h>
#include<bios.h>
#define LEFT 0x4b
#define RIGHT 0x4d
#define DOWN 0x
#define CHANGE 0x
#define ESC 0x1b
#define INTR 0x1C
#define DefaultX 5
#define DefaultY 1
#ifdef __cplusplus
#define __CPPARGS ...
#else
#define __CPPARGS
#endif
static unsigned counter=0;
static unsigned shape[7][4][4][4]={
{
{ { 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},{ 1,1,1,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},{ 1,1,1,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,1,0,0},{ 1,1,1,0},{ 0,0,0,0},{ 0,0,0,0}},
{ { 0,1,0,0},{ 0,1,1,0},{ 0,1,0,0},{ 0,0,0,0}},
{ { 0,0,0,0},{ 1,1,1,0},{ 0,1,0,0},{ 0,0,0,0}},
{ { 0,1,0,0},{ 1,1,0,0},{ 0,1,0,0},{ 0,0,0,0}},
},
{
{ { 1,0,0,0},{ 1,1,0,0},{ 0,1,0,0},{ 0,0,0,0}},
{ { 0,0,0,0},{ 0,1,1,0},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1},
{ 1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{ 1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{ 1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{ 1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{ 1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{ 1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{ 1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{ 1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{ 1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{ 1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{ 1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{ 1,1,1,1,1,1,1,1,1,1,1,1,1,1}};
char ShapeColor[7]={ 8,,,,,,};
char DigitalShape[]={ +,3,,,+,+,+,,+,+};
char ZodiacBack[]={ 4,6,,,,,2,3,9,1,8};
char ZodiacSoft[][]={ { 0,0,0,0,,0,0,0,0,0,0,0,,0},
{ ,,0,0,,0,0,0,0,,0,0,,0},
{ ,,0,0,,,0,0,3,,0,0,,0},
{ 0,,0,0,,,0,0,7,0,0,1,,},
{ 0,,0,0,,0,0,0,,0,0,1,,},
{ 1,,0,0,,0,0,0,,0,0,1,,},
{ 3,,,,,,,,,0,,,,},
{ 7,0,,,,,,,,0,,,,},
{ 7,1,,,,,,,7,,,,,},
{ ,3,,,,,,,3,,,,,},
{ ,3,6,,,,,,0,,,,,},
{ ,3,6,,,,,,0,6,,,,},
{ ,3,6,,,,,,0,6,,,,},
{ ,3,6,,,,,,0,6,,,,},
{ ,1,,,,,,,,,,,,},
{ ,,,,,,,,,,,,,},
{ ,,,,,,,,,,,1,,},
{ 0,0,0,0,0,0,0,0,7,,0,1,,0}};
unsigned long TotalMark=0;
unsigned int Erasered=0,ETimes=0;
int Speed=0;
int CEr=0;
int NumOfLev[5]={ 0,0,0,0,0};
int TimeDelay[]={ ,,,,,,9,7,5,3};
char NewShape[2];
unsigned PerOnce[4];
void interrupt ( *oldhandler)(__CPPARGS);
void interrupt handler(__CPPARGS)
{
++counter;
oldhandler();
}
void DrawBackground()
{
//setlinestyle
}
void DrawDigital(int x,int y,int a)
{
int i=7;
setcolor(((DigitalShape[a]>>i)&1)*7+4);
//printf("%d",(DigitalShape[a]>>i)&1);
i--;
line(x,y+1,x,y+);
line(x+1,y+2,x+1,y+);
line(x+2,y+3,x+2,y+);
setcolor(((DigitalShape[a]>>i)&1)*7+4);
i--;
line(x,y+,x,y+);
line(x+1,y+,x+1,y+);
line(x+2,y+,x+2,y+);
setcolor(((DigitalShape[a]>>i)&1)*7+4);
i--;
line(x,y+,x,y+);
line(x+1,y+,x+1,y+);
line(x+2,y+,x+2,y+);
setcolor(((DigitalShape[a]>>i)&1)*7+4);
i--;
line(x+1,y,x+,y);
line(x+2,y+1,x+,y+1);
line(x+3,y+2,x+,y+2);
setcolor(((DigitalShape[a]>>i)&1)*7+4);
i--;
line(x+2,y+,x+,y+);
line(x+1,y+,x+,y+);
line(x+2,y+,x+,y+);
setcolor(((DigitalShape[a]>>i)&1)*7+4);
i--;
line(x+3,y+,x+,y+);
line(x+2,y+,x+,y+);
line(x+1,y+,x+,y+);
setcolor(((DigitalShape[a]>>i)&1)*7+4);
i--;
line(x+,y+3,x+,y+);
line(x+,y+2,x+,y+);
line(x+,y+1,x+,y+);
setcolor(((DigitalShape[a]>>i)&1)*7+4);
line(x+,y+,x+,y+);
line(x+,y+,x+,y+);
line(x+,y+,x+,y+);
}
void ArtClear()
{
for(int i=;i>=0;i-=2)
{
setcolor(3);
line(0,i-6,,i-6);
setcolor(9);
line(0,i-4,,i-4);
setcolor(1);
line(0,i-2,,i-2);
setcolor(getbkcolor());
line(0,i,,i);
delay(1);
}
for(i=1;i<;i+=2)
{
setcolor(3);
line(0,i+6,,i+6);
setcolor(9);
line(0,i+4,,i+4);
setcolor(1);
line(0,i+2,,i+2);
setcolor(getbkcolor());
line(0,i,,i);
delay(1);
}
}
void end()
{
for(int j=0;j<4;j++)
{
for(int i=j;i<;i+=4)
{
setcolor(3);
line(0,i+8,,i+8);
setcolor(9);
line(0,i+4,,i+4);
setcolor(1);
line(0,i,,i);
setcolor(getbkcolor());
line(0,i,,i);
delay(1);
}
delay(5);
}
setcolor(YELLOW);
outtextxy(,,"[ Game Over ]");
gotoxy(,);
printf("This freeware is written by Daniel.Qu ZodiacSoft ");
gotoxy(,);
printf("Please e-mail to swami@yeah.net or visit my homepage at");
gotoxy(,);
printf(" if you have question.");
gotoxy(,);
printf("I will soon provide something new,please wait...");
gotoxy(,);
printf("We hold these truths to be self-evident,that all codes");
gotoxy(,);
printf("are created FREE.");
getch();
clrscr();
closegraph();
exit(0);
}
void ShowTitle()
{
int gdriver=DETECT,gmode,errorcode,i,j,k;
initgraph(&gdriver,&gmode,"");
errorcode=graphresult();
if (errorcode!=grOk)
{
printf("Graphics error: %s
求一份用C语言编写的俄罗斯方块的源代码!
俄罗斯方块C源代码#include <stdio.h>
#include <windows.h>
#include <conio.h>
#include <time.h>
#define ZL 4 //坐标增量,码a码迷tv源码 不使游戏窗口靠边
#define WID //游戏窗口的宽度
#define HEI //游戏窗口的高度
int i,j,Ta,Tb,Tc; // Ta,Tb,Tc用于记住和转换方块变量的值
int a[][]={ 0}; //标记游戏屏幕各坐标点:0,1,2分别为空、方块、俄罗俄罗婚礼档期源码边框
int b[4]; //标记4个"口"方块:1有,斯方斯方0无,块安块源类似开关
int x,卓源y, level,score,speed; //方块中心位置的x,y坐标,游戏等级、码a码得分和游戏速度
int flag,俄罗俄罗next; //当前要操作的方块类型序号,下一个方块类型序号
void gtxy(int m,斯方斯方 int n); //以下声明要用到的自编函数
void gflag( ); //获得下一方块序号
void csh( ); //初始化界面
void start( ); //开始部分
void prfk ( ); //打印方块
void clfk( ); //清除方块
void mkfk( ); //制作方块
void keyD( ); //按键操作
int ifmov( ); //判断方块能否移动或变体
void clHA( ); //清除满行的方块
void clNEXT( ); //清除边框外的NEXT方块
int main( )
{ csh( );
while(1)
{ start( ); //开始部分
while(1)
{ prfk( );
Sleep(speed); //延时
clfk( );
Tb=x;Tc=flag; //临存当前x坐标和序号,以备撤销操作
keyD( );
y++; //方块向下移动
if (ifmov( )==0) { y--; prfk( ); dlHA( ); break;} //不可动放下,块安块源重返帝国源码删行,跨出循环
}
for(i=y-2;i<y+2;i++){ if (i==ZL) { j=0; } } //方块触到框顶
if (j==0) { system("cls");gtxy(,);printf("游戏结束!"); getch(); break; }
clNEXT( ); //清除框外的卓源NEXT方块
}
return 0;
}
void gtxy(int m, int n) //控制光标移动
{ COORD pos; //定义变量
pos.X = m; //横坐标
pos.Y = n; //纵坐标
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
void csh( ) //初始化界面
{ gtxy(ZL+WID/2-5,ZL-2); printf("俄罗斯方块"); //打印游戏名称
gtxy(ZL+WID+3,ZL+7); printf("