From 52ab86e5f55b189aea4198fe4d15a29c4d3c9d57 Mon Sep 17 00:00:00 2001 From: Physick <96335032+DegustatorPonos@users.noreply.github.com> Date: Thu, 27 Aug 2026 19:34:49 +0500 Subject: distraction scene init --- src/puzzles/puzzle.h | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/puzzles/puzzle.h') diff --git a/src/puzzles/puzzle.h b/src/puzzles/puzzle.h index acf5a17..bc43662 100644 --- a/src/puzzles/puzzle.h +++ b/src/puzzles/puzzle.h @@ -1,16 +1,18 @@ #include #include -#include "../wren_inter/wren_inter.h" #ifndef PUZZLE_H #define PUZZLE_H +/// The amount of seconds granted is calculated as (test_count * uniq(test_signatures).length) * DIFF_MODIFIER +static const size_t DIFF_MODIFIER = 30; + // This is a param that would be placed in a slot // https://wren.io/embedding/slots-and-handles.html#writing-slots typedef struct { WrenType type; // We store this value as void * to generalize. The downside of this approach - // is an extenciva allocation + // is an extencive allocation void *value; } PuzzleIO; @@ -71,8 +73,8 @@ typedef struct { enum PUZZLE_TEST_RESULT result; } SubmitionResult; -// Don't put anything in out_res, it will be overriten. -// The stdout of the VM will be there +/// Don't put anything in out_res, it will be overriten. +/// The stdout of the VM will be there SubmitionResult *SubmitSolution(Puzzle *self, char *script); void PrintPuzzle(Puzzle *puzzle); @@ -80,4 +82,15 @@ void PrintPuzzle(Puzzle *puzzle); void FreeSunmitionResult(SubmitionResult *res); void FreePuzzle(Puzzle *self); + +/// The puzzle that will pop up every now and then +typedef struct { + Puzzle *puzzle; + /// Seconds granted by the puzzle completion + size_t SecondsGranted; +} DistractionPuzzle; + +DistractionPuzzle *GetRandomDistraction(); +void FreeDistrationPuzzle(DistractionPuzzle *puzzle); + #endif // PUZZLE_H -- cgit v1.3