Compare commits
5 Commits
45d899b36b
...
1c688d1b96
Author | SHA1 | Date |
---|---|---|
Luna Lailatova | 1c688d1b96 | 2 years ago |
Luna Lailatova | 8a3b68304b | 2 years ago |
Luna Lailatova | 7ef7fbe673 | 2 years ago |
Luna Lailatova | 501f846a63 | 2 years ago |
Luna Lailatova | fcf72efd51 | 2 years ago |
13 changed files with 3221 additions and 7 deletions
@ -0,0 +1,83 @@ |
|||||||
|
with open('input21.txt','r') as f: |
||||||
|
inp = f.read().splitlines(keepends=False) |
||||||
|
|
||||||
|
_monkeys = {} |
||||||
|
|
||||||
|
for line in inp: |
||||||
|
monkey, value = line.split(': ') |
||||||
|
_monkeys[monkey] = value |
||||||
|
|
||||||
|
Equation1 = _monkeys['root'].split()[0] |
||||||
|
Equation2 = _monkeys['root'].split()[2] |
||||||
|
print(Equation1, Equation2) |
||||||
|
|
||||||
|
n = 0 |
||||||
|
done = False |
||||||
|
|
||||||
|
monkeys = _monkeys.copy() |
||||||
|
monkeys['humn'] = 'humn' |
||||||
|
|
||||||
|
while not done: |
||||||
|
done = True |
||||||
|
for item in Equation1.split(): |
||||||
|
if item not in ['-','+','/','*','humn','(',')'] and not item.isnumeric(): |
||||||
|
if monkeys[item].isnumeric(): |
||||||
|
insert = monkeys[item] |
||||||
|
else: |
||||||
|
insert = '( ' + monkeys[item] + ' )' |
||||||
|
Equation1 = Equation1.replace(item, insert) |
||||||
|
done = False |
||||||
|
break |
||||||
|
done = False |
||||||
|
while not done: |
||||||
|
done = True |
||||||
|
for item in Equation2.split(): |
||||||
|
if item not in ['-','+','/','*','humn','(',')'] and not item.isnumeric(): |
||||||
|
if monkeys[item].isnumeric(): |
||||||
|
insert = monkeys[item] |
||||||
|
else: |
||||||
|
insert = '( ' + monkeys[item] + ' )' |
||||||
|
Equation2 = Equation2.replace(item, insert) |
||||||
|
done = False |
||||||
|
break |
||||||
|
|
||||||
|
if 'humn' in Equation1: |
||||||
|
Equation1 = Equation1.replace('humn', 'x') |
||||||
|
Equation = eval('lambda x:' + Equation1) |
||||||
|
else: |
||||||
|
Equation1 = eval('lambda x:' + Equation1) |
||||||
|
number = Equation1(1) |
||||||
|
|
||||||
|
if 'humn' in Equation2: |
||||||
|
Equation2 = Equation2.replace('humn', 'x') |
||||||
|
Equation = eval('lambda x:' + Equation2) |
||||||
|
else: |
||||||
|
Equation2 = eval('lambda x:' + Equation2) |
||||||
|
number = Equation2(1) |
||||||
|
|
||||||
|
if Equation(0) < number: |
||||||
|
increase = False |
||||||
|
else: |
||||||
|
increase = True |
||||||
|
|
||||||
|
step = 100000000 |
||||||
|
|
||||||
|
while not Equation(n) == number: |
||||||
|
print(n, Equation(n), number) |
||||||
|
if increase: |
||||||
|
if Equation(n) < number: |
||||||
|
increase = False |
||||||
|
step /= 10 |
||||||
|
else: |
||||||
|
n += step |
||||||
|
else: |
||||||
|
if Equation(n) > number: |
||||||
|
increase = True |
||||||
|
step /= 10 |
||||||
|
else: |
||||||
|
n -= step |
||||||
|
|
||||||
|
print(n) |
||||||
|
print(Equation1,'\n', Equation2) |
||||||
|
|
||||||
|
|
@ -0,0 +1,107 @@ |
|||||||
|
import re |
||||||
|
|
||||||
|
#create a class to store the map |
||||||
|
class plan: |
||||||
|
def __init__(self): |
||||||
|
self.grid = [] |
||||||
|
self.goTo = [(0, 1), (1, 0), (0, -1), (-1, 0)] |
||||||
|
|
||||||
|
def addLine(self, inputLine): |
||||||
|
inputLine = inputLine.replace(' ', '+') |
||||||
|
self.grid.append(list(inputLine)) |
||||||
|
|
||||||
|
def testPrint(self): |
||||||
|
for line in self.grid: |
||||||
|
for point in line: |
||||||
|
print(point, end = ' ') |
||||||
|
print('\n') |
||||||
|
|
||||||
|
def setStart(self): |
||||||
|
self.direction = 0 |
||||||
|
self.column = self.grid[0].index('.') |
||||||
|
self.row = 0 |
||||||
|
maxL = 0 |
||||||
|
for line in self.grid: |
||||||
|
if len(line) > maxL: |
||||||
|
maxL = len(line) |
||||||
|
for i in range(len(self.grid)): |
||||||
|
while len(self.grid[i]) < maxL: |
||||||
|
self.grid[i].append('+') |
||||||
|
|
||||||
|
def getInstruction(self, instruction): |
||||||
|
if instruction.isnumeric(): |
||||||
|
self.move(int(instruction)) |
||||||
|
if instruction.isalpha(): |
||||||
|
self.turn(instruction) |
||||||
|
|
||||||
|
def turn(self, direction): |
||||||
|
if direction == 'L': |
||||||
|
self.direction -= 1 |
||||||
|
if self.direction < 0: |
||||||
|
self.direction = 3 |
||||||
|
elif direction == 'R': |
||||||
|
self.direction = (self.direction + 1) % 4 |
||||||
|
|
||||||
|
def move(self, distance): |
||||||
|
for _ in range(distance): |
||||||
|
nextRow = self.row + self.goTo[self.direction][0] |
||||||
|
nextCol = self.column + self.goTo[self.direction][1] |
||||||
|
if nextRow < 0 or nextCol < 0 or nextRow >= len(self.grid) or nextCol >= len(self.grid[nextRow]) or self.grid[nextRow][nextCol] == '+': |
||||||
|
nextRow, nextCol = self.wrapAround(nextRow, nextCol) |
||||||
|
if self.grid[nextRow][nextCol] == '#': |
||||||
|
return |
||||||
|
self.column = nextCol |
||||||
|
self.row = nextRow |
||||||
|
|
||||||
|
def wrapAround(self, nextRow, nextCol): |
||||||
|
if self.direction == 0: |
||||||
|
for i in range(len(self.grid[nextRow])): |
||||||
|
if self.grid[nextRow][i] in ['.', '#']: |
||||||
|
nextCol = i |
||||||
|
break |
||||||
|
elif self.direction == 1: |
||||||
|
for i in range(len(self.grid)): |
||||||
|
if self.grid[i][nextCol] in ['.', '#']: |
||||||
|
nextRow = i |
||||||
|
break |
||||||
|
elif self.direction == 2: |
||||||
|
for i in range(len(self.grid[nextRow])-1, 0, -1): |
||||||
|
if self.grid[nextRow][i] in ['.', '#']: |
||||||
|
nextCol = i |
||||||
|
break |
||||||
|
elif self.direction == 3: |
||||||
|
for i in range(len(self.grid)-1, 0, -1): |
||||||
|
if self.grid[i][nextCol] in ['.', '#']: |
||||||
|
nextRow = i |
||||||
|
break |
||||||
|
return nextRow, nextCol |
||||||
|
|
||||||
|
def getPassword(self): |
||||||
|
return (self.column + 1)*4 + (self.row + 1)*1000 + self.direction |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#create an object of the map |
||||||
|
path = plan() |
||||||
|
|
||||||
|
# reading input and inserting it into the map |
||||||
|
with open('input22.txt','r') as f: |
||||||
|
inp = f.read().splitlines(keepends=False) |
||||||
|
|
||||||
|
for line in inp: |
||||||
|
if line == '': |
||||||
|
break |
||||||
|
path.addLine(line) |
||||||
|
|
||||||
|
instructionSet = inp[-1] |
||||||
|
instructionSet = re.split('(\d+)', instructionSet) |
||||||
|
|
||||||
|
path.setStart() |
||||||
|
|
||||||
|
#go through the instructions |
||||||
|
for instruction in instructionSet: |
||||||
|
path.getInstruction(instruction) |
||||||
|
|
||||||
|
#path.testPrint() |
||||||
|
print(path.column + 1, path.row + 1, path.direction, sep = '---') |
||||||
|
print(path.getPassword()) |
@ -0,0 +1,150 @@ |
|||||||
|
import re |
||||||
|
|
||||||
|
#create a class to store the map |
||||||
|
class plan: |
||||||
|
def __init__(self): |
||||||
|
self.grid = [] |
||||||
|
self.goTo = [(0, 1), (1, 0), (0, -1), (-1, 0)] |
||||||
|
|
||||||
|
def addLine(self, inputLine): |
||||||
|
inputLine = inputLine.replace(' ', '+') |
||||||
|
self.grid.append(list(inputLine)) |
||||||
|
|
||||||
|
def testPrint(self): |
||||||
|
for line in self.grid: |
||||||
|
for point in line: |
||||||
|
print(point, end = ' ') |
||||||
|
print('\n') |
||||||
|
|
||||||
|
def setStart(self): |
||||||
|
self.direction = 0 |
||||||
|
self.column = self.grid[0].index('.') |
||||||
|
self.row = 0 |
||||||
|
maxL = 0 |
||||||
|
for line in self.grid: |
||||||
|
if len(line) > maxL: |
||||||
|
maxL = len(line) |
||||||
|
for i in range(len(self.grid)): |
||||||
|
while len(self.grid[i]) < maxL: |
||||||
|
self.grid[i].append('+') |
||||||
|
|
||||||
|
def getInstruction(self, instruction): |
||||||
|
if instruction.isnumeric(): |
||||||
|
self.move(int(instruction)) |
||||||
|
if instruction.isalpha(): |
||||||
|
self.turn(instruction) |
||||||
|
|
||||||
|
def turn(self, direction): |
||||||
|
if direction == 'L': |
||||||
|
self.direction -= 1 |
||||||
|
if self.direction < 0: |
||||||
|
self.direction = 3 |
||||||
|
elif direction == 'R': |
||||||
|
self.direction = (self.direction + 1) % 4 |
||||||
|
|
||||||
|
def move(self, distance): |
||||||
|
for _ in range(distance): |
||||||
|
directionChange = self.direction |
||||||
|
nextRow = self.row + self.goTo[self.direction][0] |
||||||
|
nextCol = self.column + self.goTo[self.direction][1] |
||||||
|
if nextRow < 0 or nextCol < 0 or nextRow >= len(self.grid) or nextCol >= len(self.grid[nextRow]) or self.grid[nextRow][nextCol] == '+': |
||||||
|
nextRow, nextCol, directionChange = self.wrapAround(self.row, self.column) |
||||||
|
if self.grid[nextRow][nextCol] == '#': |
||||||
|
return |
||||||
|
self.direction = directionChange |
||||||
|
self.column = nextCol |
||||||
|
self.row = nextRow |
||||||
|
|
||||||
|
def wrapAround(self, nextRow, nextCol): |
||||||
|
if self.direction == 0: |
||||||
|
if nextRow < 50: |
||||||
|
nextCol = 99 |
||||||
|
nextRow = 149 - nextRow |
||||||
|
directionChange = 2 |
||||||
|
elif nextRow < 100: |
||||||
|
nextCol = 50 + nextRow |
||||||
|
nextRow = 49 |
||||||
|
directionChange = 3 |
||||||
|
elif nextRow < 150: |
||||||
|
nextRow = 149 - nextRow |
||||||
|
nextCol = 149 |
||||||
|
directionChange = 2 |
||||||
|
else: |
||||||
|
nextCol = nextRow - 100 |
||||||
|
nextRow = 149 |
||||||
|
directionChange = 3 |
||||||
|
elif self.direction == 1: |
||||||
|
if nextCol < 50: |
||||||
|
nextCol += 100 |
||||||
|
nextRow = 0 |
||||||
|
directionChange = 1 |
||||||
|
elif nextCol < 100: |
||||||
|
nextRow = 100 + nextCol |
||||||
|
nextCol = 49 |
||||||
|
directionChange = 2 |
||||||
|
else: |
||||||
|
nextRow = nextCol - 50 |
||||||
|
nextCol = 99 |
||||||
|
directionChange = 2 |
||||||
|
elif self.direction == 2: |
||||||
|
if nextRow < 50: |
||||||
|
nextCol = 0 |
||||||
|
nextRow = 149 - nextRow |
||||||
|
directionChange = 0 |
||||||
|
elif nextRow < 100: |
||||||
|
nextCol = nextRow - 50 |
||||||
|
nextRow = 100 |
||||||
|
directionChange = 1 |
||||||
|
elif nextRow < 150: |
||||||
|
nextRow = 49 - (nextRow - 100) |
||||||
|
nextCol = 50 |
||||||
|
directionChange = 0 |
||||||
|
else: |
||||||
|
nextCol = nextRow - 100 |
||||||
|
nextRow = 0 |
||||||
|
directionChange = 1 |
||||||
|
elif self.direction == 3: |
||||||
|
if nextCol < 50: |
||||||
|
nextRow = nextCol + 50 |
||||||
|
nextCol = 50 |
||||||
|
directionChange = 0 |
||||||
|
elif nextCol < 100: |
||||||
|
nextRow = nextCol + 100 |
||||||
|
nextCol = 0 |
||||||
|
directionChange = 0 |
||||||
|
else: |
||||||
|
nextCol = nextCol - 100 |
||||||
|
nextRow = 199 |
||||||
|
directionChange = 3 |
||||||
|
return nextRow, nextCol, directionChange |
||||||
|
|
||||||
|
def getPassword(self): |
||||||
|
return (self.column + 1)*4 + (self.row + 1)*1000 + self.direction |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#create an object of the map |
||||||
|
path = plan() |
||||||
|
|
||||||
|
# reading input and inserting it into the map |
||||||
|
with open('input22.txt','r') as f: |
||||||
|
inp = f.read().splitlines(keepends=False) |
||||||
|
|
||||||
|
for line in inp: |
||||||
|
if line == '': |
||||||
|
break |
||||||
|
path.addLine(line) |
||||||
|
|
||||||
|
instructionSet = inp[-1] |
||||||
|
instructionSet = re.split('(\d+)', instructionSet) |
||||||
|
|
||||||
|
path.setStart() |
||||||
|
|
||||||
|
#go through the instructions |
||||||
|
for instruction in instructionSet: |
||||||
|
path.getInstruction(instruction) |
||||||
|
|
||||||
|
|
||||||
|
# print solution |
||||||
|
print(path.column + 1, path.row + 1, path.direction, sep = '---') |
||||||
|
print(path.getPassword()) |
@ -0,0 +1,133 @@ |
|||||||
|
#defining a class for the map |
||||||
|
class groveMap(): |
||||||
|
def __init__(self): |
||||||
|
self.grid = [] |
||||||
|
self.checkOrder = [((-1, -1),(-1, 0),(-1, 1)),((1, -1),(1, 0),(1, 1)),((-1, -1),(0, -1),(1, -1)),((-1, 1),(0, 1),(1, 1))] |
||||||
|
self.round = 0 |
||||||
|
|
||||||
|
def addLine(self, line): |
||||||
|
self.grid.append(list(line)) |
||||||
|
|
||||||
|
def makeMove(self, elve, destination): |
||||||
|
global lastRound |
||||||
|
if destination not in self.doubles and elve != destination: |
||||||
|
self.grid[elve[0]][elve[1]] = '.' |
||||||
|
self.grid[destination[0]][destination[1]] = '#' |
||||||
|
lastRound = False |
||||||
|
|
||||||
|
def changeOrder(self): |
||||||
|
self.checkOrder.append(self.checkOrder[0]) |
||||||
|
self.checkOrder.pop(0) |
||||||
|
|
||||||
|
def findElves(self): |
||||||
|
self.round += 1 |
||||||
|
self.extendGrid() |
||||||
|
elves = {} |
||||||
|
self.destList = [] |
||||||
|
for y in range(len(self.grid)): |
||||||
|
for x in range(len(self.grid[y])): |
||||||
|
if self.grid[y][x] == '#': |
||||||
|
dest = self.goTo(y, x) |
||||||
|
elves[(y, x)] = dest |
||||||
|
self.destList.append(dest) |
||||||
|
self.findDoubles() |
||||||
|
self.changeOrder() |
||||||
|
return elves |
||||||
|
|
||||||
|
def findDoubles(self): |
||||||
|
self.doubles = [] |
||||||
|
for dest in self.destList: |
||||||
|
if self.destList.count(dest) > 1 and dest not in self.doubles: |
||||||
|
self.doubles.append(dest) |
||||||
|
|
||||||
|
def extendGrid(self): |
||||||
|
self.grid.append(['.' for _ in range(len(self.grid[0]))]) |
||||||
|
self.grid.insert(0, ['.' for _ in range(len(self.grid[-1]))]) |
||||||
|
for i in range(len(self.grid)): |
||||||
|
self.grid[i].insert(0, '.') |
||||||
|
self.grid[i].append('.') |
||||||
|
|
||||||
|
def goTo(self, y, x): |
||||||
|
count = 0 |
||||||
|
for directions in reversed(self.checkOrder): |
||||||
|
dir1, dir2, dir3 = directions |
||||||
|
if self.grid[y + dir1[0]][x + dir1[1]] == '.' and self.grid[y + dir2[0]][x + dir2[1]] == '.' and self.grid[y + dir3[0]][x + dir3[1]] == '.': |
||||||
|
count += 1 |
||||||
|
destY = y + dir2[0] |
||||||
|
destX = x + dir2[1] |
||||||
|
if count in [0, 4]: |
||||||
|
destY = y |
||||||
|
destX = x |
||||||
|
return (destY, destX) |
||||||
|
|
||||||
|
def cleanup(self): |
||||||
|
while True: |
||||||
|
if '#' in self.grid[0]: |
||||||
|
break |
||||||
|
self.grid.pop(0) |
||||||
|
while True: |
||||||
|
if '#' in self.grid[-1]: |
||||||
|
break |
||||||
|
self.grid.pop(-1) |
||||||
|
done = False |
||||||
|
while not done: |
||||||
|
for y in range(len(self.grid)): |
||||||
|
if self.grid[y][0] == '#': |
||||||
|
done = True |
||||||
|
if done: |
||||||
|
continue |
||||||
|
for y in range(len(self.grid)): |
||||||
|
self.grid[y].pop(0) |
||||||
|
done = False |
||||||
|
while not done: |
||||||
|
for y in range(len(self.grid)): |
||||||
|
if self.grid[y][-1] == '#': |
||||||
|
done = True |
||||||
|
if done: |
||||||
|
continue |
||||||
|
for y in range(len(self.grid)): |
||||||
|
self.grid[y].pop(-1) |
||||||
|
|
||||||
|
def countSolution(self): |
||||||
|
count = 0 |
||||||
|
for line in self.grid: |
||||||
|
count += line.count('.') |
||||||
|
return count |
||||||
|
|
||||||
|
def testPrint(self): |
||||||
|
for line in self.grid: |
||||||
|
for point in line: |
||||||
|
print(point, end=' ') |
||||||
|
print('\n') |
||||||
|
|
||||||
|
|
||||||
|
grove = groveMap() |
||||||
|
|
||||||
|
#read input |
||||||
|
with open('input23.txt', 'r') as f: |
||||||
|
inp = f.read().splitlines(keepends=False) |
||||||
|
|
||||||
|
for line in inp: |
||||||
|
grove.addLine(line) |
||||||
|
|
||||||
|
lastRound = False |
||||||
|
|
||||||
|
# solves part1, uncomment testprint to display state after 10 rounds |
||||||
|
for _ in range(10): |
||||||
|
elves = grove.findElves() |
||||||
|
for elve in elves: |
||||||
|
grove.makeMove(elve, elves[elve]) |
||||||
|
#grove.testPrint() |
||||||
|
grove.cleanup() |
||||||
|
print('Empty tiles after round 10: ', grove.countSolution()) |
||||||
|
|
||||||
|
#solve part2 |
||||||
|
while not lastRound: |
||||||
|
lastRound = True |
||||||
|
elves = grove.findElves() |
||||||
|
for elve in elves: |
||||||
|
grove.makeMove(elve, elves[elve]) |
||||||
|
if grove.round % 100 == 0: |
||||||
|
grove.cleanup() |
||||||
|
#print(grove.round) |
||||||
|
print('final round: ',grove.round) |
@ -0,0 +1,132 @@ |
|||||||
|
from queue import PriorityQueue |
||||||
|
|
||||||
|
qu = PriorityQueue() |
||||||
|
qu2 = PriorityQueue() |
||||||
|
currentbest = None |
||||||
|
timestamps = {} |
||||||
|
solutions = 0 |
||||||
|
visted = [] |
||||||
|
|
||||||
|
class Vortex(): |
||||||
|
def __init__(self, y, x): |
||||||
|
self.y = y |
||||||
|
self.x = x |
||||||
|
|
||||||
|
def givePosition(self, time): |
||||||
|
return self.calcPosition(time) |
||||||
|
|
||||||
|
|
||||||
|
class VortexRigth(Vortex): |
||||||
|
def calcPosition(self, time): |
||||||
|
current = (self.x + time) % width |
||||||
|
return self.y, current |
||||||
|
def __str__(self): |
||||||
|
return 'Rigth' |
||||||
|
|
||||||
|
class VortexLeft(Vortex): |
||||||
|
def calcPosition(self, time): |
||||||
|
current = self.x - time |
||||||
|
while current < 0: |
||||||
|
current = width + current |
||||||
|
return self.y, current |
||||||
|
def __str__(self): |
||||||
|
return 'Left' |
||||||
|
|
||||||
|
class VortexUp(Vortex): |
||||||
|
def calcPosition(self, time): |
||||||
|
current = self.y - time |
||||||
|
while current < 0: |
||||||
|
current = heigth + current |
||||||
|
return current, self.x |
||||||
|
def __str__(self): |
||||||
|
return 'Up' |
||||||
|
|
||||||
|
class VortexDown(Vortex): |
||||||
|
def calcPosition(self, time): |
||||||
|
current = (self.y + time) % heigth |
||||||
|
return current, self.x |
||||||
|
def __str__(self): |
||||||
|
return 'Down' |
||||||
|
|
||||||
|
def findPath(y, x, time): |
||||||
|
#print(y, x, time) |
||||||
|
global currentbest |
||||||
|
global timestamps |
||||||
|
global solutions |
||||||
|
if y == heigth - 1 and x == width - 1: |
||||||
|
solutions += 1 |
||||||
|
if currentbest is None or currentbest > time: |
||||||
|
currentbest = time |
||||||
|
#print('solution found', currentbest) |
||||||
|
return |
||||||
|
if currentbest is not None and time + ((width - 1 - x) + (heigth - 1 - y))>= currentbest - 1: |
||||||
|
return |
||||||
|
if time + 1 not in timestamps: |
||||||
|
timeList = [] |
||||||
|
for vort in vorteces: |
||||||
|
timeList.append(vort.givePosition(time + 1)) |
||||||
|
timestamps[time + 1] = timeList |
||||||
|
for nextMove in [(y, x),(y - 1, x),(y + 1, x),(y, x- 1),(y, x + 1)]: |
||||||
|
#print(timestamps[time + 1], nextMove) |
||||||
|
if nextMove not in timestamps[time + 1] and 0 <= nextMove[0] < heigth and 0 <= nextMove[1] < width: |
||||||
|
if nextMove + (time + 1,) not in visted: |
||||||
|
visted.append(nextMove + (time + 1,)) |
||||||
|
if switch: |
||||||
|
qu2.put((time + (heigth - nextMove[0]) + (width - nextMove[1]), (time + 1), -nextMove[0], -nextMove[1])) |
||||||
|
else: |
||||||
|
qu.put((-(time + 1), -((nextMove[0]+1)*(nextMove[1]+1)), -nextMove[0], -nextMove[1])) |
||||||
|
|
||||||
|
#reading input |
||||||
|
initialState = [] |
||||||
|
vorteces = [] |
||||||
|
with open('input24.txt', 'r') as f: |
||||||
|
inp = f.read().splitlines(keepends=False) |
||||||
|
|
||||||
|
for line in inp: |
||||||
|
initialState.append(list(line)) |
||||||
|
|
||||||
|
heigth = len(initialState) - 2 |
||||||
|
width = len(initialState[0]) - 2 |
||||||
|
currentbest = heigth * width |
||||||
|
|
||||||
|
for y in range(len(initialState)): |
||||||
|
for x in range(len(initialState[0])): |
||||||
|
if initialState[y][x] == '>': |
||||||
|
newVortex = VortexRigth(y - 1, x - 1) |
||||||
|
vorteces.append(newVortex) |
||||||
|
if initialState[y][x] == '<': |
||||||
|
newVortex = VortexLeft(y - 1, x - 1) |
||||||
|
vorteces.append(newVortex) |
||||||
|
if initialState[y][x] == '^': |
||||||
|
newVortex = VortexUp(y - 1, x - 1) |
||||||
|
vorteces.append(newVortex) |
||||||
|
if initialState[y][x] == 'v': |
||||||
|
newVortex = VortexDown(y - 1, x - 1) |
||||||
|
vorteces.append(newVortex) |
||||||
|
switch = False |
||||||
|
n = 0 |
||||||
|
qu.put((-1, 0, 0, 0)) |
||||||
|
while not qu.empty(): |
||||||
|
if not switch and solutions > 0: |
||||||
|
switch = True |
||||||
|
time, _, y, x = qu.get() |
||||||
|
n += 1 |
||||||
|
if n % 10000 == 0: |
||||||
|
print(n, solutions, time, currentbest) |
||||||
|
findPath(abs(y), abs(x), abs(time)) |
||||||
|
|
||||||
|
while not qu2.empty(): |
||||||
|
_, time, y, x = qu2.get() |
||||||
|
n += 1 |
||||||
|
if n % 10000 == 0: |
||||||
|
print('n=', n, 'solutions=', solutions, 'time=', time, 'currentbest=', currentbest+1, 'queue=', qu2.qsize()) |
||||||
|
findPath(abs(y), abs(x), abs(time)) |
||||||
|
|
||||||
|
print(currentbest + 1) |
||||||
|
# for vort in vorteces: |
||||||
|
# print(vort, '(', vort.y, vort.x, ')', vort.givePosition(3)) |
||||||
|
|
||||||
|
# for line in initialState: |
||||||
|
# for point in line: |
||||||
|
# print(point, end = ' ') |
||||||
|
# print('\n') |
@ -0,0 +1,181 @@ |
|||||||
|
from queue import PriorityQueue |
||||||
|
|
||||||
|
qu = PriorityQueue() |
||||||
|
qu2 = PriorityQueue() |
||||||
|
currentbest = None |
||||||
|
timestamps = {} |
||||||
|
solutions = 0 |
||||||
|
visted = [] |
||||||
|
total = 0 |
||||||
|
|
||||||
|
class Vortex(): |
||||||
|
def __init__(self, y, x): |
||||||
|
self.y = y |
||||||
|
self.x = x |
||||||
|
|
||||||
|
def givePosition(self, time): |
||||||
|
return self.calcPosition(time) |
||||||
|
|
||||||
|
|
||||||
|
class VortexRigth(Vortex): |
||||||
|
def calcPosition(self, time): |
||||||
|
current = (self.x + time) % width |
||||||
|
return self.y, current |
||||||
|
def __str__(self): |
||||||
|
return 'Rigth' |
||||||
|
|
||||||
|
class VortexLeft(Vortex): |
||||||
|
def calcPosition(self, time): |
||||||
|
current = self.x - time |
||||||
|
while current < 0: |
||||||
|
current = width + current |
||||||
|
return self.y, current |
||||||
|
def __str__(self): |
||||||
|
return 'Left' |
||||||
|
|
||||||
|
class VortexUp(Vortex): |
||||||
|
def calcPosition(self, time): |
||||||
|
current = self.y - time |
||||||
|
while current < 0: |
||||||
|
current = heigth + current |
||||||
|
return current, self.x |
||||||
|
def __str__(self): |
||||||
|
return 'Up' |
||||||
|
|
||||||
|
class VortexDown(Vortex): |
||||||
|
def calcPosition(self, time): |
||||||
|
current = (self.y + time) % heigth |
||||||
|
return current, self.x |
||||||
|
def __str__(self): |
||||||
|
return 'Down' |
||||||
|
|
||||||
|
def findPath(y, x, time): |
||||||
|
#print(y, x, time) |
||||||
|
global currentbest |
||||||
|
global timestamps |
||||||
|
global solutions |
||||||
|
if y == goal[0] and x == goal[1]: |
||||||
|
solutions += 1 |
||||||
|
if currentbest is None or currentbest > time: |
||||||
|
currentbest = time |
||||||
|
#print('solution found', currentbest) |
||||||
|
return |
||||||
|
if currentbest is not None and time + (abs(goal[1] - x) + abs(goal[0] - y))>= currentbest - 1: |
||||||
|
return |
||||||
|
if time + 1 not in timestamps: |
||||||
|
timeList = [] |
||||||
|
for vort in vorteces: |
||||||
|
timeList.append(vort.givePosition(time + 1)) |
||||||
|
timestamps[time + 1] = timeList |
||||||
|
for nextMove in [(y, x),(y - 1, x),(y + 1, x),(y, x- 1),(y, x + 1)]: |
||||||
|
#print(timestamps[time + 1], nextMove) |
||||||
|
if nextMove not in timestamps[time + 1] and ((0 <= nextMove[0] < heigth and 0 <= nextMove[1] < width) or (nextMove[0] == heigth and nextMove[1] == width - 1) or (nextMove[0] == -1 and nextMove[1] == 0)): |
||||||
|
if nextMove + (time + 1,) not in visted: |
||||||
|
visted.append(nextMove + (time + 1,)) |
||||||
|
if switch: |
||||||
|
qu2.put((time + abs(goal[0] - nextMove[0]) + abs(goal[1] - nextMove[1]), (time + 1), -nextMove[0], -nextMove[1])) |
||||||
|
else: |
||||||
|
qu.put((-(time + 1), -((nextMove[0]+1)*(nextMove[1]+1)), -nextMove[0], -nextMove[1])) |
||||||
|
|
||||||
|
#reading input |
||||||
|
initialState = [] |
||||||
|
vorteces = [] |
||||||
|
with open('input24.txt', 'r') as f: |
||||||
|
inp = f.read().splitlines(keepends=False) |
||||||
|
|
||||||
|
for line in inp: |
||||||
|
initialState.append(list(line)) |
||||||
|
|
||||||
|
heigth = len(initialState) - 2 |
||||||
|
width = len(initialState[0]) - 2 |
||||||
|
currentbest = heigth * width |
||||||
|
|
||||||
|
for y in range(len(initialState)): |
||||||
|
for x in range(len(initialState[0])): |
||||||
|
if initialState[y][x] == '>': |
||||||
|
newVortex = VortexRigth(y - 1, x - 1) |
||||||
|
vorteces.append(newVortex) |
||||||
|
if initialState[y][x] == '<': |
||||||
|
newVortex = VortexLeft(y - 1, x - 1) |
||||||
|
vorteces.append(newVortex) |
||||||
|
if initialState[y][x] == '^': |
||||||
|
newVortex = VortexUp(y - 1, x - 1) |
||||||
|
vorteces.append(newVortex) |
||||||
|
if initialState[y][x] == 'v': |
||||||
|
newVortex = VortexDown(y - 1, x - 1) |
||||||
|
vorteces.append(newVortex) |
||||||
|
switch = False |
||||||
|
n = 0 |
||||||
|
qu.put((-1, 0, 0, 0)) |
||||||
|
goal = (heigth - 1, width - 1) |
||||||
|
while not qu.empty(): |
||||||
|
if not switch and solutions > 0: |
||||||
|
switch = True |
||||||
|
time, _, y, x = qu.get() |
||||||
|
n += 1 |
||||||
|
if n % 10000 == 0: |
||||||
|
print(n, solutions, time, currentbest) |
||||||
|
findPath(abs(y), abs(x), abs(time)) |
||||||
|
|
||||||
|
while not qu2.empty(): |
||||||
|
_, time, y, x = qu2.get() |
||||||
|
n += 1 |
||||||
|
if n % 10000 == 0: |
||||||
|
print('n=', n, 'solutions=', solutions, 'time=', time, 'currentbest=', currentbest, 'queue=', qu2.qsize()) |
||||||
|
findPath(abs(y), abs(x), abs(time)) |
||||||
|
|
||||||
|
print(currentbest + 1) |
||||||
|
total = currentbest + 1 |
||||||
|
currentbest = None |
||||||
|
goal = (0, 0) |
||||||
|
solutions = 0 |
||||||
|
switch = True |
||||||
|
n = 0 |
||||||
|
qu.put((-(total), 0, heigth, width - 1)) |
||||||
|
visted = [] |
||||||
|
timestamps = {} |
||||||
|
|
||||||
|
while not qu.empty(): |
||||||
|
if not switch and solutions > 0: |
||||||
|
switch = True |
||||||
|
time, _, y, x = qu.get() |
||||||
|
n += 1 |
||||||
|
if n % 10 == 0: |
||||||
|
print(n, solutions, time, currentbest, y, x) |
||||||
|
findPath(abs(y), abs(x), abs(time)) |
||||||
|
|
||||||
|
while not qu2.empty(): |
||||||
|
_, time, y, x = qu2.get() |
||||||
|
n += 1 |
||||||
|
if n % 10000 == 0: |
||||||
|
print('n=', n, 'solutions=', solutions, 'time=', time, 'currentbest=', currentbest, 'queue=', qu2.qsize()) |
||||||
|
findPath(abs(y), abs(x), abs(time)) |
||||||
|
|
||||||
|
print(currentbest + 1) |
||||||
|
total = currentbest + 1 |
||||||
|
currentbest = None |
||||||
|
goal = (heigth -1, width - 1) |
||||||
|
solutions = 0 |
||||||
|
switch = True |
||||||
|
n = 0 |
||||||
|
qu.put((-(total), 0, -1, 0)) |
||||||
|
visted = [] |
||||||
|
timestamps = {} |
||||||
|
|
||||||
|
while not qu.empty(): |
||||||
|
if not switch and solutions > 0: |
||||||
|
switch = True |
||||||
|
time, _, y, x = qu.get() |
||||||
|
n += 1 |
||||||
|
if n % 10 == 0: |
||||||
|
print(n, solutions, time, currentbest, y, x) |
||||||
|
findPath(abs(y), abs(x), abs(time)) |
||||||
|
|
||||||
|
while not qu2.empty(): |
||||||
|
_, time, y, x = qu2.get() |
||||||
|
n += 1 |
||||||
|
if n % 10000 == 0: |
||||||
|
print('n=', n, 'solutions=', solutions, 'time=', time, 'currentbest=', currentbest, 'queue=', qu2.qsize()) |
||||||
|
findPath(abs(y), abs(x), abs(time)) |
||||||
|
|
||||||
|
print(currentbest + 1) |
@ -0,0 +1,73 @@ |
|||||||
|
converter = { |
||||||
|
'2' : 2, |
||||||
|
'1' : 1, |
||||||
|
'0' : 0, |
||||||
|
'-' : -1, |
||||||
|
'=' : -2 |
||||||
|
} |
||||||
|
|
||||||
|
def maximum(n): |
||||||
|
maxi = 0 |
||||||
|
for x in range(n + 1): |
||||||
|
maxi += 2*5**x |
||||||
|
return maxi |
||||||
|
|
||||||
|
def decimalToSnafu(num): |
||||||
|
n = 0 |
||||||
|
while True: |
||||||
|
if n == 0: |
||||||
|
if num <= 2: |
||||||
|
break |
||||||
|
n += 1 |
||||||
|
continue |
||||||
|
if num <= maximum(n): |
||||||
|
break |
||||||
|
n += 1 |
||||||
|
|
||||||
|
rest = num |
||||||
|
subtract = False |
||||||
|
if n > 0: |
||||||
|
Snafu = ['0' for x in range(n+1)] |
||||||
|
for digit in range(n, -1, -1): |
||||||
|
if rest > 0: |
||||||
|
count, rest = divmod(rest, 5**digit) |
||||||
|
if count != 2 and rest > maximum(digit - 1): |
||||||
|
count += 1 |
||||||
|
Snafu[-(digit+ 1)] = str(count) |
||||||
|
elif rest < 0: |
||||||
|
count, rest = divmod(abs(rest), 5**digit) |
||||||
|
if count != 2 and rest > maximum(digit - 1): |
||||||
|
count += 1 |
||||||
|
if count == 2: |
||||||
|
Snafu[-(digit+ 1)] = '=' |
||||||
|
elif count == 1: |
||||||
|
Snafu[-(digit+ 1)] = '-' |
||||||
|
else: |
||||||
|
Snafu[-(digit+ 1)] = '0' |
||||||
|
rest = num - SnafuToDecimal(''.join(Snafu)) |
||||||
|
return(Snafu) |
||||||
|
else: |
||||||
|
return str(num) |
||||||
|
|
||||||
|
def SnafuToDecimal(number): |
||||||
|
number = list(reversed(number)) |
||||||
|
decimal = 0 |
||||||
|
for x in range(len(number)): |
||||||
|
decimal += converter[number[x]] * 5 ** x |
||||||
|
return decimal |
||||||
|
|
||||||
|
|
||||||
|
total = 0 |
||||||
|
|
||||||
|
with open('input25.txt', 'r') as f: |
||||||
|
numbers = f.read().splitlines(keepends=False) |
||||||
|
|
||||||
|
for number in numbers: |
||||||
|
total += SnafuToDecimal(number) |
||||||
|
|
||||||
|
print(total) |
||||||
|
print(''.join(decimalToSnafu(total))) |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,7 +1,13 @@ |
|||||||
1 |
1=-0-2 |
||||||
2 |
12111 |
||||||
-3 |
2=0= |
||||||
3 |
21 |
||||||
-2 |
2=01 |
||||||
0 |
111 |
||||||
4 |
20012 |
||||||
|
112 |
||||||
|
1=-1= |
||||||
|
1-12 |
||||||
|
12 |
||||||
|
1= |
||||||
|
122 |
File diff suppressed because one or more lines are too long
@ -0,0 +1,71 @@ |
|||||||
|
...##..#.##.#..####....###..#.#..#.###.######.###...#...#.....###..##.# |
||||||
|
..##.##.######.#.###.#.......#...####..####.###...#....#.##..#.#####.## |
||||||
|
###.#.###.#.#..#.#.#..#.#.#####.#....#..###..#..#......####.#..####..## |
||||||
|
.##...#.#..#.#..#.#.#.#....#.####...#..#..##.#...##.#..#.#.#.#......### |
||||||
|
##..#.#.#.#.#.##.##.#.#...#.###.#...####...##..##..#.###.##.######..#.# |
||||||
|
#.#.#....##.###....#.......######.....##.####.#.###...###.#.#...#####.. |
||||||
|
.##.....######.#......###.###.....#####...#..#####.#.#.##....#.#....##. |
||||||
|
#...##.#....#.#.###.##.#..###.#...##...#.##.##.#..#.####.#.#.#.#.#...#. |
||||||
|
.#.#.####.#...#..####.#...##.#.#.###.##..###..#.#.#.####.#.....#.##..#. |
||||||
|
.#..#.#..##..######..#.##.##.##.#....#..#..#.##..###.#.#....###......#. |
||||||
|
.####...#.##..##....#...#####.##.###......#.......#..##.#....###....... |
||||||
|
.....#.#####...####.###..#.#.###.#..#.......#..........##.#####.#...#.. |
||||||
|
.....##..####...#.#...#.###...#..##.###......#.#..#....##...####....##. |
||||||
|
.####..#.#.####.##.##..###..#...#.#.##.#..####.....####.#.#.##...#..... |
||||||
|
..#..#..##..#.#....##..#####...#...#####....#....#..###.###.####.#...#. |
||||||
|
.###.#.#####.###...#.#.##.##..###.#.##.##.####.###..#.......##...###... |
||||||
|
####.#.#....#.###.#.##..###.#.##..##.#..##..###.####...###....#####..## |
||||||
|
.##.#####..#.#.#.#...#......###.###.#....####.....#..#......##...###... |
||||||
|
#.##.###.####.##.#..#.#...#..##..##....####.#..#..####...#.##.##.#.#..# |
||||||
|
.....##.#####..#..#.##.......#######..##.##.....#..###...#####.....##.. |
||||||
|
..#..###...####.#.#.......###...##..#.######...#....#...#..##...###...# |
||||||
|
##.#...###..#.###.##...#.#..#.#.##..#.###..#..#.####......##.#.#.####.. |
||||||
|
.###...###..#.#.##.###.##..##.#.#...###....#..##.#..###..##..####.#..#. |
||||||
|
#..#.#....#...#.###.#....##..#....##.#...#.....#..#......#.#...#.#.###. |
||||||
|
.##.#....##.##..###..#.#..####.###...##.#.##.####..#.####..#..##.##.... |
||||||
|
#.#.####..#...#.#.####....#..###..#..##....##...#.#.#.#.##.#...#.###... |
||||||
|
######..#.#####.###..##.#####.#..#.#.#.#.......##.#.#..#....##.#.#...## |
||||||
|
####....##.#..###....###.....#..#...##.##...#......#..##..#.#...####..# |
||||||
|
.##..#####.#..##..##...#.#.#..#....#.####..##.......#.##.#.###.#.#..##. |
||||||
|
.##...####..#..##..##.###....#....#..##.#.#.##......#.#.##...##.#####.. |
||||||
|
....#..###.##..##...###.##.##...#....#..####.#####.###..#.###.#.#.#..## |
||||||
|
##.#.#.#.#...#######..#.##..#.#.#.####.#.###...##.######.##.....##.#..# |
||||||
|
...###..#.##.#..#.###.....#####.##.##.#.##.#.#..##..###.#........#.#.## |
||||||
|
.#....#.#.#..####....#.###.#.#.#..##..####..#..#.#...####..#..#..#.##.. |
||||||
|
##...#.#.##.##.#.###.#.#...######.###.....####.##..######..#..##....... |
||||||
|
#.##.#.###..#....##....#.##.##...#####.##.######.....##.#...#.##..#.### |
||||||
|
#..#....##.###..####..#..##.###....#..###....########...#..##.######... |
||||||
|
##..####..##.#.###..#..####.##.##......##...###.##.###.###..#.###.##### |
||||||
|
##.#.#..#.#.###.....#.#.#..####.#.##########...##.#.#.###.#.##..#.##.#. |
||||||
|
#.##########.#.#.#..#######....#..##.#.###..##.....#.#..##..###.#.....# |
||||||
|
#.##.##..##.##.########..#.#.###.#..##...#######.######.#.#.###..#..##. |
||||||
|
...#.#..###...#.#..#.#.#.######...####.#..######.######...#.#...#.#.##. |
||||||
|
#######.####.###.....##.#..#####.#....####....##.#.##..##.##..#....#.#. |
||||||
|
.#.#.#..##.#.#....##.###.......##...#..##..####....####.#.#.#.###..##.. |
||||||
|
.#..####.#...#..#.##...#####.##..##.###......#.#..#.#.#.#..####.#.##..# |
||||||
|
.###.#.####.####.####..#..#..#.#...#...#####....##.#..#.#####.##..###.. |
||||||
|
.#..#.##..#...##.##......#.#.#......##.#..#...####...##.#.##.#.#.####.. |
||||||
|
###.#.##.#.#########..##.#..##.#.#..#.#.#...##.##.#.#...#.#####.......# |
||||||
|
..###...#..#..#.##.#.#.#.###....##..#..###.#.#.#........#.#...#..##.#.# |
||||||
|
.###....##.########..##.#.##..#.##...##.###.#...#..#..##..##...##...#.# |
||||||
|
##...#..##.#.#.##.#.#....##....###.##...###.#####..##.....##........#.# |
||||||
|
..#...#.######..#.....#.#.##.#.#.###..##...##.#..#..#.#......#.##..#... |
||||||
|
#...........#..##.####.###.#.....##....##.#.##..#...#..#####...##...#.# |
||||||
|
....#..####...##..###..#####.#..####.###..#.##..###..#.#.##.#.########. |
||||||
|
..#.#......####..#.##..#.###.##.#.###..#..#.###.#....#.##.##..#..##..#. |
||||||
|
####.##.#.###.#.#######.###.......##..####.#.....##...##...###..###..#. |
||||||
|
#....#..####.#..#.#.#.###.##........##.#..##.#..#.#..##..#...##.#...##. |
||||||
|
#...###.###.#.#..##......#..###..##.#....###...#...##..#..#####.####.#. |
||||||
|
######..####...####.##.....###..#...###.##......#..#.##.##.###.##.####. |
||||||
|
..##......#......##.####..#..###....#..#..#.....#..##.....###.####..#.# |
||||||
|
#####.###..##.....#....#...##.#.##...#.#.#.#..##.#..#...#..####...##... |
||||||
|
.##..#.#...##..##..#.###.#.#.#...#####..#.####..###..##....##.####..#.. |
||||||
|
##...#####....#.#.##.###.#.#..##.#...#.#.#.####.....#.#..##.#...#...... |
||||||
|
#......###.###.###......##.####.#.####...##..#.#.#......######.#.#.#..# |
||||||
|
..##.###.##.#.#.###.#.###.####..#..###########.##.##.#..#......##.#.### |
||||||
|
..#.###....##.....###......##.##...##.#..###..#..#.#..###....######.##. |
||||||
|
#####.#####.#.#.####...#########....#.....#...##..#.....###..###.###### |
||||||
|
.##.#####.#....#.#.#......##..##.#####...#.####.#.##..#..##..####...#.. |
||||||
|
####.##.###.#..#...##...##.#..##.....#..##..#####...........##..#..###. |
||||||
|
##.##.####.#.#.....#.#.#..#..###..###.........#..#.#..####.##........## |
||||||
|
.#.###......#...#..##.##...#..#..#.#..#.##.#.#.####..###.....#.###.#..# |
@ -0,0 +1,27 @@ |
|||||||
|
#.######################################################################################################################## |
||||||
|
#>v>^>^<<^>v^>vv<.><>v^>vvv><.>^^.<.^>^vv>v^v>.>>>.v^>>^<v<v<.<<>v^v<^>^<<v>^<<v>><>^v<.^v^^v<v>>>^<.v<^^v>^^<>><v^v^<.v.# |
||||||
|
#.>.^<.>^<v<.v>v^<^>>^v^>v>v<.v>v^v.>^><>v<>.^v><>.<v^>.v<<^..>^<<^<<>vv^<v<><v<^^>>v^><.>v<v<^>^^^^>..<<><>>^>^^<.>>v...# |
||||||
|
#<<.><<<v^vv^<>>..<<>>>^<.<v^..vv><^vv^^<^<>>v<^>.<>^>v<>^>v><v^>v^>v><>>v^>vv>v^v>.>^v<^<^><^vv<^v>v^^v^.^<>v.^<>^.>v>v<# |
||||||
|
#<^v^^><^^<^<v^^<^^<>.<^<v>v..<v^^vvv<>><v^.<>>><>v>^v>v<v.v.vv<vv<>><>><^^<vv>.>>.<>>^>v>^v.>.><<<<>^>^>v>v>^><^^v<^vv<># |
||||||
|
#>><<v<>>>^^^<v^<><<>^^^<^>^v^v<^>>v.><<<<.>>^.<v^>v>^<<^<^^>^><^<>.<>vv^<v<v^<^^<v><v^vv^><.<^.^<v^^>v><^<<^^<vv^><v^v>># |
||||||
|
#<>>^^>vvvvv.><>>^<v^>>v^^<<>^>vv^<^^^<^v<<v^<>v^v<^>>v^vv^<>^<>^<v^v^>v<.vv<<.<vvv<><<^^^v<^<v^^v<^^v>>vv^<.>v<.v^v^vv^.# |
||||||
|
#.>v>.>^<>v>>.^vvv<^<^><<^^>.<<v<v^>>v<<<^.<>>>v<v>>^>><>v<^>.v^.^v>v^<>><>><^.v><.>v<>^<^^>v>>v^^v^<<v>v<v>.v.^>^^^^<><># |
||||||
|
#>v<^^><^>.>^^^>vvv><v>>vv<v^<><^>^>^v>^><.v<^<v<>^>^.><^^<v<<><<><v^^.<v^^v^^><.>v<.<^^v^v.v>^v<^<<v<.v>..<vv<>.v<^v<>.<# |
||||||
|
#><v>.><..v>v>^^^^<.>.<^^><^>v^^^^.><<^^v.>v<^<>vv>>>><>vv>>><>>>v.^v>>^vv<^<.>^>^><<>v^.<>.v<<<.<<vv<.v^>^<v^<>><>>^v<><# |
||||||
|
#<^v<>^<<v>^..vv>^<<><^^<<>^<^^^v^^<^^v<^>><vv^<v<vv<vv.>^v.>^><>>v.>v>>^^v<>>v<<v>.v^vv^><v^<^><^><>>^v<v<.>^<^vv>>>>v^<# |
||||||
|
#<>>>^^^><v<>v<^v^v.>v^<^^>>>^^<v<^.v^>.^^><<v<>><><>v<<vv>.v<v^<^^v^<<<^.>>^v^^v.^<><<>vv^>>^<<vv<^>v>><^>^v<v<>v<<.<vv<# |
||||||
|
#<.><^.<>v<>^v.<>^>v>v>>.^>^v>>^^v>^.v.>>v>v>vv.><.^>^><.vvv<<v.>^<vv>v>^<^^v.v<<^^>v^^vv^>^.<<<<vv<><><<v>.<v<<<<^v<v>^<# |
||||||
|
#>v^v.><^>v>vv^<>.<^<<v^^^v>>><>.^.^>vvv>v.><.>v><v^vv^<v<v>><^>>vv<v>^>vv^>v.<v<>^v>^<vv>^^>^^.^<>.v<<vvv.<v<>v^v<v>^>v># |
||||||
|
#>>>^>v>^^<>>v>^vvv.>^vv^<v>.<>^vv>.<vv><..^^<<^.v<>^<<^.<>^v^^v.^>.^<^>>.>>v.<^^>v>>^<<^<<><<>>^^<^><<<>^.><<<>.vv>.>v^<# |
||||||
|
#<.>>v>^<v<.^>><^v<^vv^>v^^<^^^^.>^v<<>^>.>>>vv<.^<>v^^<v><vv.^><<..^><v^v^vv>.>v>>>^>.^^^^<>>^<<>>^vv.<^>vv..><<<.>>>^>># |
||||||
|
#<vv>vv>v<>^<^<^^v.v^>><>><<<.><<^<.>^>v^><>.<<^<^vv><<.>^v<.<>^>vvv>v^.^<<vv>^>>^>><^^<v.<..^..><.v...v^.^^<.v>>v<^<v^><# |
||||||
|
#>v^>v^>><>>v><v<v>>.vvv<<^v<^^^.v<<^>.vvv<>>^.v^v.>>>>^>><>.<.><.<^>v>^<^.><^>><<^<v^>vv^>v<>^v.v<^>.<v>v<>v.><>>><.^.^<# |
||||||
|
#.v>^v>^v<.^.>^.<^>^>>v<v>>vv<^<<^.<v^>v^^.<v^<.v^^>^<>v^^vv.v..>>vvv<vv<><<><^<vv<v^.^<^v^^vv^>>v<v<<^v<vvv>>>..>>^>.^>># |
||||||
|
#<vvv>>^>>^<vv><>^>><v<v<><>^<^<<^><^<v<.^v<^v^v><<>>>.<>^>^.>.<.>v<.><^><><<<>v^>vv^^..>vv.^>>.<>vv<^v>v>><>^>^^.>v<v<.<# |
||||||
|
#>.^^<<..v<<^>>^.^vv<>vv>v^><<v^.vv^<^>>^v<vv.>v>^>>.>^.^.v<<<.^v<>v^<^<>><><>^<v^<<>v^^v>^v.v<v^>>^..<^v<>.>..^^.>^v<v>># |
||||||
|
#><.^v<vv>>.>^<.v<>.<<^>.<>>v^v>^>^^>>^>>>v><>v>>.>>vv.<vvvvvv>v<>.^^<>>>vv^>v..<>^<^>v<>><v^>.>v.^v>.^v>.<v><.>^<<<v>^>.# |
||||||
|
#>^>>^vv>vv<^<^<<<>v>v>^^<^^<.>^<>vv<>^>v>>^^^^^<>^>>>v.v^>v<.^<>.v^<v>^^.>vvvv^>>v.^<v<^^>.^^^.^vv^<vv^v<vv<v^>^v^.^^.v># |
||||||
|
#<<^v.>>>v>^<^<.vv>vv^^^.<v^^<v^vvvv^^>^<^<<^vv.^^>.<>^.^..<>v>v^>v>><^>^^^vv<^>v>>>v>^^>^><^^>vv^>.<>^^v^<v^.><v>^^>^v>># |
||||||
|
#<vv><>.v<>.>^v^<v><^.<<<>v^.^><v>v><.<v^><><v<^.>vv<^^v^>v><.^...v>>^<<^><>><v^>><<v^vvv>^^>>.><<vv<v<^v<>>>>^v^>v<v>v<<# |
||||||
|
#<.^^>^.^^>>>^<^^^^<<.>^<<<.>>>.>^<v^v>^v.>vv^..^.>.>>.<^^^v>^^vv<<>^v.>>>>^><>><v>v^v<>^^<<v^<<.vv.>^v.v^v^.>vvv..>v.>^># |
||||||
|
########################################################################################################################.# |
@ -0,0 +1,116 @@ |
|||||||
|
1=-=2=-1000=0 |
||||||
|
11=001122 |
||||||
|
120- |
||||||
|
1-0 |
||||||
|
202-0==-2- |
||||||
|
2-1010=2-2=01 |
||||||
|
112=-2 |
||||||
|
2-0= |
||||||
|
1-=2-=-1-0--0=1=0000 |
||||||
|
1=0=0--021-0 |
||||||
|
11000101=210 |
||||||
|
21-111=2112=2==- |
||||||
|
111010-2 |
||||||
|
2=10=-101-=--0 |
||||||
|
2-=-2000012=0022= |
||||||
|
1-=11-01--2100 |
||||||
|
1=2211-2-=== |
||||||
|
2=--2-==-1 |
||||||
|
1=12---02=2 |
||||||
|
1==0=--11=01-1- |
||||||
|
121-21021 |
||||||
|
12=1001=2=-=22 |
||||||
|
1=2-212=2-0211 |
||||||
|
20----11= |
||||||
|
10=100=0=0 |
||||||
|
111 |
||||||
|
1=--011==2--212121= |
||||||
|
2=-10=210200-2-=0 |
||||||
|
1=-122=001-1 |
||||||
|
2-0=0121=-0=0 |
||||||
|
2-=20--1-=21-22=1= |
||||||
|
20011 |
||||||
|
12=1--=-0--10-0=1-= |
||||||
|
2002=100=-00- |
||||||
|
202 |
||||||
|
1=2==21- |
||||||
|
1=221--01=00-10= |
||||||
|
1--0-1= |
||||||
|
2-==11=222--- |
||||||
|
21-10-=22 |
||||||
|
1=--22-0- |
||||||
|
2-0- |
||||||
|
1-0=-2 |
||||||
|
20-02102 |
||||||
|
1=0=20----21=12=- |
||||||
|
20=111-12=21101= |
||||||
|
111=1=-2=0=--21 |
||||||
|
11- |
||||||
|
10-1=01=- |
||||||
|
1222-10 |
||||||
|
1=2-1 |
||||||
|
20 |
||||||
|
101==12-1-0 |
||||||
|
1-=22=--=22=1=22 |
||||||
|
1200-010-10=021 |
||||||
|
1=2-10=-02--=- |
||||||
|
12-0=000=0 |
||||||
|
1==10=00===1-- |
||||||
|
2-1=-=1===1=-0=--- |
||||||
|
1=11=120 |
||||||
|
2===002010=-=0 |
||||||
|
1==00212=01-002=221 |
||||||
|
10020221===- |
||||||
|
1--01=-=0-20-101-=- |
||||||
|
112=101 |
||||||
|
10- |
||||||
|
1220=1 |
||||||
|
2= |
||||||
|
1=1120=--0 |
||||||
|
11-21200= |
||||||
|
2==011-10-0==0=0= |
||||||
|
12-=102 |
||||||
|
100-022 |
||||||
|
1=1 |
||||||
|
201-0--=- |
||||||
|
2-02 |
||||||
|
21=11=00020 |
||||||
|
12=20- |
||||||
|
1101=00-1 |
||||||
|
1=0=-11--=-010-==1 |
||||||
|
1-2-0=00=-=220=11- |
||||||
|
2-2 |
||||||
|
12-2 |
||||||
|
12=10=2-= |
||||||
|
20222110-10002 |
||||||
|
1002=0 |
||||||
|
12=11-=012 |
||||||
|
1== |
||||||
|
1=00-01 |
||||||
|
110101222-020--111 |
||||||
|
2-0 |
||||||
|
1-12=1 |
||||||
|
222-10-12=00 |
||||||
|
11=1=1 |
||||||
|
10=2-00-121-2-=2 |
||||||
|
1---22-1-0=00-1220 |
||||||
|
2-=2210=-==2=010= |
||||||
|
12201-111-220 |
||||||
|
2=122=022=22=12-1 |
||||||
|
211===2=020 |
||||||
|
121-2-0-=0==2=1 |
||||||
|
1-0221200-21100- |
||||||
|
10 |
||||||
|
1-11 |
||||||
|
2===2=-2- |
||||||
|
1-0-2021-21== |
||||||
|
1==-00-=2-21===1200 |
||||||
|
22 |
||||||
|
1222=20=120=1- |
||||||
|
11=120001012==01-1 |
||||||
|
2=-1--00 |
||||||
|
10==121--221 |
||||||
|
1=2100102=20012 |
||||||
|
2==1- |
||||||
|
1- |
||||||
|
10-2--0 |
Loading…
Reference in new issue