/aocg/ - Advent of Code 2018 General #27

Fun easy ascii art edition

Previous Thread adventofcode.com/
>Advent of Code is a series of small programming puzzles for a variety of skill levels. They are self-contained and are just as appropriate for an expert who wants to stay sharp as they are for a beginner who is just learning to code. Each puzzle calls upon different skills and has two parts that build on a theme.
You need to register with an account but you can appear as anonymous.

Private leaderboard join code:
368748-e33dcae3

People who are inactive for 5 days will be kicked, but other leaderboards can be made if desired.

Alternative leaderboard for those waiting for inactives to be kicked from the first:
208834-4a1a9383

Attached: 1544425265218.png (442x447, 258K)

Other urls found in this thread:

pastebin.com/pg9cNcQ4
pastebin.com/raw/8F8W7TBw
my.mixtape.moe/kzwlrw.gif
my.mixtape.moe/fdnrgj.txt
docs.google.com/spreadsheets/d/1pL_eA5wAoz_j-BxDV7fHtmISCSmch2CcmZaObTccNXQ/edit#gid=0
pastebin.com/L6AJwKmZ
google.com/search?q=march=native
my.mixtape.moe/khnues.txt
twitter.com/SFWRedditImages

Just a few seconds later and you could have made pic related the OP image.

Attached: 1544425847649[1].gif (300x300, 69K)

unofficial big boi input
pastebin.com/pg9cNcQ4

Post pastebins of your inputs in the next 20 minutes and ill generate a gif of it like

Finally made it into the top 50 on the g board, probably booted back into the 60's tomorrow but I've been climbing every challenge.

$ time ./day10
Seconds Elapsed: 10000000
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.##
#...............................................#..#
#.#.....#.............#............#....#.......##
##.......#.............#..........#......#......##
##.......##.............#.........#.......#.....##
##........#.............#........##.......#.....##
#.#.......#.#.......#..###...####.##.......#....##
#..#......##...#####..........######.#.....#....#..#
#...#......####....................####....#....##
#....##.....#........###################...#....##
#......#.....#########.#.###.#.######..#...#....##
#.......#...#..#.####..######.########..#..#....##
#.......##.#...#.######......#.#######..###.....##
#......#.###...#######.......#..#####...#..#....##
#.....#...#...################..##.##.#.....#...##
#.....#....#..###...#############.####.......#..##
#....#.#....######...#####...###.............#..##
#....#..##..........####.......##..........##.#.##
#...#..............#....#.....#..#............#.##
#...#.............#....#.......#..#...........#.##
#...#..........#.#....#.........#..#...........###
#...#.........#.#......#########....#..........###
#..#...........#........#....#.......#.........###
#..#..........#.........#....#.......#.........###
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#

real 0m2.740s
user 0m0.000s
sys 0m0.000s

post input so can make a gif

The input is bigboy aka

I guess this isn't good gif material.
I made the velocities too large

Reminder that if you take longer than about two and a half hours to solve this, you and the elves would literally be better off waiting for the lights in the sky to align.

REAL OFFICIAL BIG BOY INPUT

pastebin.com/raw/8F8W7TBw

>making some of the velocities zero
Fix it.

leave my mom out of this

I've been looking at my older graphics programs, and fuck, I forgot that you can just use 1d Arrays for this shit and it's way less inconvenient than 2d arrays.

But what if you all blinked and missed it, user?

now we need actual bigboi input. with lots of noise, different scales and intersection points.

make this the calendar image, without screencaps of posts

my.mixtape.moe/kzwlrw.gif

Got my part 1 time down from 2 seconds by changing how I get min and max values after each move

Attached: Screenshot from 2018-12-10 08-32-09.png (513x273, 14K)

Well that was fun.

