From 442bb01af8b9cbf88189a4d2368548f41149413f Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Sat, 12 Dec 2020 20:38:04 -0500 Subject: evolution --- sim.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sim.hpp') diff --git a/sim.hpp b/sim.hpp index 1a93566..7de7a9a 100644 --- a/sim.hpp +++ b/sim.hpp @@ -167,6 +167,7 @@ typedef struct { #define MAX_PLATFORMS 32 typedef struct { float score; // distance this setup can throw the ball + bool mutated; u32 nplatforms; Platform platforms[MAX_PLATFORMS]; } Setup; @@ -218,8 +219,9 @@ typedef struct { u32 nplatforms; Platform platforms[MAX_PLATFORMS]; -#define GENERATION_SIZE 1000 - Setup generation[GENERATION_SIZE]; +#define GENERATION_SIZE 100 +#define TOP_KEPT 10 // keep top this many setups after every generation + Setup setups[TOP_KEPT + GENERATION_SIZE]; u32 tmp_mem_used; // this is not measured in bytes, but in MaxAligns #define TMP_MEM_BYTES (4L<<20) -- cgit v1.2.3