#include #include #include #include #include #define s(_)waddstr(W,_) #define c(_)waddch(W,_) #define f(f,_)wprintw(W,f,_) #define n c('\n') #define r(_,n)for(int _=0;_= 1024){f(" %2dk | ", *G/1024);}else{f( "%4d | " ,*G);}++ G;}n;l();if(i1?(*argv[1]-'0' ):4;if(S<=1||S>8){M= "\1Invalid size giv" "en.\n"; goto q;} W=newwin(0,0,(R-4*S) /2,(C-8*S)/2);if(!W) {M="\1T" "ermina" "l too " "small." "\n";goto q;}p();p ();while (1){wclear (W);g(); s(" h," "j,k,l:" " move " " " " q: q" "uit"); wrefresh (W);switch (wgetch( W)){case 'q':goto q;case'h' :m(1,1,1 );goto e; case'j': m(-1,S,1);goto e;case 'k':m(1,S,1);goto e; case'l': m(-1,1,1);goto e;e:if (C){p();}if(m(1,1,0) &m(-1,1,0)&m(1,S,0)& m(-1,S,0 )){M="\0Game over.\n" ;goto q;}usleep(2048 *8);break;}}q:if(W){ delwin(W );}endwin();fputs(M+ 1,stderr);return*M;} /*2^11*/