C语言实现俄罗斯方块小游戏的制作代码,具体内容如下
#include
#include
#include
#define TTY_PATH "/dev/tty"
#define STTY_ON "stty raw -echo -F"
#define STTY_OFF "stty -raw echo -F"
int map[21][14];
char direct;
int node[7][4][16]={
{ {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},
{0,1,0,0,0,1,0,0,0,1,0,0,0,1,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,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0},//3边加一中点
{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}},
{ {0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,0},//右锄头型
{0,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0},
{0,1,0,0,0,1,0,0,1,1,0,0,0,0,0,0},
{1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0}},
{ {1,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0},//左锄头型
{0,0,1,0,1,1,1,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,0,1,1,1,0,1,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,1,1,0,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,1,1,0,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},
{1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0}}
};
typedef struct block
{
int x;
int y;
int blockType;
int b