Finished 2023-12-15 p1

This commit is contained in:
Frederik Baerentsen 2023-12-15 14:38:52 -05:00
parent 57c165da42
commit 21944b2c8f

40
2023/day15/part1.py Normal file
View File

@ -0,0 +1,40 @@
import sys
import os
from pprint import pprint
import time
import math
#colors
from termcolor import colored
grid = []
input_f = ''
if len(sys.argv) == 1:
input_f = 'test'
else:
input_f = sys.argv[1]
with open(input_f) as file:
for line in file:
grid = line.rstrip().split(',')
print(grid)
values = []
current_value = 0
for i in grid:
value = 0
for j in list(i):
current_value += value
#print(j)
current_value += ord(j)
current_value *= 17
current_value %= 256
#print(current_value)
value = current_value
current_value = 0
print(value)
values.append(value)
print(sum(values))