Source code of a Russian square

zhaozj2021-02-08  244

A Russian source code, written, a bit stupid ... # include #include #include #include #include #include #define LEFT 0x4b #define RIGHT 0x4d #define DOWN 0x50 #define CHANGE 0x20 #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 0, 1, 1, 0}, {0, 1, 1, 10} {0, 0, 0, 0}}, {{0, 1, 1, 0}, {0, 1, 1, 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, 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,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, 1, 0}, {0, 0, 1, 0}, {0 , 0, 1, 10}, {0, 0, 1, 0}},}, {{0 0, 1, 0, 0}, {1, 1, 1, 0}, {0,0,0, 0}, {0, 0, 0, 0}, {{0, 1, 0, 0}, {0, 1, 1, 10}, {0, 1, 0, 0}, {0, 0, 0,0}}, {0, 0, 0}, {0, 1, 0, 0}, {0, 0, 0, 0}}, {{ 0, 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 }, {0, 1, 1, 0}, {1,1,0,0}, {{1,0,0,0}, {1,1,0 , 0}, {0, 1, 0, 0}, {0, 0, 0}}, {{0, 0, 0, 0}, {0, 1, 1, 0}, {1,1 , 0, 0}, {0, 0, 0, 0}},}, {{0, 1, 0, 0}, {1, 1, 0, 0}, {1,0,0,0} {0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, 0, 0, 0, 0, 1, 1}, {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1} {1, 1, 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, 1, 1}, {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, {1, 1, 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}; char shapecolor [7] = {8, 10, 11, 12, 13, 14, 15}; char DigitalShape [10] = {128 119, 3, 62, 31, 128 75, 128 93, 128 125, 19, 128 127, 128 95}; char Zodiacback [11] = {4, 6, 12, 13, 11, 10, 2, 3, 9, 1, 8}; char zodiacsoft [18] [ 14] = {0 0, 0, 0, 0, 96, 0, 0, 0, 0, 0, 0, 60, 0}, {255, 248, 0, 0, 96, 0, 0, 0, 0, 248 , 0, 0, 124, 0}, {255, 248, 0, 0, 97, 128, 0, 0, 3, 248, 0, 0, 192, 0}, {0, 1 12, 0, 0, 97, 128, 0, 0, 7, 0, 0, 1, 128, 48}, {0,224,0,0,0,0,0,0,14,0,0,1,128,48}, { 1, 192, 0, 0, 96, 0, 0, 0, 12, 0, 0, 1, 128, 48}, {3, 128, 120, 12, 97, 128, 240, 10, 12, 0, 15, 15, 249, 255}, {7, 0, 252, 31, 225, 131, 248, 127, 14, 0, 31, 143, 249, 255}, {7, 1, 142, 48, 225, 135, 24, 127, 7, 240, 49, 193, 128, 48}, {14, 3, 134, 3, 252, 112, 193, 128, 48}, {28, 3, 6, 96, 97, 140, 25, 192, 0, 28, 96, 193, 128, 48}, {56, 3, 6, 96, 97, 140, 25, 128, 0, 6, 96, 193, 128, 48}, {56, 3, 6, 96, 97, 140, 25, 128, 0, 6, 96, 193, 128, 48}, {120, 3, 6, 96, 97, 140, 25, 128, 0, 6, 96, 193, 128, 48}, {224, 110, 48, 24, 49, 129, 128, 48, 48, 125, 249, 252, 63, 225, 135, 252, 255, 28, 28, 63, 129, 128, 48}, {255, 248, 240, 15, 97, 131, 236, 60, 15, 248, 30, 1, 128, 48}, {0, 0, 0, 0, 0, 0, 0, 7, 224, 0, 1, 128, 0}}; unsigned long totalmark =

