From d77362e357be287e4d161aec06415f289ab77a8a Mon Sep 17 00:00:00 2001 From: Mark Jans Date: Wed, 3 Apr 2019 16:56:28 +0200 Subject: [PATCH 1/2] Return score --- tinytetris-commented.cpp | 1 + tinytetris.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tinytetris-commented.cpp b/tinytetris-commented.cpp index f151188..b7da52a 100644 --- a/tinytetris-commented.cpp +++ b/tinytetris-commented.cpp @@ -158,4 +158,5 @@ int main() { box(stdscr, 0, 0); runloop(); endwin(); + return score; } diff --git a/tinytetris.cpp b/tinytetris.cpp index 1e2f142..45f8bc1 100644 --- a/tinytetris.cpp +++ b/tinytetris.cpp @@ -20,4 +20,4 @@ r))x--;if(c==100&&x+N(r,16)<9&&!C(x+1,y,r))x++;if(c==115){while(!C(x,y+1,r)){y++ ;U();}R();P();}if(c==119){++r%=4;while(x+N(r,16)>9)x--;if(C(x,y,r)){x=f;r=h;}}if (c==113)return 0;U();F();}}I main(){srand(time(0));initscr();start_color();for(c =1;c<8;c++){init_pair(c,c,0);}P();resizeterm(22,22);noecho();timeout(0);curs_set -(0);box(stdscr,0,0);L();endwin();} // Conor Taylor +(0);box(stdscr,0,0);L();endwin();return s;} // Conor Taylor From 8d9265f7b370d7545c08346f4c5ee5738dcd716b Mon Sep 17 00:00:00 2001 From: Mark Jans Date: Wed, 3 Apr 2019 17:02:41 +0200 Subject: [PATCH 2/2] Updated readme: return score --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6b81bd9..65abc50 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,8 @@ This is the 80x23 version. You control it with `a` (left), `d` (right), `w` (rotate), `s` (drop), and `q` (quit). It depends on `curses.h` (so you'll need to compile with `-lcurses`, and install curses if you don't already have it) and requires C++11. +The score is returned after execution. ### tinytetris-commented.cpp This one is almost identical to `tinytetris.cpp`, but not minified, and with some -comments to make it easier to read (but it's still tricky to read in certain parts). \ No newline at end of file +comments to make it easier to read (but it's still tricky to read in certain parts).