AdventOfCode2015/day6.py

55 lines
1.1 KiB
Python
Raw Permalink Normal View History

2022-12-18 15:50:34 +01:00
import sys
import numpy
import numpy as np
numpy.set_printoptions(threshold=sys.maxsize)
day ="6"
2022-12-18 14:56:41 +01:00
file= f"inputs/day{day}.txt"
2022-12-18 15:50:34 +01:00
line = "off 10,1 through 20,10"
2022-12-18 14:56:41 +01:00
2022-12-18 15:50:34 +01:00
def part_two(file):
#input = open(file, 'r').readline()
result = 0
2022-12-18 14:56:41 +01:00
2022-12-18 15:50:34 +01:00
print(f"Part 2: {result}")
2022-12-18 14:56:41 +01:00
2022-12-18 15:50:34 +01:00
part_two(file)
2022-12-18 14:56:41 +01:00
2022-12-18 15:50:34 +01:00
class Instruction:
2022-12-18 14:56:41 +01:00
2022-12-18 15:50:34 +01:00
def __init__(self, line):
self.startX = int(line.split(' ')[1].split(',')[0])
self.startY = int(line.split(' ')[1].split(',')[1])
self.endX = int(line.split(' ')[3].split(',')[0])
self.endY = int(line.split(' ')[3].split(',')[1])
2022-12-18 14:56:41 +01:00
2022-12-18 15:50:34 +01:00
if "toggle" in line:
self.action = "toggle"
elif "on" in line:
self.action = "on"
else:
self.action = "off"
2022-12-18 14:56:41 +01:00
2022-12-18 15:50:34 +01:00
def part_one(file):
#input = open(file, 'r').readline()
result = 0
x = np.ones((50, 50))
print(x)
print(f"Part 1: {result}")
obj = Instruction(line)
while obj.startX <= obj.endX:
while obj.startY <= obj.endY:
x[obj.startX, obj.startY] = 3
obj.startY += 1
obj.startX += 1
print(x)
2022-12-18 14:56:41 +01:00
2022-12-18 15:50:34 +01:00
part_one(line)