Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- 37-36-35-34-33-32-31
- 38-17-16-15-14-13-30
- 39-18-5--4--3--12-29
- 40-19-6--1--2--11-28
- 41-20-7--8--9--10-27
- 42-21-22-23-24-25-26
- 43-44-45-46-47-48-49-50
- '''
- puzzleInput = 347991
- #input 81 to generate a big enough spiral
- def rightUp(lijstInput,iInput):
- global id
- id += 1
- lijstInput.append(iInput)
- lijstInput.append("<<<-"+str(id))
- return lijstInput
- def rightDown(lijstInput,iInput):
- global id
- id += 1
- lijstInput.append(iInput)
- lijstInput.append("^^^-"+str(id))
- return lijstInput
- def leftUp(lijstInput,iInput):
- global id
- id += 1
- lijstInput.append(iInput)
- lijstInput.append("VVV-"+str(id))
- return lijstInput
- def leftDown(lijstInput,iInput):
- global id
- id += 1
- lijstInput.append(iInput)
- lijstInput.append(">>>-"+str(id))
- return lijstInput
- while True:
- lijst = [1,2,"^^^1",3,"<<<2",4,5,"VVV3",6,7,">>>4",8]
- circleID = 0
- conersToDo = 0
- skip = 3
- skipCounter = 2
- skipPlus = 1
- i = 9
- id = 4
- limiet = 1
- circleLimiet = int(input("CircleLimiet:"))
- while circleID < circleLimiet: #i < 347992
- skipCounter += 1
- if skipCounter == skip:
- if conersToDo == 1:
- lijst = leftDown(lijst,i)
- i += 1
- elif conersToDo == 2:
- lijst = leftUp(lijst,i)
- i += 1
- elif conersToDo == 3:
- lijst = rightUp(lijst,i)
- i += 1
- skipCounter = 0
- if conersToDo == 0:
- skip += skipPlus
- conersToDo = 4
- skipCounter = skipPlus-1
- skipPlus += 1
- lijst.append(i)
- i += 1
- lijst = rightDown(lijst,i)
- i += 1
- circleID += 1
- conersToDo -= 1
- print(circleID)
- else:
- lijst.append(i)
- i += 1
- if i == 11:
- skipCounter +=1
- #print("skip:",skip," skipCounter:",skipCounter," skipPlus:",skipPlus," conersToDo:",conersToDo," i:",i," circleID:",circleID,sep="")
- with open('C:\\Users\\Quinten\\OneDrive\\Documenten\\python\\advent_of_code\\dump.txt', 'w') as f:
- f.write(str(lijst))
- f.write("\n")
- f.write("Last CircleID: ")
- f.write(str(circleID))
- f.close()
Advertisement
Add Comment
Please, Sign In to add comment