commit fcfd46fba8b4060bc7b1cc43f42807395e65e3d0
Author: rani <clagv.randomgames@gmail.com>
Date: Sun Aug 13 12:32:55 2023 +0000
diff --git a/bejeweled/README.md b/bejeweled/README.md
index e92d5b1..cb68527 100644
--- a/bejeweled/README.md
+++ b/bejeweled/README.md
@@ -113 +114 @@ Tile match game. Click on a tile to select it, click on another tile directly ad
* `MATCH_DELAY`: The delay after a successful match
* `BAD_MATCH_DELAY`: The delay after a non successful match
* `GRID`: Either `true` or `false`, whether or not to show the grid outline
+* `SEED`: Seed value for PRNG
diff --git a/bejeweled/bejeweled.c b/bejeweled/bejeweled.c
index a1aecde..7d624a2 100644
--- a/bejeweled/bejeweled.c
+++ b/bejeweled/bejeweled.c
@@ -19 +19 @@
-#include <time.h>
#include <stdlib.h>
#include <ncurses.h>
#include <stdbool.h>
+/* BEGIN CONFIG */
#ifndef HIGHLIGHT
#define HIGHLIGHT false
#endif /* HIGHLIGHT */
@@ -326 +3212 @@
#define GRID true
#endif /* GRID */
+#ifndef SEED
+#include <time.h>
+#define SEED time(NULL)
+#endif /* SEED */
+/* END CONFIG */
+
#define SQUARE_C '#'
#define CIRCLE_C 'O'
#define TRIANGLE_C 'A'
@@ -2307 +2367 @@ void sort(struct coord s[], int n) {
int main(void) {
- srand(time(NULL));
+ srand(SEED);
initscr();
noecho();
diff --git a/flappy/README.md b/flappy/README.md
index 9ab5ea0..b2387a6 100644
--- a/flappy/README.md
+++ b/flappy/README.md
@@ -13 +17 @@
# Flappy
-Flappy bird. Space to flap, otherwise fall. Avoid the pipes. No configuration possible.
+Flappy bird. Space to flap, otherwise fall. Avoid the pipes.
+
+## Config
+
+* `SEED`: Seed value for PRNG
diff --git a/flappy/flappy.c b/flappy/flappy.c
index f0ba557..8c89f57 100644
--- a/flappy/flappy.c
+++ b/flappy/flappy.c
@@ -19 +116 @@
-#include <time.h>
#include <stdlib.h>
#include <ncurses.h>
#include <stdbool.h>
+/* BEGIN CONFIG */
+#ifndef SEED
+#include <time.h>
+#define SEED time(NULL)
+#endif /* SEED */
+/* END CONFIG */
+
+
#define X COLS
#define Y LINES
@@ -457 +527 @@ int rrand(int hi, int lo) {
int main() {
- srand(time(NULL));
+ srand(SEED);
initscr();
noecho();
diff --git a/mines/README.md b/mines/README.md
index b845462..14b4203 100644
--- a/mines/README.md
+++ b/mines/README.md
@@ -83 +84 @@ Minesweeper. Left click reveals a square, right click flags it. `f` toggles "fla
* `X`: Minefield width
* `MINES`: Number of mines
* `HIGHLIGHT_SQUARES`: Either `true` or `false`. Enables or disables highlighting of number squares
+* `SEED`: Seed value for PRNG
diff --git a/mines/mines.c b/mines/mines.c
index c8e52a0..edeac3e 100644
--- a/mines/mines.c
+++ b/mines/mines.c
@@ -16 +15 @@
#include <stdlib.h>
#include <stdbool.h>
-#include <time.h>
#include <ncurses.h>
#include <string.h>
@@ -236 +2211 @@
// reverse the highlighting of squares
#define HIGHLIGHT_SQUARES true
#endif /* HIGHLIGHT_SQUARES */
+
+#ifndef SEED
+#include <time.h>
+#define SEED time(NULL)
+#endif /* SEED */
/* END CONFIG */
@@ -2097 +2137 @@ int nlen(int n) {
int main(void) {
- srand(time(NULL));
+ srand(SEED);
initscr();
noecho();
diff --git a/snake/README.md b/snake/README.md
index b2b84db..676112d 100644
--- a/snake/README.md
+++ b/snake/README.md
@@ -93 +94 @@ Classic snake game. Move with arrow keys, eat the apples to grow longer. Space t
* `X`: Width of play area
* `DELAY`: The delay, in milliseconds, between each movement
* `WALLS`: Either `true` or `false`. If `true`, enable solid walls (game over on crash). Otherwise, allow snake to teleport through walls.
+* `SEED`: Seed value for PRNG
diff --git a/snake/snake.c b/snake/snake.c
index 3c050d9..58672d4 100644
--- a/snake/snake.c
+++ b/snake/snake.c
@@ -14 +13 @@
-#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <ncurses.h>
@@ -246 +2311 @@
// enable or disable solid walls
#define WALLS false
#endif /* WALLS */
+
+#ifndef SEED
+#include <time.h>
+#define SEED time(NULL)
+#endif /* SEED */
/* END CONFIG */
@@ -957 +997 @@ int nlen(int n) {
int main() {
- srand(time(NULL));
+ srand(SEED);
initscr();
noecho();