diff options
author | Alejandro Colomar <Colomar.6.4.3@GMail.com> | 2018-09-04 02:15:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-04 02:15:07 +0200 |
commit | 71b1e2be80b07b01a3dc53c0ca604d23a150548c (patch) | |
tree | cf1254a89613387c0411dddd9312bb7a530dce8f | |
parent | 44a5f7412c19104ab4d9c1f878584e0e8be6fa57 (diff) | |
parent | 1e669f047c293bbca5e6e45a7efad63c5d3d204e (diff) |
Merge pull request #51 from AlejandroColomar/3-rc
V 3~rc1
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | README.txt | 49 | ||||
-rw-r--r-- | debian/changelog | 4 | ||||
-rw-r--r-- | debian/control | 17 | ||||
-rw-r--r-- | debian/copyright | 22 | ||||
-rw-r--r-- | debian/rules | 1 | ||||
-rw-r--r-- | libalx/inc/alx_cmp.h | 20 | ||||
-rw-r--r-- | libalx/inc/alx_file.h | 17 | ||||
-rw-r--r-- | libalx/inc/alx_getnum.h | 31 | ||||
-rw-r--r-- | libalx/inc/alx_mask.h | 25 | ||||
-rw-r--r-- | libalx/inc/alx_math.h | 23 | ||||
-rw-r--r-- | libalx/inc/alx_ncur.h | 98 | ||||
-rw-r--r-- | libalx/inc/alx_seed.h | 31 | ||||
-rw-r--r-- | libalx/src/alx_cmp.c | 22 | ||||
-rw-r--r-- | libalx/src/alx_file.c | 27 | ||||
-rw-r--r-- | libalx/src/alx_getnum.c | 28 | ||||
-rw-r--r-- | libalx/src/alx_mask.c | 25 | ||||
-rw-r--r-- | libalx/src/alx_math.c | 23 | ||||
-rw-r--r-- | libalx/src/alx_ncur.c | 52 | ||||
-rw-r--r-- | libalx/src/alx_seed.c | 25 | ||||
-rw-r--r-- | modules/menu/src/menu_tui.c | 22 | ||||
-rw-r--r-- | modules/menu/src/parser.c | 6 | ||||
-rw-r--r-- | share/HELP.txt | 4 | ||||
-rw-r--r-- | share/README.txt | 49 | ||||
-rw-r--r-- | share/USAGE.txt | 2 |
25 files changed, 406 insertions, 219 deletions
@@ -1,7 +1,7 @@ #!/usr/bin/make -f VERSION = 3 -PATCHLEVEL = ~b4 +PATCHLEVEL = ~rc1 SUBLEVEL = EXTRAVERSION = NAME = instalable @@ -18,9 +18,7 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, see the file COPYING, or write * * to the Free Software Foundation, Inc. * - ******************************************************************************/ - -/****************************************************************************** + ****************************************************************************** * Disclaimer of Warranty. * * * * THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY * @@ -42,30 +40,30 @@ I would like to see it. Thank you. COMPILE: - linux: + - linux: $ make - windows (MSYS): + - windows (MSYS): $ make OS=win INSTALL: - linux: + - linux: # make install - windows: - double click on SETUP.cmd + - windows: + run 'SETUP.cmd' as administrator RUN: - linux: + - linux: $ mine-sweeper if it doesn't work: $ /usr/local/games/mine-sweeper - windows: - double click on bin/mine-sweeper.exe + - windows: + run 'bin/mine-sweeper.exe' UNINSTALL: - linux: + - linux: # make uninstall - windows: - double click on UNINSTALL.cmd + - windows: + run 'UNINSTALL.cmd' as administrator THE PROGRAM DOES: @@ -81,18 +79,23 @@ MENU: * - Start * + Select map: * - New map - * - Load map("path + * - Load map(File: "<file>") * - .. * + Change difficulty: - * - Change rows: rows (XX) - * - Change columns: cols (XX) - * - Change proportion of mines: p (XX.XXXXXX) + * - Beginner + * - Intermediate + * - Expert + * + Custom: + * - Change rows: rows (X) + * - Change columns: cols (X) + * - Change proportion of mines: p (0.XXXXXX) + * - .. * - .. * - Change file name (File: "<file_name>") - * + DEVEL: - * - Change seed (srand) - * x Change verbose - * - .. + * - Hi scores + * N/A x DEVEL: + * N/A - Change seed (srand) + * N/A - .. * - .. * - Disclaimer of warranty * - Terms and conditions @@ -102,8 +105,6 @@ MENU: SYSTEM REQUIREMENTS: - /* * A terminal ¿? - */ To be continued... diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index 68352a4..0000000 --- a/debian/changelog +++ /dev/null @@ -1,4 +0,0 @@ -mine-sweeper (3~b5) unstable; urgency=low - - * Initial Release. - * This is my first Debian package. diff --git a/debian/control b/debian/control deleted file mode 100644 index a2aa10b..0000000 --- a/debian/control +++ /dev/null @@ -1,17 +0,0 @@ -Source: mine-sweeper -Maintainer: Alejandro Colomar Andrés <1903716@gmail.com> -Uploaders: Alejandro Colomar Andrés <1903716@gmail.com> -Section: games -Priority: optional -Build-Depends: libc6-dev libncursesw5-dev libtinfo-dev -Standards-Version: 4.2.1.0 -Homepage: https://github.com/AlejandroColomar/mine-sweeper/ - -Package: mine-sweeper -Architecture: any -Section: games -Priority: optional -Essential: no -Depends: libc6,libncursesw5,libtinfo5 -Description: Terminal game based on 'Mine'. -Homepage: https://github.com/AlejandroColomar/mine-sweeper/ diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index c8688ed..0000000 --- a/debian/copyright +++ /dev/null @@ -1,22 +0,0 @@ -Based on the game 'Mine', written in 1990 by -Robert Donner & Curt Johnson at Duff Software. - -Check this: https://tcrf.net/Proto:Minesweeper_(Windows,_1990) - ----------------------------------------------------------------- - -mine-sweeper Copyright (C) 2015 Alejandro COLOMAR ANDRES - -This program comes with ABSOLUTELY NO WARRANTY. -This is free software, and you are welcome to redistribute it -under the conditions of the GNU GPL-2; see the file COPYING.txt for details. - ----------------------------------------------------------------- - - NOTE! The only valid version of the GPL is _this_ particular - version of the license (ie v2, not v2.2 or v3.x or whatever), unless - explicitly otherwise stated. - - Alejandro Colomar - ----------------------------------------------------------------- diff --git a/debian/rules b/debian/rules deleted file mode 100644 index f549901..0000000 --- a/debian/rules +++ /dev/null @@ -1 +0,0 @@ -#!/usr/bin/make -f diff --git a/libalx/inc/alx_cmp.h b/libalx/inc/alx_cmp.h index 4ae52a4..6844d73 100644 --- a/libalx/inc/alx_cmp.h +++ b/libalx/inc/alx_cmp.h @@ -1,7 +1,27 @@ +/******************************************************************************
+ * NO COPYRIGHT FOR THIS FILE. FREE FOR ALL *
+ ******************************************************************************/
+
+
+/******************************************************************************
+ ******* include guard ********************************************************
+ ******************************************************************************/
# ifndef ALX_CMP_H
# define ALX_CMP_H
+/******************************************************************************
+ ******* functions ************************************************************
+ ******************************************************************************/
int compare_int64 (const void *a, const void *b);
+
+/******************************************************************************
+ ******* include guard ********************************************************
+ ******************************************************************************/
# endif /* alx_cmp.h */
+
+
+/******************************************************************************
+ ******* end of file **********************************************************
+ ******************************************************************************/
diff --git a/libalx/inc/alx_file.h b/libalx/inc/alx_file.h index 15d525e..951d98c 100644 --- a/libalx/inc/alx_file.h +++ b/libalx/inc/alx_file.h @@ -2,9 +2,26 @@ * Copyright (C) 2017 Alejandro Colomar Andrés *
******************************************************************************/
+
+/******************************************************************************
+ ******* include guard ********************************************************
+ ******************************************************************************/
# ifndef ALX_FILE_H
# define ALX_FILE_H
+
+/******************************************************************************
+ ******* functions ************************************************************
+ ******************************************************************************/
void alx_prn_file (const char *filepath);
+
+/******************************************************************************
+ ******* include guard ********************************************************
+ ******************************************************************************/
# endif /* alx_file.h */
+
+
+/******************************************************************************
+ ******* end of file **********************************************************
+ ******************************************************************************/
diff --git a/libalx/inc/alx_getnum.h b/libalx/inc/alx_getnum.h index 2f5e1d9..17404e0 100644 --- a/libalx/inc/alx_getnum.h +++ b/libalx/inc/alx_getnum.h @@ -2,25 +2,25 @@ * Copyright (C) 2017 Alejandro Colomar Andrés *
******************************************************************************/
+
+/******************************************************************************
+ ******* include guard ********************************************************
+ ******************************************************************************/
# ifndef ALX_GETNUM_H
# define ALX_GETNUM_H
-// #include <curses.h>
+
+/******************************************************************************
+ ******* headers **************************************************************
+ ******************************************************************************/
#include <math.h>
-// #include <stdbool.h>
#include <stdarg.h>
#include <stdint.h>
- /*
- * Examples:
- * a = alx_getdbl_mM(m, M, d, "a:\t", NULL);
- * a = alx_getdbl_m(m, d, "a:\t", NULL);
- * a = alx_getdbl("a:\t", NULL);
- * a = alx_getint_mM(m, M, d, "a:\t", NULL);
- * a = alx_getint_m(m, d, "a:\t", NULL);
- */
-
+/******************************************************************************
+ ******* functions ************************************************************
+ ******************************************************************************/
double alx_getdbl (double m,
double def,
double M,
@@ -35,4 +35,13 @@ const char *formatB,
...);
+
+/******************************************************************************
+ ******* include guard ********************************************************
+ ******************************************************************************/
# endif /* alx_getnum.h */
+
+
+/******************************************************************************
+ ******* end of file **********************************************************
+ ******************************************************************************/
diff --git a/libalx/inc/alx_mask.h b/libalx/inc/alx_mask.h index 5cfeb48..9230013 100644 --- a/libalx/inc/alx_mask.h +++ b/libalx/inc/alx_mask.h @@ -1,8 +1,33 @@ +/******************************************************************************
+ * NO COPYRIGHT FOR THIS FILE. FREE FOR ALL *
+ ******************************************************************************/
+
+
+/******************************************************************************
+ ******* include guard ********************************************************
+ ******************************************************************************/
# ifndef ALX_MASK_H
# define ALX_MASK_H
+
+/******************************************************************************
+ ******* headers **************************************************************
+ ******************************************************************************/
#include <stdint.h>
+
+/******************************************************************************
+ ******* functions ************************************************************
+ ******************************************************************************/
uint64_t alx_maskgen (int64_t l);
+
+/******************************************************************************
+ ******* include guard ********************************************************
+ ******************************************************************************/
# endif /* alx_mask.h */
+
+
+/******************************************************************************
+ ******* end of file **********************************************************
+ ******************************************************************************/
diff --git a/libalx/inc/alx_math.h b/libalx/inc/alx_math.h index 2a1fd99..69ae00a 100644 --- a/libalx/inc/alx_math.h +++ b/libalx/inc/alx_math.h @@ -1,13 +1,25 @@ /****************************************************************************** - * Copyright (C) 2017 Alejandro Colomar Andrés * + * NO COPYRIGHT FOR THIS FILE. FREE FOR ALL * ******************************************************************************/ + +/****************************************************************************** + ******* include guard ******************************************************** + ******************************************************************************/ # ifndef ALX_MATH_H # define ALX_MATH_H + +/****************************************************************************** + ******* headers ************************************************************** + ******************************************************************************/ #include <math.h> #include <stdint.h> + +/****************************************************************************** + ******* functions ************************************************************ + ******************************************************************************/ /* * Factorial */ @@ -19,4 +31,13 @@ double alx_fact (int64_t n); */ double alx_bin_coef (int64_t a, int64_t b); + +/****************************************************************************** + ******* include guard ******************************************************** + ******************************************************************************/ # endif /* alx_math.h */ + + +/****************************************************************************** + ******* end of file ********************************************************** + ******************************************************************************/ diff --git a/libalx/inc/alx_ncur.h b/libalx/inc/alx_ncur.h index 716448d..bf5ed43 100644 --- a/libalx/inc/alx_ncur.h +++ b/libalx/inc/alx_ncur.h @@ -2,19 +2,34 @@ * Copyright (C) 2017 Alejandro Colomar Andrés *
******************************************************************************/
-# ifndef LIBALX_NCUR_H
- # define LIBALX_NCUR_H
+/******************************************************************************
+ ******* include guard ********************************************************
+ ******************************************************************************/
+# ifndef ALX_NCUR_H
+ # define ALX_NCUR_H
+
+
+/******************************************************************************
+ ******* headers **************************************************************
+ ******************************************************************************/
#include <ncurses.h>
#include <stdint.h>
- struct alx_optn {
+
+/******************************************************************************
+ ******* structs **************************************************************
+ ******************************************************************************/
+ struct Alx_Menu {
int r;
int c;
char *t;
};
+/******************************************************************************
+ ******* functions ************************************************************
+ ******************************************************************************/
void alx_start_curses (void);
void alx_pause_curses (void);
void alx_resume_curses (void);
@@ -24,12 +39,12 @@ int alx_menu (int h,
int w,
int N,
- struct alx_optn mnu[N],
+ struct Alx_Menu mnu[N],
const char *str);
int alx_menu_2 (WINDOW *win,
int N,
- struct alx_optn mnu[N],
+ struct Alx_Menu mnu[N],
const char *str);
double alx_w_getdbl (int w,
@@ -73,69 +88,12 @@ const char *subtitle);
-/*
-
-
- const int64_t len = TST_FUNCTIONS;
- const struct alx_option mnu[TST_FUNCTIONS] = {{7, 4, "[0] Exit program"},
- {2, 4, "[1] Continue"},
- {3, 4, "[2] Disclaimer of warranty"},
- {4, 4, "[3] Continue"},
- {5, 4, "[4] Disclaimer of warranty"},
- {6, 4, "[5] Continue"},
- {7, 4, "[6] Disclaimer of warranty"},
- {8, 4, "[7] Continue"},
- {9, 4, "[8] Disclaimer of warranty"},
- {10, 4, "[9] Continue"},
- {11, 4, "[10] Disclaimer of warranty"},
- {12, 4, "[11] Continue"},
- {13, 4, "[12] Disclaimer of warranty"},
- {14, 4, "[13] Continue"},
- {15, 4, "[14] Disclaimer of warranty"},
- {16, 4, "[15] Continue"},
- {17, 4, "[16] Disclaimer of warranty"},
- {18, 4, "[17] Continue"},
- {19, 4, "[18] Disclaimer of warranty"},
- {20, 4, "[19] Continue"},
- {21, 4, "[20] Disclaimer of warranty"},
- {22, 4, "[21] Continue"},
- {23, 4, "[22] Disclaimer of warranty"},
- {24, 4, "[23] Continue"},
- {25, 4, "[24] Disclaimer of warranty"},
- {26, 4, "[25] Continue"},
- {27, 4, "[26] Disclaimer of warranty"},
- {28, 4, "[27] Continue"},
- {29, 4, "[28] Disclaimer of warranty"},
- {26, 4, "[29] Terms and conditions"}};
-
- wh = true;
- while (wh) {
- win = newwin(h, w, r, c);
- keypad(win, true);
-
- alx_w_title(win, "MENU:");
- mvwaddstr(win, mnu[1].r, mnu[1].c, mnu[1].t);
- mvwaddstr(win, mnu[2].r, mnu[2].c, mnu[2].t);
- mvwaddstr(win, mnu[3].r, mnu[3].c, mnu[3].t);
- mvwaddstr(win, mnu[4].r, mnu[4].c, mnu[4].t);
- mvwaddstr(win, mnu[5].r, mnu[5].c, mnu[5].t);
- mvwaddstr(win, mnu[6].r, mnu[6].c, mnu[6].t);
- mvwaddstr(win, mnu[7].r, mnu[7].c, mnu[7].t);
- mvwaddstr(win, mnu[8].r, mnu[8].c, mnu[8].t);
- mvwaddstr(win, mnu[9].r, mnu[9].c, mnu[9].t);
- mvwaddstr(win, mnu[0].r, mnu[0].c, mnu[0].t);
- mvwaddstr(win, mnu[11].r, mnu[11].c, mnu[11].t);
- mvwaddstr(win, mnu[12].r, mnu[12].c, mnu[12].t);
- mvwaddstr(win, mnu[13].r, mnu[13].c, mnu[13].t);
- mvwaddstr(win, mnu[14].r, mnu[14].c, mnu[14].t);
- mvwaddstr(win, mnu[15].r, mnu[15].c, mnu[15].t);
- mvwaddstr(win, mnu[16].r, mnu[16].c, mnu[16].t);
- mvwaddstr(win, mnu[17].r, mnu[17].c, mnu[17].t);
- mvwaddstr(win, mnu[18].r, mnu[18].c, mnu[18].t);
- mvwaddstr(win, mnu[19].r, mnu[19].c, mnu[19].t);
- mvwaddstr(win, mnu[0].r, mnu[0].c, mnu[0].t);
- wrefresh(win);
-
-*/
-
+/******************************************************************************
+ ******* include guard ********************************************************
+ ******************************************************************************/
# endif /* alx_ncur.h */
+
+
+/******************************************************************************
+ ******* end of file **********************************************************
+ ******************************************************************************/
diff --git a/libalx/inc/alx_seed.h b/libalx/inc/alx_seed.h index c7ea59d..161283d 100644 --- a/libalx/inc/alx_seed.h +++ b/libalx/inc/alx_seed.h @@ -1,8 +1,33 @@ -# ifndef SEED_H
- # define SEED_H
+/******************************************************************************
+ * Robert Jenkins' 96 bit Mix Function *
+ ******************************************************************************/
+
+/******************************************************************************
+ ******* include guard ********************************************************
+ ******************************************************************************/
+# ifndef ALX_SEED_H
+ # define ALX_SEED_H
+
+
+/******************************************************************************
+ ******* headers **************************************************************
+ ******************************************************************************/
#include <stdint.h>
- int64_t seedf (int64_t a, int64_t b, int64_t c);
+/******************************************************************************
+ ******* functions ************************************************************
+ ******************************************************************************/
+ uint32_t seedf (uint32_t a, uint32_t b, uint32_t c);
+
+
+/******************************************************************************
+ ******* include guard ********************************************************
+ ******************************************************************************/
# endif /* seed.h */
+
+
+/******************************************************************************
+ ******* end of file **********************************************************
+ ******************************************************************************/
diff --git a/libalx/src/alx_cmp.c b/libalx/src/alx_cmp.c index c5c1e76..e851eee 100644 --- a/libalx/src/alx_cmp.c +++ b/libalx/src/alx_cmp.c @@ -1,8 +1,25 @@ +/******************************************************************************
+ * NO COPYRIGHT FOR THIS FILE. FREE FOR ALL *
+ ******************************************************************************/
+
+
+/******************************************************************************
+ ******* headers **************************************************************
+ ******************************************************************************/
+/* * * * * * * * * *
+ * * * Standard * * * * * *
+ * * * * * * * * * */
#include <stdint.h>
+/* * * * * * * * * *
+ * * * Other * * * * * * *
+ * * * * * * * * * */
#include "alx_cmp.h"
+/******************************************************************************
+ ******* main *****************************************************************
+ ******************************************************************************/
/*
* Comparison function. Receives two items under comparison.
* return int
@@ -21,3 +38,8 @@ int compare_int64 (const void *a, const void *b) return r;
}
+
+
+/******************************************************************************
+ ******* end of file **********************************************************
+ ******************************************************************************/
diff --git a/libalx/src/alx_file.c b/libalx/src/alx_file.c index 1196c22..fa0d6e3 100644 --- a/libalx/src/alx_file.c +++ b/libalx/src/alx_file.c @@ -2,26 +2,41 @@ * Copyright (C) 2017 Alejandro Colomar Andrés *
******************************************************************************/
+
+/******************************************************************************
+ ******* headers **************************************************************
+ ******************************************************************************/
+/* * * * * * * * * *
+ * * * Standard * * * * * *
+ * * * * * * * * * */
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
+/* * * * * * * * * *
+ * * * Other * * * * * * *
+ * * * * * * * * * */
#include "alx_file.h"
+/******************************************************************************
+ ******* macros ***************************************************************
+ ******************************************************************************/
# define BEGINNING "\n┌──────────────────────────────────────────────────────────────────────────────┐\n"
# define ENDING "└──────────────────────────────────────────────────────────────────────────────┘\n\n"
- # define ERR_FPTR_MSG " ¡ FILE error !"
+ # define ERR_FPTR_MSG "¡ FILE error !"
+/******************************************************************************
+ ******* main *****************************************************************
+ ******************************************************************************/
void alx_prn_file (const char *filepath)
{
-
int64_t c;
FILE *fp;
- fp = fopen(filepath, "r");
+ fp = fopen(filepath, "r");
printf(BEGINNING);
if (fp) {
while ((c = getc(fp)) != EOF){
@@ -33,5 +48,9 @@ void alx_prn_file (const char *filepath) printf(" errno = %i;\n", errno);
}
printf(ENDING);
-
}
+
+
+/******************************************************************************
+ ******* end of file **********************************************************
+ ******************************************************************************/
diff --git a/libalx/src/alx_getnum.c b/libalx/src/alx_getnum.c index 51c6347..b050f5d 100644 --- a/libalx/src/alx_getnum.c +++ b/libalx/src/alx_getnum.c @@ -2,12 +2,26 @@ * Copyright (C) 2017 Alejandro Colomar Andrés *
******************************************************************************/
+
+/******************************************************************************
+ ******* headers **************************************************************
+ ******************************************************************************/
+/* * * * * * * * * *
+ * * * Standard * * * * * *
+ * * * * * * * * * */
#include <inttypes.h>
#include <stdarg.h>
#include <stdio.h>
+/* * * * * * * * * *
+ * * * Other * * * * * * *
+ * * * * * * * * * */
#include "alx_getnum.h"
+
+/******************************************************************************
+ ******* macros ***************************************************************
+ ******************************************************************************/
# define BUFF_SIZE (1024)
# define MAX_TRIES (2)
@@ -21,11 +35,17 @@ # define ERR_FGETS_MSG "¡ fgets() error !"
+/******************************************************************************
+ ******* static functions *****************************************************
+ ******************************************************************************/
static double loop_getdbl (double m, double def, double M);
static int64_t loop_getint (double m, int64_t def, double M);
static void manage_error (int err);
+/******************************************************************************
+ ******* main *****************************************************************
+ ******************************************************************************/
/*
* Ask for a double in the range [m, M].
*
@@ -87,6 +107,9 @@ int64_t alx_getint (double m, int64_t def, double M, }
+/******************************************************************************
+ ******* static functions *****************************************************
+ ******************************************************************************/
static double loop_getdbl (double m, double def, double M)
{
int i;
@@ -157,3 +180,8 @@ static void manage_error (int err) break;
}
}
+
+
+/******************************************************************************
+ ******* end of file **********************************************************
+ ******************************************************************************/
diff --git a/libalx/src/alx_mask.c b/libalx/src/alx_mask.c index 327f292..49b4cb2 100644 --- a/libalx/src/alx_mask.c +++ b/libalx/src/alx_mask.c @@ -1,8 +1,31 @@ +/******************************************************************************
+ * NO COPYRIGHT FOR THIS FILE. FREE FOR ALL *
+ ******************************************************************************/
+
+
+/******************************************************************************
+ ******* headers **************************************************************
+ ******************************************************************************/
+/* * * * * * * * * *
+ * * * Standard * * * * * *
+ * * * * * * * * * */
#include <stdint.h>
+/* * * * * * * * * *
+ * * * Other * * * * * * *
+ * * * * * * * * * */
#include "alx_mask.h"
-uint64_t alx_maskgen (int64_t l)
+
+/******************************************************************************
+ ******* main *****************************************************************
+ ******************************************************************************/
+uint64_t alx_maskgen (int64_t l)
{
return (1LL << l);
}
+
+
+/******************************************************************************
+ ******* end of file **********************************************************
+ ******************************************************************************/
diff --git a/libalx/src/alx_math.c b/libalx/src/alx_math.c index b1063c2..1d11d59 100644 --- a/libalx/src/alx_math.c +++ b/libalx/src/alx_math.c @@ -1,11 +1,25 @@ /****************************************************************************** - * Copyright (C) 2017 Alejandro Colomar Andrés * + * NO COPYRIGHT FOR THIS FILE. FREE FOR ALL * ******************************************************************************/ + +/****************************************************************************** + ******* headers ************************************************************** + ******************************************************************************/ +/* * * * * * * * * * + * * * Standard * * * * * * + * * * * * * * * * */ #include <stdint.h> +/* * * * * * * * * * + * * * Other * * * * * * * + * * * * * * * * * */ #include "alx_math.h" + +/****************************************************************************** + ******* main ***************************************************************** + ******************************************************************************/ /* * Factorial */ @@ -19,7 +33,7 @@ double alx_fact (int64_t n) } /* - * Binomial coefficient (a b): --!!! a > b !!!-- + * Binomial coefficient (a b): --!!! a > b !!!-- * - Bugs: If !(a > b), returns 1. */ double alx_bin_coef (int64_t a, int64_t b) @@ -33,3 +47,8 @@ double alx_bin_coef (int64_t a, int64_t b) return c; } + + +/****************************************************************************** + ******* end of file ********************************************************** + ******************************************************************************/ diff --git a/libalx/src/alx_ncur.c b/libalx/src/alx_ncur.c index d0f516a..9181e5d 100644 --- a/libalx/src/alx_ncur.c +++ b/libalx/src/alx_ncur.c @@ -2,6 +2,13 @@ * Copyright (C) 2017 Alejandro Colomar Andrés *
******************************************************************************/
+
+/******************************************************************************
+ ******* headers **************************************************************
+ ******************************************************************************/
+/* * * * * * * * * *
+ * * * Standard * * * * * *
+ * * * * * * * * * */
#include <ncurses.h>
#include <inttypes.h>
#include <stdarg.h>
@@ -11,8 +18,15 @@ /* wchar_t */
#include <wchar.h>
+/* * * * * * * * * *
+ * * * Other * * * * * * *
+ * * * * * * * * * */
#include "alx_ncur.h"
+
+/******************************************************************************
+ ******* macros ***************************************************************
+ ******************************************************************************/
# define BUFF_SIZE (1024)
# define MAX_TRIES (2)
@@ -28,10 +42,13 @@ # define ERR_FPTR_MSG "¡ FILE error !"
+/******************************************************************************
+ ******* static functions *****************************************************
+ ******************************************************************************/
static void alx_ncur_prn_menu (WINDOW *win,
- int N, struct alx_optn mnu[N]);
+ int N, struct Alx_Menu mnu[N]);
static int alx_ncur_usr_sel (WINDOW *win,
- int N, struct alx_optn mnu[N]);
+ int N, struct Alx_Menu mnu[N]);
static double loop_w_getdbl (WINDOW *win,
double m, double def, double M);
static int64_t loop_w_getint (WINDOW *win,
@@ -43,6 +60,9 @@ static void loop_w_getfname (const char *fpath, char *fname, bool exist, static void manage_w_error (WINDOW *win, int err);
+/******************************************************************************
+ ******* main *****************************************************************
+ ******************************************************************************/
void alx_start_curses (void)
{
initscr();
@@ -87,7 +107,7 @@ void alx_win_del (WINDOW *win) }
int alx_menu (int h, int w,
- int N, struct alx_optn mnu[N], const char *title)
+ int N, struct Alx_Menu mnu[N], const char *title)
{
/* Dimensions */
WINDOW *win;
@@ -108,7 +128,7 @@ int alx_menu (int h, int w, }
int alx_menu_2 (WINDOW *win,
- int N, struct alx_optn mnu[N], const char *title)
+ int N, struct Alx_Menu mnu[N], const char *title)
{
/* Activate keypad, and don't echo input */
keypad(win, true);
@@ -126,7 +146,6 @@ int alx_menu_2 (WINDOW *win, return i;
}
-
double alx_w_getdbl (int w, int r, const char *title,
double m, double def, double M,
const char *format, ...)
@@ -198,7 +217,6 @@ double alx_w_getdbl (int w, int r, const char *title, return R;
}
-
int64_t alx_w_getint (int w, int r, const char *title,
double m, int64_t def, double M,
const char *format, ...)
@@ -270,7 +288,6 @@ int64_t alx_w_getint (int w, int r, const char *title, return Z;
}
-
void alx_w_getstr (char *str,
int w, int r, const char *title,
const char *format, ...)
@@ -339,7 +356,6 @@ void alx_w_getstr (char *str, va_end(args);
}
-
void alx_w_getfname (const char *fpath, char *fname, bool exist,
int w, int r, const char *title,
const char *format, ...)
@@ -408,7 +424,6 @@ void alx_w_getfname (const char *fpath, char *fname, bool exist, va_end(args);
}
-
void alx_ncur_prn_title (WINDOW *win, const char *title)
{
/* Find size of window */
@@ -426,7 +441,6 @@ void alx_ncur_prn_title (WINDOW *win, const char *title) waddch(win, ACS_LTEE);
}
-
void alx_ncur_prn_subtitle (WINDOW *win, const char *subtitle)
{
/* Find size of window */
@@ -445,13 +459,11 @@ void alx_ncur_prn_subtitle (WINDOW *win, const char *subtitle) }
-/******************************************************************************/
-/******* static functions *****************************************************/
-/******************************************************************************/
-
-
+/******************************************************************************
+ ******* static functions *****************************************************
+ ******************************************************************************/
static void alx_ncur_prn_menu (WINDOW *win,
- int N, struct alx_optn mnu[N])
+ int N, struct Alx_Menu mnu[N])
{
/* Find size of window */
int h;
@@ -467,9 +479,8 @@ static void alx_ncur_prn_menu (WINDOW *win, wrefresh(win);
}
-
static int alx_ncur_usr_sel (WINDOW *win,
- int N, struct alx_optn mnu[N])
+ int N, struct Alx_Menu mnu[N])
{
/* default item */
int i = 1;
@@ -697,3 +708,8 @@ static void manage_w_error (WINDOW *win, int err) wclear(win);
wrefresh(win);
}
+
+
+/******************************************************************************
+ ******* end of file **********************************************************
+ ******************************************************************************/
diff --git a/libalx/src/alx_seed.c b/libalx/src/alx_seed.c index 867dc47..7eda90d 100644 --- a/libalx/src/alx_seed.c +++ b/libalx/src/alx_seed.c @@ -1,8 +1,26 @@ +/******************************************************************************
+ * Robert Jenkins' 96 bit Mix Function *
+ ******************************************************************************/
+
+
+/******************************************************************************
+ ******* headers **************************************************************
+ ******************************************************************************/
+/* * * * * * * * * *
+ * * * Standard * * * * * *
+ * * * * * * * * * */
#include <stdint.h>
+/* * * * * * * * * *
+ * * * Other * * * * * * *
+ * * * * * * * * * */
#include "alx_seed.h"
-int64_t seedf (int64_t a, int64_t b, int64_t c)
+
+/******************************************************************************
+ ******* main *****************************************************************
+ ******************************************************************************/
+uint32_t seedf (uint32_t a, uint32_t b, uint32_t c)
{
a -= b + c;
a = a ^ (c >> 13);
@@ -24,3 +42,8 @@ int64_t seedf (int64_t a, int64_t b, int64_t c) c = c ^ (b >> 15);
return c;
}
+
+
+/******************************************************************************
+ ******* end of file **********************************************************
+ ******************************************************************************/
diff --git a/modules/menu/src/menu_tui.c b/modules/menu/src/menu_tui.c index c4864f3..1692490 100644 --- a/modules/menu/src/menu_tui.c +++ b/modules/menu/src/menu_tui.c @@ -71,7 +71,7 @@ void menu_tui (void) w = 34;
int N;
N = 4;
- struct alx_optn mnu[4] = {
+ struct Alx_Menu mnu[4] = {
{7, 4, "[0] Exit program"},
{2, 4, "[1] Continue"},
{4, 4, "[2] Disclaimer of warranty"},
@@ -132,15 +132,16 @@ static void menu_tui_continue (void) r = 1;
c = (80 - w) / 2;
int N;
- N = 7;
- struct alx_optn mnu[7] = {
+ /* N = 7 if DEVEL option is enabled */
+ N = 6;
+ struct Alx_Menu mnu[6] = {
{11, 4, "[0] Back"},
{2, 4, "[1] Start"},
{4, 4, "[2] Select map"},
{5, 4, "[3] Change difficulty"},
{6, 4, "[4] Change file name"},
- {7, 4, "[5] Hi scores"},
- {9, 4, "[6] DEVEL"}
+ {7, 4, "[5] Hi scores"}/*,
+ {9, 4, "[6] DEVEL"}*/
};
/* Input box */
@@ -198,11 +199,12 @@ static void menu_tui_continue (void) getchar();
alx_resume_curses();
break;
-
+/*
case 6:
alx_win_del(win);
menu_tui_devel();
break;
+*/
}
}
}
@@ -221,7 +223,7 @@ static void menu_tui_select (void) c = (80 - w) / 2;
int N;
N = 3;
- struct alx_optn mnu[3] = {
+ struct Alx_Menu mnu[3] = {
{6, 4, "[0] Back"},
{2, 4, "[1] New map"},
{4, 4, "[2] Load map"}
@@ -258,7 +260,7 @@ static void menu_tui_level (void) w = 70;
int N;
N = 5;
- struct alx_optn mnu[5] = {
+ struct Alx_Menu mnu[5] = {
{7, 4, "[0] Back"},
{2, 4, "[1] Beginner"},
{3, 4, "[2] Intermediate"},
@@ -306,7 +308,7 @@ static void menu_tui_custom (void) c = (80 - w) / 2;
int N;
N = 4;
- struct alx_optn mnu[4] = {
+ struct Alx_Menu mnu[4] = {
{8, 4, "[0] Back"},
{2, 4, "[1] Change rows:"},
{4, 4, "[2] Change columns:"},
@@ -380,7 +382,7 @@ static void menu_tui_devel (void) c = (80 - w) / 2;
int N;
N = 2;
- struct alx_optn mnu[2] = {
+ struct Alx_Menu mnu[2] = {
{5, 4, "[0] Back"},
{2, 4, "[1] Change seed (srand)"}
};
diff --git a/modules/menu/src/parser.c b/modules/menu/src/parser.c index 20906d6..10123c5 100644 --- a/modules/menu/src/parser.c +++ b/modules/menu/src/parser.c @@ -70,7 +70,7 @@ void parser (int argc, char *argv[]) {"file", required_argument, 0, 'f'},
{"iface", required_argument, 0, 'i'},
{"proportion", required_argument, 0, 'p'},
- {"rand-seed", required_argument, 0, 'r'},
+// {"rand-seed", required_argument, 0, 'r'},
{"start", required_argument, 0, 's'},
/* Null */
{0, 0, 0, 0}
@@ -121,11 +121,11 @@ void parser (int argc, char *argv[]) case 'p':
parse_proportion(optarg);
break;
-
+/* Only for DEVEL
case 'r':
parse_rand_seed(optarg);
break;
-
+*/
case 's':
parse_start(optarg);
break;
diff --git a/share/HELP.txt b/share/HELP.txt index def3501..d5a66fb 100644 --- a/share/HELP.txt +++ b/share/HELP.txt @@ -5,7 +5,6 @@ Usage: $ mine-sweeper [OPTION...] -f, --file=FILE set game file -i, --iface=IFACE set game interface -p, --proportion=PROPORTION set proportion of mines - -r, --rand-seed=SEED set seed for rand Main modes of operation: -s, --start=START_MODE set start mode @@ -21,6 +20,9 @@ Usage: $ mine-sweeper [OPTION...] -u, --usage give a short usage message -v, --version print program version + Only for DEVEL (disabled in normal release): + -r, --rand-seed=SEED set seed for rand (DEVEL; DISABLED) + MANDATORY or [OPTIONAL] arguments to long options are also mandatory or optional for any corresponding short options. diff --git a/share/README.txt b/share/README.txt index a7132c9..14a5051 100644 --- a/share/README.txt +++ b/share/README.txt @@ -18,9 +18,7 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, see the file COPYING, or write * * to the Free Software Foundation, Inc. * - ******************************************************************************/ - -/****************************************************************************** + ****************************************************************************** * Disclaimer of Warranty. * * * * THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY * @@ -42,30 +40,30 @@ I would like to see it. Thank you. COMPILE: - linux: + - linux: $ make - windows (MSYS): + - windows (MSYS): $ make OS=win INSTALL: - linux: + - linux: # make install - windows: - double click on SETUP.cmd + - windows: + run 'SETUP.cmd' as administrator RUN: - linux: + - linux: $ mine-sweeper if it doesn't work: $ /usr/local/games/mine-sweeper - windows: - double click on bin/mine-sweeper.exe + - windows: + run 'bin/mine-sweeper.exe' UNINSTALL: - linux: + - linux: # make uninstall - windows: - double click on UNINSTALL.cmd + - windows: + run 'UNINSTALL.cmd' as administrator THE PROGRAM DOES: @@ -81,18 +79,23 @@ MENU: * - Start * + Select map: * - New map - * - Load map("path + * - Load map(File: "<file>") * - .. * + Change difficulty: - * - Change rows: rows (XX) - * - Change columns: cols (XX) - * - Change proportion of mines: p (XX.XXXXXX) + * - Beginner + * - Intermediate + * - Expert + * + Custom: + * - Change rows: rows (X) + * - Change columns: cols (X) + * - Change proportion of mines: p (0.XXXXXX) + * - .. * - .. * - Change file name (File: "<file_name>") - * + DEVEL: - * - Change seed (srand) - * x Change verbose - * - .. + * - Hi scores + * N/A x DEVEL: + * N/A - Change seed (srand) + * N/A - .. * - .. * - Disclaimer of warranty * - Terms and conditions @@ -102,8 +105,6 @@ MENU: SYSTEM REQUIREMENTS: - /* * A terminal ¿? - */ To be continued... diff --git a/share/USAGE.txt b/share/USAGE.txt index 152f108..043fe24 100644 --- a/share/USAGE.txt +++ b/share/USAGE.txt @@ -2,7 +2,7 @@ [--verbose=LEVEL] [--version] [--rows=ROWS] [--columns=COLS] [--file=FILE] [--iface=IFACE] [--proportion=PROPORTION] - [--rand-seed=SEED] [--start=START_MODE] + [--start=START_MODE] Type '$ mine-sweeper --help' for a full description. |