My five sources are not enough, who can continue to improve.

zhaozj2021-02-11  262

/ * By zhoudahua. 1999, 3, 30 * / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / (/) DOS.H> #include #define down 80 #define up 72 #define F1 59 #define Left 75 #define Right 77 #define Q 16 #define E 18 #define x 45 #define r 19 #define ESC 1 #Define Enter 28

INT judge (int); void decide (); void count (int, int, int); void sd (); int TX, Ty; int A [16] [16] = {0}, B [16] [16] = {0}; / * global variable * /

Void main () {INT X, Y, M, N, H = 0, S = 0, DONE; INT HX = 150, SY = 80; int CH; void * buf_curse; unsigned size;

INT graphdriver = detect; int graphmode; registerbgidriver; INITGRAPH (& graphdriver, & graphmode, ""); begin: sd (); for (x = 0; x <16; x ) for (y = 0; y <16 ; y ) a [x] [y] = 0; setFillStyle (1, 13); bar (0, 0, 12, 12); size = imagesize (0, 10, 12, 12); buf_curse = malloc (size) GetImage (0, 0, 12, 12, buf_curs); / * save imag save image * / Putimage (0, 0, buf_curse, xor_put);

Tx = 1000; Clearden (); setColor (White); h = 0; h = 0; hx = 154; SY = 84; setfillstyle (1, cyan); bar (0,0,639,510); setfillStyle (1 Black; BAR (157, 87, 483, 413); / * setfillstyle (1, Darkgray); BAR (157, 87, 483, 413); * / setfillstyle (1, 4); / * brown); * / bar (147, 77, 473, 403); SetFillStyle (1, LightGray); BAR (151, 81, 469, 399);

For (x = 160; x <= 460; x = 20) line (x, 90, x, 390); for (y = 90; y <= 390; y = 20) Line (160, y, 460, y ); / * Setup face * / putimage (154, 84, buf_curse, xor_put); / * xor option * / setfillstyle (1, 13); bar (150, 420, 470, 460); / * * / setfillstyle (1, black); bar ( 153, 460, 475, 467); BAR (470, 424, 475, 467); setFillStyle (1, 13); setColor (YELLOW); Outtextxy (160, 430, "Wzq Program by ZHOUDAHUA 1999-5-1."); Outtextxy (160, 448, "v1.3a"); setColor (10); OutTextxy (500, 100, "r to restar"); Outtextxy (500, 120, "ESC to quit"); OutTextxy (500, 140, "Q or Enter to Put"); Outtextxy (500, 160, "Enter to Put Down") / * OUTTEXTXY (50, 110, "please:"); * / wait: do {done = 1; ch = getKey (); switch (ch) {copy 76: Case Down: {PUTIMAGE (HX, SY, BUF_CURSE, XOR_PUT ); If (s == 15) s = 0; ELSE S = 1; SY = 84 S * 20; PUTIMAGE (HX, SY, BUF_CURSE, XOR_PUT); BREAK;}

Case Up: {PUTIMAGE (HX, SY, BUF_CURSE, XOR_PUT); if (s == 0) s = 15; ELSE S- = 1; SY = 84 S * 20; PUTIMAGE (HX, SY, BUF_CURSE, XOR_PUT) Break;}

Case Left: {PUTIMAGE (HX, SY, BUF_CURSE, XOR_PUT); if (h == 0) h = 15; ELSE H- = 1; HX = 154 h * 20; PUTIMAGE (HX, SY, BUF_CURSE, XOR_PUT) Break;}

Case Right: {PUTIMAGE (HX, SY, BUF_CURSE, XOR_PUT); if (h == 15) h = 0; ELSE H = 1; HX = 154 h * 20; PUTIMAGE (HX, SY, BUF_CURSE, XOR_PUT); Break;} Case R: {PUTIMAGE (HX, SY, BUF_CURSE, XOR_PUT); setColor (White); goto begin;} case x: case E: Case Esc: goto end;

Case Q: Case Enter: DONE = 0; Break;}

WHILE (DONE); IF (a [h] [s]! = 0) {BAR (150, 420, 470, 460); setColor (10); OutTextxy (160, 430, "You do not put it here!"); SD (); goto Wait;} a [h] [s] = 1; for (x = 6; x> 0; x--) {setColor (13); circle (160 h * 20, 90 s * 20, x); }

IF (Judge (1)) {BAR (150, 420, 470, 460); setColor (YELLOW); Outtextxy (160, 430, "Wokao you win!"); Outtextxy (160, 445, "Press R to Again); SD (); AA: IF Getch ()! = 'r') {sd (); goto aa;} PUTIMAGE (HX, SY, BUF_CURSE, XOR_PUT); setColor (White); goto begin;

DECIDE (A); if (Judge (2)) {BAR (150, 420, 470, 460); setColor (YELLOW); Outtextxy (160, 430, "Sorry, You Fail"); Outtextxy (160, 445, "Press R to Again"); SD () BB: IF (getch ()! = 'R') {sd (); goto bb;} Putimage (HX, SY, BUF_CURSE, XOR_PUT); setColor (White); goto begin;} goto wait;

End: closegraph (); free (buf_curse); for (h = 0; h <1; h ) {sd (); delay (800);

}

/ ******************************************** / VOID DECIDE (ARR) Int Arr [16] [16] {INT I, J, X, Y, L, L1, L2, L3, L4; INT MAX_1, MAX_2, N = 1, M = 2; INT X_1 = 0, y_1 = 0; INT X_2 = 0, y_2 = 0; for (i = 6; I> 0; I -) {setColor (15); Circle (TX, TY, I);}

See: for (i = 0; i <16; i ) for (j = 0; j <16; j ) b [i] [j] = 0;

For (i = 0; i <16; i ) for (j = 0; j <16; j ) IF (Arr [i] [j] == 0) {for (x = i, y = j, l1 = 0; Arr [x] [y 1] == n && y <15; y ) L1 = 2; IF (Arr [x] [y 1] == m) L1 -; for (x = i, y = J; Arr [x] [Y-1] == n && y> 0; y--) L1 = 2; IF (Arr [x] [Y-1] == m) L1 -; count (L1, I, J); for (x = I, y = j, l2 = 0; Arr [x 1] [Y-1] == N && x <15 && y> 0; x , y -) L2 = 2; IF (Arr [ X 1] [Y-1] == m) L2 -; for (x = I, y = j; arr [x-1] [y 1] == N && x> 0 && y <15; X--, Y ) L2 = 2; IF (Arr [x-1] [Y 1] == m) L2 -; count (L2, I, J); for (x = I, y = j, L3 = 0; Arr [x 1] [Y 1] == N && x <15 && y <15; x , y ) L3 = 2; IF (Arr [x 1] [y 1] == m) L3 -; for x = I, y = j; Arr [x-1] [Y-1] == N && x> 0 && y> 0; x -, y -) L3 = 2; IF (Arr [x-1] [Y- 1] == m) L3 -; count (L3, I, J); for (x = I, y = j, l4 = 0; Arr [x 1] [y] == N && x <15; x ) L4 = 2; IF (Arr [x 1] [y] == m) L4 -; for (x = i, y = j; arr [x-1] [y] == n && x> 0; x- -) L4 = 2; IF (Arr [x-1] [y] == m) L4 -; count (L4, I, J);}

IF (n == 1) {MAX_1 = B [0] [0]; for (i = 0; i <16; i ) for (j = 0; j <16; j ) IF (b [i] [j ]> = max_1) {MAX_1 = B [i] [j]; x_1 = i; y_1 = j;} n ; m-; goto see;}

IF (n == 2) {MAX_2 = B [0] [0]; for (i = 0; i <16; i ) for (j = 0; j <16; j ) IF (b [i] [j ]> = MAX_2) {MAX_2 = B [I] [J]; X_2 = I; Y_2 = J;} n ; M -;} IF (MAX_2> = 90 || (MAX_1 <90 && Max_2> = 50) || MAX_2> = MAX_1) {x_1 = x_2; y_1 = y_2;}

TX = 160 x_1 * 20; TY = 90 y_1 * 20; for (i = 6; I> 0; I - {setColor (15); if (i <3) setColor (Black); Circle (TX , TY, I);

Arr [x_1] [y_1] = 2;

}

Void Count (int L, INT I, INT J) {Switch (L) {Case -1: Case 0: Break; Case 1: B [i] [J] = 2; Break; / * 2 * / Case 2 : B [i] [j] = 4; Break; / * 4 * / case 3: b [i] [j] = 7; Break; case 4: b [i] [j] = 10; Break Case 5: B [I] [J] = 13; Break; Case 6: B [i] [J] = 50; Break; Case 7: Case 8: B [i] [J] = 95; Break; Case 9: Case 10: Case 11: Case 13: Case 14: Case 15: Case 16: Case 17: Case 18: B [i] [J] = 150; Default: B [i] [J] = 0; BREAK;}}

INT JUDGE (INT N) {INT I, J, X, Y, Ju = 0, L1, L2, L3, L4; FOR (i = 0; I <16; I ) for (j = 0; J <16; J ) IF (a [i] [j] == n) {for (x = I, y = j, l1 = 1; a [x] [y 1] == N && y <15; y ) L1 ; if (l1> = 5) {JU = 1; goto re;} for (x = i, y = j, l2 = 1; a [x 1] [Y-1] == N && x <15 && y> 0; x , Y - 1 ; if (l2> = 5) {JU = 1; goto re;} for (x = i, y = j, l3 = 1; a [x 1] [y 1] == N && x <15 && y <15; x , y ) L3 ; if (l3> = 5) {ju = 1; goto re;} for (x = i, y = j, l4 = 1; a [x 1] [y] == N && x <15; x ) L4 ; if (l4> = 5) {JU = 1; goto re;}} Re: IF (i! = 16 && j! = 16) {setColor (White); circle (160 i * 20, 90 j * 20, 10);} return (ju);} int getKey () {union regs rg; rg.h.ah = 0; int86 (0x16, & rg, & rg); return Rg.h. AH;} void sd () {sound (720); delay (3500); noid ();

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

New Post(0)