From bff304279b83f13fe81cda64d8c85761fb50aa46 Mon Sep 17 00:00:00 2001 From: untakenstupidnick Date: Sun, 21 Jun 2020 08:05:03 +0430 Subject: [PATCH] fifteen --- sources/fifteen.c | 22 +++++++++++++--------- sources/fisher.c | 3 ++- sources/redsquare.c | 3 ++- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/sources/fifteen.c b/sources/fifteen.c index ebe06f9..f3596e2 100644 --- a/sources/fifteen.c +++ b/sources/fifteen.c @@ -1,5 +1,5 @@ /* ---. +.-- |__ | IFTEEN @@ -14,7 +14,7 @@ compile with -lncurses #include #include #include -typedef signed char byte; +typedef /*signed char*/ uint8_t byte; /* The Plan9 compiler can not handle VLAs */ #ifdef Plan9 @@ -22,6 +22,7 @@ typedef signed char byte; #else byte size; #endif +FILE *lol; byte py,px; byte ey,ex; //the empty tile chtype green=A_BOLD; //bold when there is no color @@ -40,7 +41,7 @@ void rectangle(byte sy,byte sx){ mvaddch(sy+size+1,sx+size*2,ACS_LRCORNER); } void logo(byte sy,byte sx){ - mvaddstr(sy,sx, "--."); + mvaddstr(sy,sx, ".--"); mvaddstr(sy+1,sx,"|__"); mvaddstr(sy+2,sx,"| IFTEEN"); } @@ -86,22 +87,24 @@ void fill(char board[size][size]){ board[size-1][size-1]=' '; } void slide_one(char board[size][size],byte y,byte x){ - if( (y>=0 && y=0 && x=0 && y=0 && x0)? 1:-1; if(ex!=x) - dx=(x-ex)/abs(x-ex); - while(ex!=x || ey!=y) + dx=(x-ex >0)? 1:-1; + while(ex!=x || ey!=y){ slide_one(board,ey+dy,ex+dx);//ey/x comes forth itself + } ey=y; ex=x; } @@ -198,6 +201,7 @@ int main(int argc, char** argv){ } } #endif + lol=fopen("lol","w"); signal(SIGINT,sigint_handler); srand(time(NULL)%UINT_MAX); initscr(); diff --git a/sources/fisher.c b/sources/fisher.c index 8798b58..bea5732 100644 --- a/sources/fisher.c +++ b/sources/fisher.c @@ -92,7 +92,7 @@ void draw(void){ if(clbtime){ if(count[clb]!=1){ - mvprintw(2,10,"%d ",count[clb]); + mvprintw(9,43,"%d ",count[clb]); switch(clb){ case 0: addstr("plastic bags!"); @@ -127,6 +127,7 @@ void draw(void){ } } else{ + move(9,43); switch(clb){ case 0: addstr("A plastic bag!"); diff --git a/sources/redsquare.c b/sources/redsquare.c index 88de9a8..2a6d78d 100644 --- a/sources/redsquare.c +++ b/sources/redsquare.c @@ -465,7 +465,7 @@ int main(void){ byte board[RLEN][RWID]; memset(board,0,RLEN*RWID); char result[70]; - int input; + int input=0; int prey,prex; int cinred; Start: @@ -535,6 +535,7 @@ int main(void){ printw(". "); break; } + halfdelay(9); input = getch(); live(board); count(board);//apparently this should come at both sides of live+draw. resulting from trial and error.