一直以来都想做的东西。
参考了:http://blog.youkuaiyun.com/l04205613/article/details/6972061
这些符号:■ □ → ← ↓ ↑
用了搜狗输入法中的特殊符号, 水平2个字符, 垂直1个字符。
//tetris.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h> // for memset()
#include <conio.h> // for getch()
#include <windows.h> // for windows api, just a little
#define WIDTH 12
#define HEIGHT 19
#define MOD 19
int frame[HEIGHT][WIDTH]; // 游戏框,(10 x 17), 游戏区(1, 1) -> (17, 10)
int score, grade = 1, gameSpeed = 300;
int id, next;
int cur_x, cur_y;
/* (0, 1), (2, 3), (4, 5) 为相对位置,3点 + gotoxy(28, 6) or (cur_x, cur_y) = (5, 1)固定的一个点 printf("■"); 每个方块由4个方块组成 */
int shape[MOD][6] = {
{
0, -1, 1, -1, 1, -2}, {-1, -1, 0, -1, 1, 0}, {
0, -1, -1, -1, -1, -2}, {-1, 0, 0, -1, 1, -1},
{-1, 0, 1, 0, 2, 0}, {
0, -1, 0, -2, 0, 1}, {
1, 0, 0, -1, 1, -1},
{-1, 0, 1, 0, 0, -1}, {
0, -1, 0, -2, 1, -1}, {
0, -1, -1, -1, 1, -1}, {
0, -1, 0, -2, -1, -1},
{
0, -1, 0, -2, 1, 0}, {
0, -1, 1, -1, 2, -1}, {
0, -1, 0, -2, -1, -2}, {-1, 0, 1, 0,