From 42444a89d64f358eb09fe27ff5086b812d864b56 Mon Sep 17 00:00:00 2001 From: N0VA Date: Thu, 12 Feb 2026 14:41:09 +0100 Subject: [PATCH] Add ruleset --- README.md | 2 ++ RULESET.md | 10 ++++++++++ iris_c/random.c | 4 ++++ iris_c/random.h | 1 + 4 files changed, 17 insertions(+) create mode 100644 RULESET.md diff --git a/README.md b/README.md index e6e0065..169a674 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Iris: A Space Game +# If you're here to get the ruleset, go to [./RULESET.md](./RULESET.md) + >[!WARNING] >I have no idea what I'm doing and I'm definitely not a professional diff --git a/RULESET.md b/RULESET.md new file mode 100644 index 0000000..a476690 --- /dev/null +++ b/RULESET.md @@ -0,0 +1,10 @@ +# Iris ruleset + +## Base systems + +### Randomisation + +- Iris uses xorshift32 for randomisation. +- The seed is set once at the beginning through user input. You can add more ways to set the seed, but the user has to be able to set it themselves. +- Every randomisation advances the state by 1 +- Every specified action and advances the state by the specified amount, if an amount is specified. If not, it **doesn't advance the state** diff --git a/iris_c/random.c b/iris_c/random.c index 9f0e11a..3ac84f6 100644 --- a/iris_c/random.c +++ b/iris_c/random.c @@ -22,3 +22,7 @@ uint32_t random_range(uint32_t max) { } while (r >= threshold); return r % max; } + +void advance_state(uint32_t n) { + state += n; +} diff --git a/iris_c/random.h b/iris_c/random.h index 602c23e..64c5f9e 100644 --- a/iris_c/random.h +++ b/iris_c/random.h @@ -6,5 +6,6 @@ void set_random_seed(uint32_t seed); uint32_t random_u32(void); uint32_t random_range(uint32_t max); +void advance_state(uint32_t n) #endif