diff --git a/redsquare.c b/redsquare.c index 6ad01a7..caee954 100644 --- a/redsquare.c +++ b/redsquare.c @@ -13,6 +13,7 @@ You should have received a copy of the CC0 Public Domain Dedication along with t #include "common.h" #define LEN 35 #define WID 50 +#define STALE_LIMIT 2 #define RLEN LEN //real #define RWID WID #define DEAD 0 @@ -24,6 +25,7 @@ byte py,px; byte cy,cx;//cross bool coherent;//square's coherence int anum,rnum;//reds and otherwise alive cell counts +int stale_cells,stale_for;//throw new cells if it is stale for a long time chtype colors[6]={0}; void cp(byte a[RLEN][RWID],byte b[RLEN][RWID]){ byte y,x; @@ -90,6 +92,11 @@ void draw(byte board[RLEN][RWID]){ chtype prnt; byte y,x; setup_scroll(); + if(stale_for){ + attron(colors[3]); + mvprintw(4,0,"%d",stale_for); + attroff(colors[3]); + } for(y=beginy;ySTALE_LIMIT){ + for(int i=0;i<10;++i){ + board[rand()%LEN][rand()%WID]=RED; + } + for(int i=0;i<10;++i){ + board[rand()%LEN][rand()%WID]=ALIVE; + } + stale_for=0; + } if(rnum>anum||cinred==2){ mvprintw(LEN+5,0,"Well done! Press a key to continue:"); curs_set(1);