0; unsigned int erasered = 0, ETIMES = 0; int speed = 0; int Numoflev [5] = {0,0,0,0,0}; int timedlay [10] = {21,18 17, 15, 13, 11, 9, 7, 5, 3}; char newshape [2]; unsigned peronce [4]; void interrupt (* oldhandler) (__ cpargs); void interrupt handler (__ cppargs) { counter OldHandler ();} void drawbackground () {// setLinesTyle} Void DrawDigital (int X, int y, int a) {int = 7; setColor ((DigitalShape [A] >> I) & 1) * 7 4); // Printf ("% D", (DigitalShape [A] >> I) & 1); I -; line (x, y 1, x, y 15); line (x 1, y 2, x 1, y 14); line (x 2, y 3, x 2, y 13); setColor (((DigitalShape [A] >> I) & 1) * 7 4) i--; line (x, y 17, x, y 31); line (x 1, y 18, x 1, y 30); line (x 2, y 19, x 2, y 29); setColor ((DigitalShape [A] >> I) & 1) * 7 4); i--; line (x, y 17, x, y 31); line (x 1, Y 18, X 1, Y 30); line (x 2, y 19, x 2, y 29); setColor (((DigitalShape [A] >> i) & 1) * 7 4); i -; line (x 1, y, x 16, y); line (x 2, y 1, x 15, y 1); line (x 3, y 2, x 14, y 2); setColor ((DigitalShape [A] >> I) & 1) * 7 4); i-; line (x 2, y 15, x 15, Y 15); line (x 1, y 16, x 16, y 16); line (x 2, y 17, x 15, y 17); setColor (((((((((((( DigitalShape [A] >> I) & 1) * 7 4); I -; line (x 3, y 30, x 14, y 30); line (x 2, y 31, x 15, Y 31); LINE (x 1, y 32, x 16, y 32); setColor ((DigitalShape [A] >> I) & 1) * 7 4); i - Next (x 15, y 3, x 15, y 13); line (x 16, y 2, x 16, y 14); line (x 17, y 1, x 17, Y 15); SetColor (((DigitalShape [A] >> I) & 1) * 7 4);

LINE (x 15, y 19, x 15, y 29); line (x 16, y 18, x 16, y 30); line (x 17, y 17, x 17, y 31);} void Artclear () {for (int i = 480; i> = 0; I- = 2) {setColor (3); line (0, i-6, 639, i-6); setColor (9); LINE (0, I-4, 639, I-4); setColor (1); line (0, I-2, 639, I-2); setColor (getBkcolor ()); line (0, i, 639, I); delay (1);} for (i = 1; i <480; i = 2) {setColor (3); line (0, i 6, 639, i 6); setColor (9); line (0 , i 4, 639, i 4); setColor (1); line (0, i 2, 639, i 2); setColor (GetBkcolor ()); line (0, i, 639, i); delay (1) }} void end () {for (int J = 0; j <4; j ) {for (int i = j; i <480; i = 4) {setColor (3); line (0, i 8, 639 , i 8); setColor (9); line (0, i 4, 639, i 4); setColor (1); line (0, i, 639, i); setColor (getBkcolor ()); line (0 , I, 639, I); DELAY (5);} setColor (YELLOW); OUTTEXTXY (260, 200, "[Game Over]); gotoxy (14, 16); Printf (" this freeware is Written by daniel.qu zodiacsoft 2000 "); gotoxy (12,17); Printf (" "please e-mail to swami@yeah.net or visit my homepage at"); gotoxy (12,18); Printf ("http: //grocery.2699.com if you have questions. "); gotoxy (14, 20); Printf (" i Will Soon Provide Something New, Please Wait ... "); Gotoxy (14, 22); Printf (" We Hold these Truths to be self-evident, That all Codes "); gotoxy (12,23); printf (" "); getCH (); clrs (); closegraph (); exit (0);} void showtitle () {INT GDRIVER = Detect, Gmode, ErrorCode, i, J, K; Initgraph (& gdriver, & gmode , ""); erroorcode = graphresult (); if (ErrorCode! = GROK) {Printf ("Graphics Error:% S / N / 007", GrapherrorMsg (ErrorCode)); EXIT (1);} setbkcolor (9); // this line neseds to be change for (i = 0; i <11; i

) {setColor (ZodiacBack [i]); line (200, i * 8 100, 440, i * 8 100);} delay (1000); for (j = 0; j <17; j ) for (i = 0; I <11; i ) {setColor (ZodiacBack [(i J)% 16]); line (200, i * 8 100, 440, i * 8 100); delay (4);} for (j = 0; j <18; j ) {for (i = 0; i <14; i ) {for (k = 7; k> = 0; k -) IF ((ZodiacSoft [J] [i] >> K ) & 1) {PUTPIXEL (i * 8-k 271, j 122, 14);}} delay (10);} for (j = 17; j> = 0; J -) {for (i = 0 i <14; i ) for (k = 7; k> = 0; k -) {= (zodiacsoft [j] [i] >> K) & 1) PUTPIEL (i * 8-k 271, 158-j , 5);} delay (10);} setColor (15); OutTextxy (295, 171, "present"); getCh (); artclear ();} void Drawshape (int X, int y, int color) {// if (x <2 || x> 12 || y> 19) // Return; setColor (color); / * line (x << 4, y << 4, x << 4, (y << 4) 14); line (x << 4, (y << 4) 14, (x << 4) 14, (Y << 4) 14); line (x << 4) 14, Y << 4) 14, (x << 4) 14, Y * 16); line (x << 4) 14, y << 4, x << 4, y * 16); line (x << 4) 1, y << 4, (x << 4) 1, (Y << 4) 14); line (x << 4) 1, (Y << 4) 13, (x << 4) 14, (Y << 4) 13); line ((x << 4) 13, (Y << 4) 13, (x << 4) 13 (y << 4) 1); line (x << 4) 13, (Y << 4) 1, x << 4, (Y << 4) 1); * / for INT i = 0; i <15; i ) line (x << 4, (y << 4) i, (x << 4) 14, (Y << 4) i); s Etcolor (8); line (x << 4) 15, (Y << 4) 1, (x << 4) 15, (Y << 4) 15); line (x << 4) 1, (Y << 4) 15, (x << 4) 15, (Y << 4) 15); setColor (color-8); line (x << 4) 2 (Y << 4)

2, (x << 4) 12, (Y << 4) 2); line ((x << 4) 2, (Y << 4) 2, (x << 4) 2, (Y << 4) 12);} Void Drawnull (int X, int y) {setColor (getBkcolor ()); for (int i = 0; i <16; i ) line (x << 4, (Y << 4) i, (x << 4) 15, (Y << 4) i);} Void Show (int X, int y, int currentshape, int status {int Temp; for (INT i) = 0; I <20; I ) for (int J = 2; j <12; j ) {IF (back [i] [j] == 1) Drawshape (6 J, 4 I, 8); ELSE Drawnull (6 J, 4 I);} // no matter what the the status be, I will draw the background for (int L = 0; l <4; l ) for (int P = 0; P <4; P ) {IF (L X <2 || x L> 11 || P Y> 19) Continue; // IF (Shape [currentshape] [status] [p] [l] back [y p ] [x L] == 1) // Drawshape (3 L X, 3 P Y, 8 Currentshape); // Else // Cout << 'o'; // Drawnull (3 J , 3 i); if (Shape [currentshape] [status] [P] [L] == 1) Drawshape (6 L X, 4 P Y, ShapeColor [curRentshape]); if (Back [Y P] [x l] == 1) Drawshape (6 L X, 4 P Y, 8);}} void Drawscore () {int Temp = Totalmark; for (int i = 0; i < 7; i ) {DrawDigital (477-i * 20, 65, temp% 10); temp / = 10;} temp = erasered; for (i = 0; i <4; i ) {DrawDigital (491-i * 20 ,111 , TEMP% 10); TEMP / = 10;} if (erasered == 0) Return; for i = 1; i <5; i ) {setfillstyle (1, 8); bar (378, 163 i * 14, 508, 170 i * 14); setFillStyle (1,5); bar (378, 163 i * 14, 378 130 * Numoflev [ I] / ETIMES, 170 i * 14);} DrawDigital (466, 293, speted); return;} int createnewshape ()}}}}}}} INT CREATENEWSHAPE ()} [1] = newshape [0]; newshape [0] = rand ()% 7; setfillstyle (1,0); BAR (447, 240, 514, 288); for (int L = 0; l <4; l

) for (int P = 0; P <4; P ) IF (Shape [newshape [0]] [0] [p] [l] == 1) Drawshape (28 L, 15 P, Shapecolor [7 ]); Return Newshape [1];} INT POSSIBLE (INT X, INT Y, INT CURRENTSHAPE, INT Status) {for (INT I = 0; I <4; I ) {for (int J = 0; J <4 ; J ) {IF (Shape [currentshape] [status] [i] [j] back [y i] [x j] == 2) // this line can also write as the following type: // = (Shape [currentshape] [status] [i] [j] && back [y i] [x j]) Return 0;}} Return 1;} void Goleft (int & x, int & y, int & currentshape, int & status) {ix (Possible (x-1, y, currentshape, status) x -; show (x, y, currentshape, status);} void Goright (int & x, int & y, int & currentshape, int & status) {if (Possible (x 1, y, currentShape, Status)) x ; show (x, y, currentShape, Status);} void GoDown (int & x, int & y, int & currentShape, int & Status) {int AllAreOne = 1, temp = 0; if (Possible (x, y 1, Currentshape, Status)) {y ; show (x, y, currentshape, status); return;} Totalmark = 3 * currentshape; for (int i = 0; i <4; i ) for (int J = 0; J < 4; J ) BACK [i y] = shape [currentshape] [status] [i] [j]; for (int R = 1; r <20; R ) {for (int L= 2; l <1 3; L ) {IF (back [r] [l] == 0) allareone = 0;} if (allareone == 1) {for (int RR = r; rr> 0; rr -) for (int LL) = 2; LL <13; LL ) back [rr] [ll] = back [RR-1] [LL]; ERASERED ; Cer ; Temp ;} ALLAREONE = 1;} currentshape = createnewshape (); x = defaultx; y = Defaulty; status = 0; Numoflev [Temp] ; Totalmark = 5 * Temp; show (x, y, currentshape, status); counter = 0; if (! Possible (x, y, currentshape, status) { Getch ();

End ();} if (CER> = 30) {speed = (Speed ​​ 1)% 10; CER / = 30;} if (temp) ETIMES ; DrawScore (); return;} void ChageShape (int & x, int & y, int & currentshape , INT & status {IF (Possible (x, y, currentshape, (status 1)% 4)) status = (status 1)% 4; show (x, y, currentshape, status);} void DrawFace () { INT TEMP; SetColor (15); Line (351, 59, 518, 60); Line (351, 59, 351, 156); Line (352, 59, 352, 155); setColor (7); line (518, 61, 518, 154 LINE (519, 60, 519, 154); Line (353, 155, 519, 155); LINE (352, 156, 519, 156); setColor (8); for (int I = 61; I <155; I ) line (353, I, 517, I); setColor 7); line (427,106,512,106); line (428,107,511,107); line (427,106,427,147); line (428,106,428,146); setcolor (15); line (512,106,512,147); line (511,107,511,146); line (428,146,511,146); line (427,147,512,147); settextstyle ( DEFAULT_FONT, HORIZ_DIR, 1); setcolor (14); outtextxy (357,119, "Erasered"); outtextxy (370,130, "Level:"); setcolor (15); line (352,167,519,167); line (352,168,518,168); line (352,169,352,407) Line (353, 169, 353, 406); SetColor (7); Line (519, 167, 519 , 407); LINE (352, 407, 519, 407); line (353, 406, 519, 406); line (524, 55, 89, 55); // Outter Border 1st Line (524, 55, 524, 411); line (89, 411, 524, 411); line (89 55, 89, 411); Line (524, 56, 89, 56); // Outter Border 2nd Line (525, 55, 525, 411); LINE (89, 410, 524, 410); LINE (88, 55, 88, 411); setFillStyle (8, 7); BAR (94, 59, 336, 406); // setfillstyle (1, 3); // BAR (128, 78, 296, 386); for (i = 0; i <8; i ) DrawDigital (357 i * 20, 65, 0); For (i = 0; i <4; i ) DrawDigital (431 i * 20, 111, 0); setFillStyle (1, 8); setColor (12); for (i = 0; i <4; i ) {TEMP = I '1'; Outtextxy (364, 177 14 * I, (Char *) & Temp); BAR (378, 177

转载请注明原文地址:https://www.9cbs.com/read-1540.html

New Post(0)