AdventOfCode/2023/day15/part1.py

40 lines
683 B
Python
Raw Normal View History

2023-12-15 20:38:52 +01:00
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))