From 41f90a4482f8f0e4db7184409999dabeb62241ce Mon Sep 17 00:00:00 2001 From: Malin Freeborn <malinfreeborn@posteo.net> Date: Tue, 3 Sep 2024 13:48:39 +0200 Subject: [PATCH] rewrite \setCycle logic --- seasons.sty | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/seasons.sty b/seasons.sty index 385f714f..e5cf1a29 100644 --- a/seasons.sty +++ b/seasons.sty @@ -12,20 +12,16 @@ \newcommand\setCycle[2]{% \setcounter{cycle}{#1}% Month - \ifnum\value{cycle}>6% - \addtocounter{cycle}{-6}% - \fi% - \ifnum\value{cycle}>3% - \addtocounter{cycle}{-3}% - \fi% \addtocounter{cycle}{-1}% \multiply\value{cycle} by 30% \addtocounter{cycle}{#2}% Day \divide\value{cycle} by 14% \addtocounter{cycle}{0}% - \ifnum\value{cycle}>5% - \setcounter{cycle}{0}% - \fi% + \whileboolexpr{% + test {\ifnumcomp{\value{cycle}}{>}{5}}% + }{% + \addtocounter{cycle}{-5}% + }% \setTemperature% } @@ -147,3 +143,5 @@ \gls{night}% \fi% } + +\setCycle{\month}{\day} -- GitLab