#include "graphics.h"
#include "stdio.h"
#include "dos.h"
#include "conio.h"
#include "bios.h"
#include "stdlib.h"
#include "math.h"
#ifdef __cplusplus
#define __CPPARGS ...
#else
#define __CPPARGS
#endif
#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
#define VK_PGUP 0x4900
#define VK_PGDOWN 0x5100
#define TIMER 0x1c
void drawblock(int,int,int);
void nedr(void);
void fk(int,int,int,int);
void rewr(int,int,int,int);
void rrwf(int,int);
int is_bd(int,int,int);
int is_line(void);
void interrupt ( *oldhandler)(__CPPARGS);
void KillTimer(void);
void SetTimer(void interrupt (*IntProc)(__CPPARGS));
void rscore(int);
int fkt[]={0,4,8,12,14,16,18};
int cj[]={0,100,300,900,1500};
long grc[]={0,3000,60000,90000,120000,150000,180000,210000,240000,270000};
int cjb[]={0,0,0,0,0,0,0,0,0,0};
char cjc[]="score: 0";
char grad[]="grade:0";
struct shape
{
short xy[8];
short color;
short next;
};
struct shape shapes[19]=
{
/* {x1,y1,x2,y3,x3,y3,x4,y4,color,next} */
{1,1,2,1,3,1,3,2,LIGHTBLUE,1}, /* □□□□ */
{2,2,3,0,3,1,3,2,LIGHTBLUE,1}, /* □■□□ */
{1,1,1,2,2,2,3,2,LIGHTBLUE,1}, /* □■□□ */
{2,0,2,1,2,2,3,0,LIGHTBLUE,-3}, /* □■■□ */
{1,1,1,2,2,1,3,1,LIGHTCYAN,1}, /* □□□□ */
{2,0,3,0,3,1,3,2,LIGHTCYAN,1}, /* □■■□ */
{1,2,2,2,3,1,3,2,LIGHTCYAN,1}, /* □■□□ */
{2,0,2,1,2,2,3,2,LIGHTCYAN,-3}, /* □■□□ */
{2,1,3,0,3,1,3,2,LIGHTRED,1}, /* □□□□ */
{1,2,2,1,2,2,3,2,LIGHTRED,1}, /* □□□□ */
{1,0,1,1,1,2,2,1,LIGHTRED,1}, /* □■□□ */
{1,0,2,0,2,1,3,0,LIGHTRED,-3}, /* ■■■□ */
{2,1,2,2,3,0,3,1,DARKGRAY,1}, /* □□□□ */
{1,0,2,0,2,1,3,1,DARKGRAY,-1}, /* □□□□ */
/* □■■□ */
/* ■■□□ */
{2,0,2,1,3,1,3,2,MAGENTA,1}, /* □□□□ */
{1,2,2,1,2,2,3,1,MAGENTA,-1}, /* □□□□ */
/* ■■□□ */
/* □■■□ */
{0,1,1,1,2,1,3,1,BROWN,1}