55 lines
1.1 KiB
Python
55 lines
1.1 KiB
Python
import sys
|
|
|
|
import numpy
|
|
import numpy as np
|
|
numpy.set_printoptions(threshold=sys.maxsize)
|
|
day ="6"
|
|
file= f"inputs/day{day}.txt"
|
|
|
|
line = "off 10,1 through 20,10"
|
|
|
|
def part_two(file):
|
|
#input = open(file, 'r').readline()
|
|
result = 0
|
|
|
|
print(f"Part 2: {result}")
|
|
|
|
|
|
|
|
|
|
part_two(file)
|
|
|
|
|
|
class Instruction:
|
|
|
|
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])
|
|
|
|
if "toggle" in line:
|
|
self.action = "toggle"
|
|
elif "on" in line:
|
|
self.action = "on"
|
|
else:
|
|
self.action = "off"
|
|
|
|
|
|
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)
|
|
|
|
|
|
part_one(line) |