Today was gross
import re, itertools, matplotlib.pyplot as plt
with open('input.txt') as f:
parse = lambda x: tuple(map(int, re.findall(r'-?\d+', x)))
points = [*map(parse, f.read().splitlines())]
def yield_all(points):
for i in itertools.count():
yield (i, [(a + c * i, b + d * i) for (a,b,c,d) in points])
def lowest_bounds(points):
generator = yield_all(points)
(_, state) = next(generator)
for j, trans in generator:
current = sum(map(area, zip(*trans)))
last = sum(map(area, zip(*state)))
if current > last:
return (state, j-1)
state = trans
bounds, area = lambda xs: (min(xs), max(xs)+1), lambda xs: max(xs) - min(xs)
data, index = lowest_bounds(points); xs, ys = map(bounds, zip(*data))
index, plt.imshow([
[1 if (x,y) in data else 0 for x in range(*xs)]
for y in range(*ys)], cmap="cool")

Attached: Tomoko.jpg (800x1000, 74K)

Agreed. Too many caps make the image noisy. It's hard to tell at a glance what the day was about.

It's only gross if you make it gross.
data='''
position=< 21456, 53293> velocity=
'''.strip().splitlines()

from itertools import count
import re

def p1(data):
data = [((a,b),(c,d)) for x in data for a,b,c,d in [map(int,re.findall(r"-?\d+",x))]]
for i in count():
minx,miny,maxx,maxy = (m(z[xy] for z,_ in data) for m in (min,max) for xy in (0,1))
if maxy-miny < 10:
clist = [z for z,_ in data]
for y in range(miny, maxy+1):
print(''.join(('#' if (x,y) in clist else '.') for x in range(minx,maxx+1)))
return i
data = [((x+a,y+b),(a,b)) for (x,y),(a,b) in data]

if __name__ == '__main__':
print(p1(data))

Attached: bocchi smile.png (311x291, 38K)

the daytime crew will probably make something shitty that is 90% screenshotted posts

a better bigboy:
my.mixtape.moe/fdnrgj.txt

Attached: 1544415480991.png (288x272, 101K)

>if maxy-miny < 10:
gee, knowing that, ofcourse

come on, gif guy!

> better
how? this is the same old. we need a more creative bigboi

i think the poster meant the output user

>actually spent 30 minutes on input parsing before resorting to getting a regex from last thread
Fuck. This is so ugly. Initially, I wasn't resetting the output but making a new grid each loop, which was obviously molasses-slow output. Then I guessed too high/low and missed the output a couple times, as the boundary is quite wide for the input and will print all over. And my print boundaries don't work correctly but at this point I don't care.

Attached: Screenshot_2018-12-10_00-41-01.png (674x713, 95K)

Screencaps shows what the day was about - anons can't read, anons break hardrives etc. If by "what day was about" you mean what was the puzzle then just go to fucking site and read it.

Visual convergence

Attached: out.webm (1058x720, 1.73M)

Ugly and felt like trial and error. Anyone got a solution that doesn't depend on the output being the smallest box, or on knowing the height of the text? Some user said he counted how many points were adjacent to each other, that's the only other thing I could think of.

Attached: Screenshot at 2018-12-10 19-45-41.png (545x642, 56K)

>yfw this problem is literally "every light in the sky is a vector".

nice image

Attached: 1544415016954.jpg (640x513, 70K)

>Some user said he counted how many points were adjacent to each other, that's the only other thing I could think of
I thought about this but that seemed like crazy amount of work.
You could probably look for vertical lines and if one is longer than like, 8 points, it's probably a letter

Okay, good point. Screencaps are important. I just like the images that are more clip art/GIMP than caps. Honestly, as long as it's not just screencaps, I'm fine with it. It's not like I'm the one putting in effort to make the images anyway.

from collections import defaultdict
from pprint import pprint

with open('day4/aoc-original.txt', 'r') as f:
shifts = f.readlines()

shifts.sort()

d = defaultdict(list)
c = defaultdict(list)

guards = set()

