Satrtscript and helper functions
This commit is contained in:
43
2024/day00.py
Normal file
43
2024/day00.py
Normal file
@@ -0,0 +1,43 @@
|
||||
# AOC Day Script Day XX
|
||||
# Date : 20XX.12.XX
|
||||
# Python Code
|
||||
# Developer : David Bandeira
|
||||
|
||||
import sys,time
|
||||
from helpingFunctions import *
|
||||
|
||||
setSampleMode(False)
|
||||
|
||||
gameScoreA=0
|
||||
gameScoreB=0
|
||||
|
||||
aocDay = identifyDay(sys.argv[0])
|
||||
|
||||
path = getPath2Data(aocDay)
|
||||
filename = getFilename2Data(aocDay)
|
||||
|
||||
def task(task: int,data) -> 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()
|
||||
Reference in New Issue
Block a user