From 290d33cf12350ff94fcf2b90447f1f6d0f4bbc57 Mon Sep 17 00:00:00 2001 From: David Bandeira Date: Sat, 9 Nov 2024 13:16:28 +0100 Subject: [PATCH] Satrtscript and helper functions --- .../helpingFunctions.cpython-311.pyc | Bin 0 -> 2229 bytes 2024/day00.py | 43 ++++++++++++++++++ 2024/day00/input.day00 | 0 2024/day00/sample.day00 | 0 2024/day01/input.day01 | 0 2024/day01/sample.day01 | 0 2024/day02/input.day02 | 0 2024/day02/sample.day02 | 0 2024/day03/input.day03 | 0 2024/day03/sample.day03 | 0 2024/day04/input.day04 | 0 2024/day04/sample.day04 | 0 2024/day05/input.day05 | 0 2024/day05/sample.day05 | 0 2024/day06/input.day06 | 0 2024/day06/sample.day06 | 0 2024/day07/input.day07 | 0 2024/day07/sample.day07 | 0 2024/day08/input.day08 | 0 2024/day08/sample.day08 | 0 2024/day09/input.day09 | 0 2024/day09/sample.day09 | 0 2024/day10/input.day10 | 0 2024/day10/sample.day10 | 0 2024/day11/input.day11 | 0 2024/day11/sample.day11 | 0 2024/day12/input.day12 | 0 2024/day12/sample.day12 | 0 2024/day13/input.day13 | 0 2024/day13/sample.day13 | 0 2024/day14/input.day14 | 0 2024/day14/sample.day14 | 0 2024/day15/input.day15 | 0 2024/day15/sample.day15 | 0 2024/day16/input.day16 | 0 2024/day16/sample.day16 | 0 2024/day17/input.day17 | 0 2024/day17/sample.day17 | 0 2024/day18/input.day18 | 0 2024/day18/sample.day18 | 0 2024/day19/input.day19 | 0 2024/day19/sample.day19 | 0 2024/day20/input.day20 | 0 2024/day20/sample.day20 | 0 2024/day21/input.day21 | 0 2024/day21/sample.day21 | 0 2024/day22/input.day22 | 0 2024/day22/sample.day22 | 0 2024/day23/input.day23 | 0 2024/day23/sample.day23 | 0 2024/day24/input.day24 | 0 2024/day24/sample.day24 | 0 2024/day25/input.day25 | 0 2024/day25/sample.day25 | 0 2024/helpingFunctions.py | 35 ++++++++++++++ initScripts/makefolders.sh | 14 ++++++ 56 files changed, 92 insertions(+) create mode 100644 2024/__pycache__/helpingFunctions.cpython-311.pyc create mode 100644 2024/day00.py create mode 100644 2024/day00/input.day00 create mode 100644 2024/day00/sample.day00 create mode 100644 2024/day01/input.day01 create mode 100644 2024/day01/sample.day01 create mode 100644 2024/day02/input.day02 create mode 100644 2024/day02/sample.day02 create mode 100644 2024/day03/input.day03 create mode 100644 2024/day03/sample.day03 create mode 100644 2024/day04/input.day04 create mode 100644 2024/day04/sample.day04 create mode 100644 2024/day05/input.day05 create mode 100644 2024/day05/sample.day05 create mode 100644 2024/day06/input.day06 create mode 100644 2024/day06/sample.day06 create mode 100644 2024/day07/input.day07 create mode 100644 2024/day07/sample.day07 create mode 100644 2024/day08/input.day08 create mode 100644 2024/day08/sample.day08 create mode 100644 2024/day09/input.day09 create mode 100644 2024/day09/sample.day09 create mode 100644 2024/day10/input.day10 create mode 100644 2024/day10/sample.day10 create mode 100644 2024/day11/input.day11 create mode 100644 2024/day11/sample.day11 create mode 100644 2024/day12/input.day12 create mode 100644 2024/day12/sample.day12 create mode 100644 2024/day13/input.day13 create mode 100644 2024/day13/sample.day13 create mode 100644 2024/day14/input.day14 create mode 100644 2024/day14/sample.day14 create mode 100644 2024/day15/input.day15 create mode 100644 2024/day15/sample.day15 create mode 100644 2024/day16/input.day16 create mode 100644 2024/day16/sample.day16 create mode 100644 2024/day17/input.day17 create mode 100644 2024/day17/sample.day17 create mode 100644 2024/day18/input.day18 create mode 100644 2024/day18/sample.day18 create mode 100644 2024/day19/input.day19 create mode 100644 2024/day19/sample.day19 create mode 100644 2024/day20/input.day20 create mode 100644 2024/day20/sample.day20 create mode 100644 2024/day21/input.day21 create mode 100644 2024/day21/sample.day21 create mode 100644 2024/day22/input.day22 create mode 100644 2024/day22/sample.day22 create mode 100644 2024/day23/input.day23 create mode 100644 2024/day23/sample.day23 create mode 100644 2024/day24/input.day24 create mode 100644 2024/day24/sample.day24 create mode 100644 2024/day25/input.day25 create mode 100644 2024/day25/sample.day25 create mode 100644 2024/helpingFunctions.py create mode 100755 initScripts/makefolders.sh diff --git a/2024/__pycache__/helpingFunctions.cpython-311.pyc b/2024/__pycache__/helpingFunctions.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f7966a6f85a382e0017f376907d5da30f8326cd4 GIT binary patch literal 2229 zcmcf?T}WG3_?(lQc+E|0YA|*KW2|K}bSCOX(OG0$C0m`7sb#COja_r1UQBMXbFVGB z6!OqP2YaxiL)nvqwWIWUnP`Mx!_T*bO2Lqq>eK*M^iEfWO;eO|w?|lD% z`5_qe6Ii$Ak}EqNLVm|feX-i%cnS{NgcDA)WU;!_Mar4VxaTfe^l&L7Ei>-DD=m7t z4=_I72C$9G0A=0|u$}t>`Z=8^apedF&!p0{rT{lDd|&`MehILkjNYL|QY5>8I=wi1 z1XNF4e(u=>qJO29nyJ5FFSsJPcg=BAFz(Yw{tu0Jn2CPYRWG6IX)0+YX93hB%Y_C|>bZ&bLQ`p|kWi6WpWKh!!>*kwcWj&YC zO*>%T&QEG9nrTd`8@7k58wT1Ji^WbxldJh$Cb^{QJfjIU2}B9^qUO`dk)e^-lB=0) zLDN@K>w4PM^16{IY}ks%LAJKM0W!sT5QphCEC3~P5biEbAB1{#a?hf}d(q*i{pIMD z{pgjapOvGdKlVHuo8B9n{&~JUHoHGIYei@GLvz*#3wxmjE3|O0?_QtvY0lC=|C^9J zeT)5B-717!V=49r-ri<^RX0Gs!>(76*BRWV*oO@Grr5{GhZ`V2fiecZDYk@sxB)Ux zotsM2taR-#9N9ANk3JaPp7?rVx33(&v>(0%E-2lW)O`#-5nIaTd8VnJu{NE0?tsHK z)FxCIRiSwxZ*1nqV`}>iHCM=H-UH4!6=5JVkSQiY0PUcWG3Q+Z(G55SNidit@>~vB zQs2&vE&qY!FQr5$VAJrq%T@*HgSsP(3r7k-;<9W@K(% z*P%pXS}sPwEeK6F1rCLVcyt)6`P&T{=z(V^NpHXb0@5D&viGar3h{X3 zhjP$5_i|Yt*p~+^dEmdV4GC)q7Lh=z6UbNKfb*|0ltt1UE}V9pA%tXtEUEzH_3Rm6Y}17KVL0DY-+e)H+}{$0#co zE$L!4_*R>5;90Fn65!sZ%)x3r#hHkJhN`1X z^upN=;A2Y5W^^@|F>wCHYMm4Ur|S<@$NS+G(`h6CKq`mFt?xgWr@e}zf%&qloW int: + score=0 + if task == 1: + global gameScoreA + score = gameScoreA + elif task == 2: + global gameScoreB + score = gameScoreB + return score + +def main(): + showSampleMode() + try: + data = open(path+'/'+filename).read().strip().split('\n') + except: + print ('no inputfile found') + print ('please check file %s on path %s' % (filename, path)) + quit() + st=time.time() + print ('Day '+aocDay+': Tasks 1: '+ str(task(1,data))+ ' executation time: ' + str(int((time.time()-st)*1000)) + 'ms') + st=time.time() + print ('Day '+aocDay+': Tasks 2: '+ str(task(2,data))+ ' executation time: ' + str(int((time.time()-st)*1000)) + 'ms') + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/2024/day00/input.day00 b/2024/day00/input.day00 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day00/sample.day00 b/2024/day00/sample.day00 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day01/input.day01 b/2024/day01/input.day01 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day01/sample.day01 b/2024/day01/sample.day01 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day02/input.day02 b/2024/day02/input.day02 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day02/sample.day02 b/2024/day02/sample.day02 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day03/input.day03 b/2024/day03/input.day03 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day03/sample.day03 b/2024/day03/sample.day03 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day04/input.day04 b/2024/day04/input.day04 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day04/sample.day04 b/2024/day04/sample.day04 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day05/input.day05 b/2024/day05/input.day05 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day05/sample.day05 b/2024/day05/sample.day05 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day06/input.day06 b/2024/day06/input.day06 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day06/sample.day06 b/2024/day06/sample.day06 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day07/input.day07 b/2024/day07/input.day07 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day07/sample.day07 b/2024/day07/sample.day07 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day08/input.day08 b/2024/day08/input.day08 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day08/sample.day08 b/2024/day08/sample.day08 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day09/input.day09 b/2024/day09/input.day09 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day09/sample.day09 b/2024/day09/sample.day09 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day10/input.day10 b/2024/day10/input.day10 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day10/sample.day10 b/2024/day10/sample.day10 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day11/input.day11 b/2024/day11/input.day11 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day11/sample.day11 b/2024/day11/sample.day11 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day12/input.day12 b/2024/day12/input.day12 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day12/sample.day12 b/2024/day12/sample.day12 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day13/input.day13 b/2024/day13/input.day13 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day13/sample.day13 b/2024/day13/sample.day13 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day14/input.day14 b/2024/day14/input.day14 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day14/sample.day14 b/2024/day14/sample.day14 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day15/input.day15 b/2024/day15/input.day15 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day15/sample.day15 b/2024/day15/sample.day15 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day16/input.day16 b/2024/day16/input.day16 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day16/sample.day16 b/2024/day16/sample.day16 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day17/input.day17 b/2024/day17/input.day17 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day17/sample.day17 b/2024/day17/sample.day17 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day18/input.day18 b/2024/day18/input.day18 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day18/sample.day18 b/2024/day18/sample.day18 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day19/input.day19 b/2024/day19/input.day19 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day19/sample.day19 b/2024/day19/sample.day19 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day20/input.day20 b/2024/day20/input.day20 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day20/sample.day20 b/2024/day20/sample.day20 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day21/input.day21 b/2024/day21/input.day21 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day21/sample.day21 b/2024/day21/sample.day21 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day22/input.day22 b/2024/day22/input.day22 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day22/sample.day22 b/2024/day22/sample.day22 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day23/input.day23 b/2024/day23/input.day23 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day23/sample.day23 b/2024/day23/sample.day23 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day24/input.day24 b/2024/day24/input.day24 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day24/sample.day24 b/2024/day24/sample.day24 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day25/input.day25 b/2024/day25/input.day25 new file mode 100644 index 0000000..e69de29 diff --git a/2024/day25/sample.day25 b/2024/day25/sample.day25 new file mode 100644 index 0000000..e69de29 diff --git a/2024/helpingFunctions.py b/2024/helpingFunctions.py new file mode 100644 index 0000000..03d1cb0 --- /dev/null +++ b/2024/helpingFunctions.py @@ -0,0 +1,35 @@ +import sys, os + +sampleMode = False + +def identifyDay(inputArgument): + twoDigitsDay = '00' + day = 0 if (inputArgument[inputArgument.rfind('/')+4:inputArgument.rfind('.')] == 'X') else inputArgument[inputArgument.rfind('/')+4:inputArgument.rfind('.')] + twoDigitsDay = str(day).zfill(2) + return twoDigitsDay + +def setSampleMode(mode:bool): + global sampleMode + if (mode) : sampleMode = True + return + +def getSampleMode(): + return sampleMode + +def showSampleMode(): + if ( getSampleMode() ): + print ("----------------------") + print ("Running im Sample Mode") + print ("----------------------") + return + +def getPath2Data(aocDay): + return './day'+str(aocDay)+'/' + +def getFilename2Data(aocDay): + dataFilename = 'sample.day'+str(aocDay) if ( sampleMode ) else 'data.day'+str(aocDay) + return dataFilename + +def readDataFile (path, filename): + data = '' + return data \ No newline at end of file diff --git a/initScripts/makefolders.sh b/initScripts/makefolders.sh new file mode 100755 index 0000000..e34798e --- /dev/null +++ b/initScripts/makefolders.sh @@ -0,0 +1,14 @@ +#!/usr/bin/bash +cd .. +read -p "Enter Year to generate:" year +if [ ! -d "${year}" ] +then + mkdir ${year} +fi +cd ${year} +for i in {00..25} +do + mkdir day${i} + touch ./day${i}/input.day${i} + touch ./day${i}/sample.day${i} +done