times = []
sleep_start = 0
sleep_end = 0
sleep_time = 0
current_guard = ''
for line in shifts:
if line.split(' ')[3][0] == '#':
guards.add(line.split(' ')[3])
current_guard = line.split(' ')[3]
else:
if(line.split(' ')[2][0] == 'f'):
sleep_start = int(line.split(':')[1][0:2])
else:
sleep_end = int(line.split(':')[1][0:2])
sleep_time += sleep_end - sleep_start
d[current_guard].append(sleep_time)
c[current_guard].append(int(line.split(' ')[1][3:5]))
sleep_time = 0

highest = 0
for guard in d:
total_sleep = sum(d[guard])
if total_sleep > highest:
highest = total_sleep
best_guard = guard

schedule = [['-']*59 for n in range(int(len(c[best_guard])/2))]

counter = 0
elements = 0
for time in c[best_guard]:
if counter%2==0:
sleep = time
else:
wake = time
counter+=1
if counter>=2 and counter%2==0:
for seconds in range(59):
if seconds < sleep:
schedule[elements][seconds]='-'
elif seconds >= wake:
schedule[elements][seconds]='-'
else:
schedule[elements][seconds]='X'
elements+=1

correct_minute_count = 0
best_minute = 0
time_list = [0] * 60
highest_count = 0
for date in schedule:
correct_date_count = 0
for index, time in enumerate(date):
if time == 'X':
time_list[correct_date_count] += 1
if time_list[correct_date_count] > highest_count:
highest_count = time_list[correct_date_count]
best_minute = index
correct_date_count += 1

print(best_guard)
print(best_minute)
Why is day 4 part 1 so tedious? Or am I just a retard?
pic related

Attached: 1486431272926.png (402x443, 72K)

>counted how many points were adjacent to each other,
Isn't that identically correct to finding the first smallest box? Both are assuming all points converge once initially and that this convergence is the output.

user...
import re

def day_4(lines: sorted):
lines = iter(lines)
guards = {}
minutes = [0]*60 + [0]
for s in lines:
match = re.search(r'Guard #(\d+) begins', s)
if match:
id = int(match.group(1))
if id not in guards:
guards[id] = minutes[:]
elif 'falls' in s:
m = int(s[15:17]) # minutes
s = next(lines) # assume 'wakes' is next
m2 = int(s[15:17])
guards[id][-1] += m2 - m
for i in range(m, m2):
guards[id][i] += 1

id = max(guards.keys(), key=lambda x: guards[x][-1])
part1 = id * max(range(60), key=lambda x: guards[id][x])

id = max(guards.keys(), key=lambda x: max(guards[x][:60]))
part2 = id * max(range(60), key=lambda x: guards[id][x])

return part1, part2

I don't understand the lore

Attached: advent of code.png (740x429, 437K)

>Someone solved this shit with spreadsheets
I'll never be able to figure something like this out, why even live
docs.google.com/spreadsheets/d/1pL_eA5wAoz_j-BxDV7fHtmISCSmch2CcmZaObTccNXQ/edit#gid=0

I'm thinking maybe the 1px per point scale is kinda dumb for this visualization.

Attached: AoC2018Day10.webm (1024x1024, 197K)

Don't lose your way.

They tried to kill us for stars.

Fuck lmao, somehow I didn't internalise that the velocities are constant.

If by "figure something like this out" you meant understand the solution, it's not that hard. Columns D and E are the intial positions of the stars. G and H are the velocities. J and K are equal to the positions + velocities * J3, where J3 is the number of seconds.To solve this, the person just graphed the final positions of the stars in a scatter plot and then fiddled with J3 until the graph showed the answer.
If you meant "come up with this on your own," I think this solution is by the user who does everything in spreadsheets anyways. Today's problem was also perfect for spreadsheets because it involved simple math on arrays of data and required some sort of graphical feedback to find the answer.

wrote yours in haskell
{-#LANGUAGE QuasiQuotes#-}
import Text.RE.TDFA.String

main :: IO()
main = solve.map regex.lines readFile "input.txt" >>= \(j, stars) -> do
mapM_ putStrLn $format stars; putStrLn $"^- Spent "++show j++" Seconds -^"
where regex = map read.matches.(*=~ [re|@{%int}|])

solve :: [[Int]] -> (Int, [(Int, Int)])
solve xss = head $dropWhile unbound [(i, [(x+u*i, y+v*i) | [x,y,u,v] [String]
format xvs = [[if (x,y) `elem` xvs then '@' else ' ' | x

Attached: Haskell.png (498x707, 363K)

That ascii sled looks like garbage.

what all tools do you use for your usual haskell development, i've tried getting into haskell (on windows) but the IDEs i've used have all had serious problems, all i want is some kind of intellisense so i dont have to look at documentation to know whats in a library

I'm new to python, how can I improve on my code? What am I doing incorrectly?

At first I was trying to treat each point as a line and then look for intersections.. then realised I was over thinking it and just did the smallest area

Kek.
nice one user

I rate it by how many points have an X coordinate in common with at least one other point. it worked but I think it would fail if the message contained too many letters like A, O or W

Attached: file.png (958x994, 406K)

class lightpoint:
def __init__(self,arg1, arg2, arg3, arg4):
self.x, self.y, self.vx, self.vy = arg1, arg2, arg3, arg4

def starone(listf):
count = 0
while 1:
top, bot, rig, lef = max(i.x for i in listf), min(i.x for i in listf), max(i.y for i in listf), min(i.y for i in listf)
while top > 1000:
for i in listf:
i.x += i.vx*40
i.y += i.vy*40
count += 40
print(count)
top = max(i.x for i in listf)
for i in listf:
i.x += i.vx
i.y += i.vy
count += 1
print(count)
image = np.zeros((1000,1000))
for i in listf:
try: image[i.x][i.y] = 255
except IndexError: pass
cv2.imshow("niggers", image)
cv2.waitKey()

if __name__ == '__main__':
import re
import numpy as np
import cv2
file = open("Z:\input.txt", 'r')
inputstring = file.read()
pattern = re.compile("(?:position=< *(-?\d*), *(-?\d*)> velocity=< *(-?\d*), *(-?\d*)>)")
inputlist = re.findall(pattern,inputstring)
lightlist = []
for i in inputlist:
lightlist.append(lightpoint(int(i[0]),int(i[1]),int(i[2]),int(i[3])))
starone(lightlist.copy())
the most pajeet it's ever been
the code doesn't even read correctly

Oh, right
it's image[i.y][i.x]

That's seriously convoluted. I thought my code was pretty pajeet and cramped:

#!/usr/bin/env python
from __future__ import print_function
import re

class Point(object):
def __init__(self, x, y, vx, vy):
self.x = x
self.y = y
self.vx = vx
self.vy = vy

def update(self):
self.x += self.vx
self.y += self.vy


def print_grid(grid):
coords = [None] * 4
for x, y in grid:
if coords[0] is None or x < coords[0]:
coords[0] = x
if coords[1] is None or x > coords[1]:
coords[1] = x
if coords[2] is None or y < coords[2]:
coords[2] = y
if coords[3] is None or y > coords[3]:
coords[3] = y

for y in range(coords[2], coords[3] + 1):
for x in range(coords[0], coords[1] + 1):
if (x, y) in prev_grid:
print('#', end='')
else:
print('.', end='')
print()


data = open('input').read()
points = []
for p, v in re.findall(r'position=]*)> velocity=]*)>', data):
x, y = [int(m) for m in re.findall(r'-?\d+', p)]
vx, vy = [int(m) for m in re.findall(r'-?\d+', v)]
points.append(Point(x, y, vx, vy))

secs = 0
prev_grid = None
prev_height = None
while True:
grid = set()

bottom = 10**6
top = -10**6
for p in points:
if p.y < bottom:
bottom = p.y

if p.y > top:
top = p.y

grid.add((p.x, p.y))
p.update()

height = top - bottom

if prev_height is None or height < prev_height:
prev_grid = grid
prev_height = height
secs += 1
else:
break

print_grid(prev_grid)
print(secs - 1)

well, it works.
class lightpoint:
def __init__(self,arg1, arg2, arg3, arg4):
self.x, self.y, self.vx, self.vy = arg1, arg2, arg3, arg4
def update(self, mult):
self.x += self.vx*mult
self.y += self.vy*mult

def starone(listf):
count = 0
top, bot = max(i.x for i in listf), min(i.x for i in listf)
for i in listf:
i.update(1)
count += 1
ntop, nbot = max(i.x for i in listf), min(i.x for i in listf)
while top > ntop and bot < nbot:
top, bot = ntop, nbot
for i in listf:
i.update(1)
count += 1
ntop, nbot = max(i.x for i in listf), min(i.x for i in listf)
count -= 1
for i in listf:
i.update(-1)
image = np.zeros((1000,1000))
for i in listf:
try: image[i.y][i.x] = 255
except IndexError: pass
print(count)
cv2.imshow("niggers", image)
cv2.waitKey()

if __name__ == '__main__':
import re
import numpy as np
import cv2
file = open("Z:\input.txt", 'r')
inputstring = file.read()
pattern = re.compile("(?:position=< *(-?\d*), *(-?\d*)> velocity=< *(-?\d*), *(-?\d*)>)")
inputlist = re.findall(pattern,inputstring)
lightlist = []
for i in inputlist:
lightlist.append(lightpoint(int(i[0]),int(i[1]),int(i[2]),int(i[3])))
starone(lightlist.copy())
same thing as before, but way slower

pajeet'd in ipython until I got the output. I can't believe I haven't been /filtered/ yet

Attached: out.txt.png (592x257, 4K)

What the hell was part 2 today?
I thought i misread it somehow, it was so easy, literally just had to add one print statement to output a counter variable which i already had.
Who were they trying to challenge there?

Attached: part2.gif (400x252, 200K)

No one, part two was supposed to be easy.

kinda disappointed in part 2s
>what if... elf.... marble... TIMES HUNDRED!!!
>ok... but how long... DOES LOOP RUN?!

That's a shame I enjoyed part 1
I wondered if perhaps it was just the specific way I did it that made part2 easy for me but i cant really think of how else it could be done

* (time (second-part (a:read-file-lines "10-bigboi.txt")))

Evaluation took:
111.481 seconds of real time
111.437037 seconds of total run time (111.437035 user, 0.000002 system)
[ Run times consist of 0.009 seconds GC time, and 111.429 seconds non-GC time. ]
99.96% CPU
378,328,869,426 processor cycles
276,593,184 bytes consed

10000000

Eh, not so bad for using lists of pairs of for both positions and velocities.
BIG BOI also exposed a bug, I was using MOST-POSITIVE-FIXNUM as an initial area value which was less than the BIG BOI's area.

Either my output is I I I I I I I I or I fucked something up

Attached: Screenshot from 2018-12-10 12-15-12.png (445x157, 978)

is your actual output maybe below the lower left corner?

class lightpoint:
def __init__(self,arg1, arg2, arg3, arg4):
self.x, self.y, self.vx, self.vy = arg1, arg2, arg3, arg4
self.nx, self.ny = self.x+self.vx, self.y+self.vy
def update(self, mult):
self.x += self.vx*mult
self.y += self.vy*mult
self.nx, self.ny = self.x+self.vx, self.y+self.vy

def starone(listf):
count = 1
top, bot, ntop, nbot = max(i.x for i in listf), min(i.x for i in listf), max(i.nx for i in listf), min(i.nx for i in listf)
step = max(abs((i.x)//(i.vx))//10*10 for i in listf)
while abs(top-bot) > abs(ntop-nbot):
top, bot = ntop, nbot
for i in listf:
i.update(step)
count += step
ntop, nbot = max(i.nx for i in listf), min(i.nx for i in listf)
if abs(top-bot) < abs(ntop-nbot):
for i in listf:
i.update(-(step))
count -= step
step = step//2
ntop, nbot = max(i.nx for i in listf), min(i.nx for i in listf)
image = np.zeros((1000,1000))
for i in listf:
try: image[i.y][i.x] = 255
except IndexError: pass
print(count-1)
cv2.imshow("niggers", image)
cv2.waitKey()

if __name__ == '__main__':
import re
import numpy as np
import cv2
file = open("Z:\input.txt", 'r')
inputstring = file.read()
pattern = re.compile("(?:position=< *(-?\d*), *(-?\d*)> velocity=< *(-?\d*), *(-?\d*)>)")
inputlist = re.findall(pattern,inputstring)
lightlist = []
for i in inputlist:
lightlist.append(lightpoint(int(i[0]),int(i[1]),int(i[2]),int(i[3])))
starone(lightlist.copy())

10000000
7793 function calls (7736 primitive calls) in 0.054 seconds

Attached: file.png (1017x1039, 27K)

I pretty much rewrote my JavaScript solution in Crystal
It should be working

Checklist of things that are in every AoC:

x sum and modulo problem to make brainlets happy
x character counting problem
x infinite matrix problem
x graph theory problem
- assembly interpreter
- exhaustive enumeration problem
- dijkstra
x algorithmic optimization problem

BIIIIIIIIGGG BOY INPUT IS READY!
pastebin.com/L6AJwKmZ
since the problem is quite restrictive when it comes to bigboi input, I MODIFIED the rules a little.
there are now multiple times(t>0) when a part of the stars forms a letter.
the task is to find those letters in the order (by time) they occur and concatenate them.
HAVE FUN!

class lightpoint:
def __init__(self,arg1, arg2, arg3, arg4):
self.x, self.y, self.vx, self.vy = arg1, arg2, arg3, arg4
self.nx, self.ny = self.x+self.vx, self.y+self.vy
def update(self, mult):
self.x += self.vx*mult
self.y += self.vy*mult
self.nx, self.ny = self.x+self.vx, self.y+self.vy

def starone(listf):
count, step = 1, max(abs((i.x)//(i.vx))//10 for i in listf)
odd = step%2
while 1:
top, bot, ntop, nbot = max(i.x for i in listf), min(i.x for i in listf), max(i.nx for i in listf), min(i.nx for i in listf)
while abs(top-bot) > abs(ntop-nbot):
top, bot = ntop, nbot
for i in listf:
i.update(step)
count += step
ntop, nbot = max(i.nx for i in listf), min(i.nx for i in listf)
if abs(top-bot) < abs(ntop-nbot):
top, bot = ntop, nbot
for i in listf:
i.update(-step)
count -= step
step = step//2
if step == 1: break
image = np.zeros((1000,1000))
if not odd:
for i in listf:
try: image[i.ny][i.nx] = 255
except IndexError: pass
else:
for i in listf:
try: image[i.y][i.x] = 255
except IndexError: pass
print(count-odd)
cv2.imshow("niggers", image)
profile.print_stats()
cv2.waitKey()

if __name__ == '__main__':
import re
import numpy as np
import cv2
import cProfile
profile = cProfile.Profile()
profile.enable()
file = open("Z:\input.txt", 'r')
inputstring = file.read()
pattern = re.compile("(?:position=< *(-?\d*), *(-?\d*)> velocity=< *(-?\d*), *(-?\d*)>)")
inputlist = re.findall(pattern,inputstring)
lightlist = []
for i in inputlist:
lightlist.append(lightpoint(int(i[0]),int(i[1]),int(i[2]),int(i[3])))
starone(lightlist.copy())

actually fixed it to work for all steps

>having to compute distance density and turning a perfectly fine O(log N) solution into a O(N^3) monster
fuck right off desu senpai

my shitty laptop would have never been able to handle O(N^3)

Took a break before trying to figure it out again.
The issue was how I initialized my 2D Array in Crystal on which I print the map.
Now I just gotta find out why its 3 times slower than JavaScript

Attached: Screenshot from 2018-12-10 13-37-07.png (457x228, 12K)

LOL

Attached: upsideDown.png (821x727, 163K)

state of leddit

10/10

good job, I was busy making a similar bigboy puzzle
time to get-a working

go back

>O(log N)
how'd you do that?

$ g++ -Ofast -march=native c10.cpp -std=gnu++1y && time ./a.out
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.##..
#...............................................#..#
#.#.....#.............#............#....#.......##..
##.......#.............#..........#......#......##..
##.......##.............#.........#.......#.....##..
##........#.............#........##.......#.....##..
#.#.......#.#.......#..###...####.##.......#....##..
#..#......##...#####..........######.#.....#....#..#
#...#......####....................####....#....##..
#....##.....#........###################...#....##..
#......#.....#########.#.###.#.######..#...#....##..
#.......#...#..#.####..######.########..#..#....##..
#.......##.#...#.######......#.#######..###.....##..
#......#.###...#######.......#..#####...#..#....##..
#.....#...#...################..##.##.#.....#...##..
#.....#....#..###...#############.####.......#..##..
#....#.#....######...#####...###.............#..##..
#....#..##..........####.......##..........##.#.##..
#...#..............#....#.....#..#............#.##..
#...#.............#....#.......#..#...........#.##..
#...#..........#.#....#.........#..#...........###..
#...#.........#.#......#########....#..........###..
#..#...........#........#....#.......#.........###..
#..#..........#.........#....#.......#.........###..
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#...
10000000
./a.out 0.06s user 0.00s system 96% cpu 0.067 total

I just rewrote day 10 since I wrote it in the morning with the usual method with which I was not pleased (iterate over each second and look for a point in time when the min-max height of the dataset was lowest), this time with golden selection search and it works like a charm now

>-march=native
can't find anything online about this flag

have you tried
g++ -Ofast -ffast-math c10.cpp ....

?

for any non-believers. I randomized the input and it is actually solvable.I have a "quick" (O(N**2)) algorithm.
about 5 min runtime in python.

>can't find anything online about this flag
?
google.com/search?q=march=native

I tried it, didn't help much. the reason it was so slow was how I decided whether or not the picture was found. I counted the number of stars that are on the same X coordinate as one other star. When I change it to just look for the smallest area it finishes in 2ms

if i search "-march=native" doesnt show anything for me. had to remove the first "-" to see anything

on most seach engines, if you search -something that means exclude something from results

How can I find the correct steps number without fucking everything up with the output?

by checking the smaller grid size?
by checking if some # are aligned?
help pls

when you don't know, try them all, starting with the simplest

!!!
I figured it out: check when the Y axis is

fuck, how do i print unicode chars in c++? i triew std::wcout

my.mixtape.moe/khnues.txt
have some big boi

when the bounding box gets bigger

widechars aren't unicode. print regular utf8, any half decent terminal will display it correctly (u8")

that's not really proofing, the bounding box can get smaller than the bounding box of the message's state, the edge case being all points converging to a single coordinate, in which the message's bounding box isn't the smallest bounding box the points will ever occupy
it's not a P-complete problem

Similar cadence.

Attached: de625fa8b00579f754cd61d1bd77beb8[1].gif (524x648, 207K)

Is this pajeet enough for you Jow Forums? Day 5 part 1.
import re

with open('day5/aoc.txt', 'r') as f:
polymer = f.readlines()

alphabet = ['[aA]', '[bB]', '[cC]', '[dD]', '[eE]', '[fF]', '[gG]', '[hH]',
'[iI]', '[jJ]', '[kK]', '[lL]', '[mM]', '[nN]', '[oO]', '[pP]',
'[qQ]', '[rR]', '[sS]', '[tT]', '[uU]', '[vV]', '[wW]', '[xX]',
'[yY]', '[zZ]']

complete = polymer[0]
done = False
counter = 0
while not done:
for chars in alphabet:
incomplete = re.sub((chars[1].lower() + chars[2].upper()), '',
complete)
complete = incomplete
for chars in alphabet:
incomplete = re.sub((chars[1].upper() + chars[2].lower()), '',
complete)
complete = incomplete
if counter > 10000:
done = True
counter += 1
print(len(complete))
What's a better way to do it?

>alphabet
Disgusting.

zip(string.ascii_lowercase, string.ascii_uppercase)