#AdVENt of Code
1 messages ยท Page 15 of 1
added median b/c why not
and I dont even have a way to check if its causing some loop
yeah it causes infinite loop
I ran into looping on the example input
how th do I even debug this
I love visualization
uiuable???
Soon
oh did i wake you up mb
Meh I'm not really sleeping on this bus anyways
aww :c
Ok time to read and see if today is Uiuable
Lol part 1 is just ||my pipes code||
||when I did pipes I treated them as / and \ so this is actually simpler||
||also Uiua has memoization now. Everything is Uiuable...||
Unhusk me immediately
go uiua yourself
STOP POSTING ABOUT UIUA! I'M TIRED OF SEEING IT! MY FRIENDS ON TIKTOK SEND ME MEMES, ON DISCORD IT'S FUCKING MEMES! I was in a server, right? and ALL OF THE CHANNELS were just uiua stuff. I-I showed my champion underwear to my girlfriend and t-the logo I flipped it and I said "hey babe, when the underwear is uiuable HAHA DING DING DING DING DING DING DING DI DI DING" I fucking looked at a trashcan and said "THAT'S A BIT UIUABLE" I looked at my penis I think of an astronauts helmet and I go "PENIS? MORE LIKE PENUIUA" AAAAAAAAAAAAAAHGESFG
@teal mountain this u
lol i'm surprised i won todays
yea i got screwed by ||spawning on a mirror||
wtf
this looks so silly
uiua my balls
true
today weewable
:)
It's a waterfirefall
I think
We are fixing the islands
THATS NO GOOD
@real hinge you are in danger
@real hinge In file 'd16.f90', around line 16: Error reallocating to 281105609523200 bytes: Cannot allocate memory
bald about it
oh true
mantika loves
@sullen fiber is tomorrow weewuhable
i got distracted and wanted to make an animation for part 1's example
But the real question
ADVENT OF CODE TIME
Is uiua uiuable
Today's pretty cool
It's kinda just pipes v2 but still fun
PIPES V2 SOUNDS HORROR
uiua-llvm
soon
should i do recursion or loop
also do i need a stop condition or do all beams naturally come to a halt
they can loop
horror
you love
@solemn python how fast does ur part 2 run
oh u posted
oh nice its not that far from my uiua
uiua is blazingly fast?!?!?1
@hazy sinew can u help me with my d15p2
what do u need help w
today uiuable!???????
noppp
i need someone to sort my input
sort?
so i can figure out what mine is doing wrong
yea like do the
part 2
final state
i can
omg
~5s
r u uiuable??
aray based vendicated???
wowwwww
who did this
insane!
yeah its broken for StaticArray
so weird
note how that error is coming from crystal source
time to edit crystal source
lol i fixed crystal
lmaoo
the issue is that it's using the generic Object.to_json
i adapted their Array.to_json for StaticArray and it works
time to pr to crystal lang
its time
INCOMING PR
ok i think i know the issue
@tranquil vapor ||when u replace a label with a new value, does it stay in the same slot?||
yes
@tranquil vapor you will help me make crystal de
make a planner
of all the components
and I will do
seriously I will do
I'm so sane @tranquil vapor
LOVE
@tranquil vapor uiuable?
@tranquil vapor vennable?
@sullen fiber inv replaced by un??
ya
kill weewuh
unbox you love
i hate uiua
@warped dust rate https://www.uiua.org/docs/memo
actually do
UNBOX IS TWO SYMBOLS WHY
**deploy.ua: **
โ
โ โคโโ
โโ0
&cd "site"
โ
&runi {"git" "checkout" "site" "-f"}
โ
&runi {"git" "reset" "--hard" "origin/site"}
โ
&runi {"git" "rebase" "main"}
โ
&runi {"trunk" "build" "--release"}
โ
&runi {"git" "add" "--all"}
โ
&runi {"git" "commit" "--amend" "--no-edit"}
โ
&runi {"git" "push" "-f"}
โ
&runi {"git" "checkout" "main"}
GUH
emoji binding
uiua scripting so cursed
oh i was gonna make a joke about this quote they had
but its gone
uiua but MORE ()s
what if Uiua had fewer ()
also the new quotes are cursed
show
hold on they have 800mb wasm that takes half an hour to load
so good
tf?
this one is sane
oh yea those are confusing i dont understand it
cuz they look like lil faces
oh,
oihhhhhhhhhhhhhh'
wtjeqaopfds
i didnt know repeat could do negative amount
before
wild
honestly uiua's most insanely cracked thing is
the inversion stuff
un and under
its a social construct
WHAT
its literally jus getting whats defined as the inverse
un sha512 when
@warped dust what if I threw a brick at you
you will be parried
rini uiuable?
never
ur already stackmachine
uiua is fake stack lang
dirty!
be nice wh*re
part 2 was so easy
was fun tho today
pretty fast ig? i just run every ray on its own no caching
0.13s?
ye
0.5 s for my solution
ven is good
Fear my 5s p2 solution
what lang
Rust but I did it badly
Probably because of the amount of vecs I make every step
my solution skips already visited fields
ohh
insane
do u use recursion or loop
If I do then it infinite loops
I crashed my KDE because memory leaking before I realized that initially
Nop
so i just immediately kept track of visited states
^ ?
I kept track but not direction and I only did so for calculating the answer after all beams
(loop)
how
i wouldnt even know how to do today with a loop tbh
unless u use lika a queue/stack?
while beams.len() > 0 {
// step all beams
}
blame the zeeter
cause u literally just
if split
run_beam left
run_beam right
end
so easy
thats essentially what i did
And today isn't a big enough problem to cause stack overflows
even if it did it wouldnt be hard
in js u can just
setImmediate(() => recurse())
to start a new stack
- it's not deprecated in nodejs
- it's only deprecated cause of stupid name
- it's extremely useful anyway
if it is depreciated because of stupid name, what is it's renamed replacement
none
I would rather not start using something in node then accidently use it in web when I shouldn't
keep in mind that your callback doesn't run in the same tick, soo
let x = 1
setImmediate(() => x = 2)
console.log(x) // still 1 here
discord also uses it
Firefox doesn't have it so you need to polyfill
process.nextTick() also exists in nodejs, but it's slightly different, see https://nodejs.org/en/learn/asynchronous-work/understanding-setimmediate
tf
setImmediate is probably the biggest "remember what they took from us" in browserland
remember
is there a way to get import.meta.url of the file that imports the function in question?
a.ts
export function example() {
console.log(?????)
}
b.ts
import { example } from './a'
example() // => a.ts
what is ur transpiler / bundler
if u used esbuild directly u could prob make it a plugin but yea theres nothing default afaik
@delicate crane hi
hi
Allocate-object at (1) with a deferred type parameter requires either a type-spec or SOURCE tag or a MOLD tag
a mold tag
mold is so funny
it makes my gears turn
i love mold
moldy brain
yop
i will use
yeah seems possible
make onResolve keep track of the files it's resolving and make a virtual module like ~importer that just returns the last resolved file
isnt that a vite thing?
ven loves fortran
oh mb
sometimes i hate js
that module shit is so garbage
true
reuire this import that
import is so much better than uncommonjs at least
onResolve literally has importer as argument
oh even simpler then
fortran is sooo weird
A community driven standard library for (modern) Fortran
ven will read
imports are cached though ud need to make one based on importer
its just stupid

Most cursed solution
a.ts
export function example() {
console.log(`file://${new Error().stack!.split('\n')[2].split(/\(|:/)[1]}`)
}
b.ts
import { example } from './a'
example() // => a.ts
No
it works though
that won't work reliably
in what context
i would like to avoid a lines array
you need access to other lines
in aoc 17 you meet breadan eigch and reimplement javascript on the netscape browser from scratch
the day lines being out of order now is so fucked
can typescript typing people help me?
I would like to make
function asThreaded(func): func // (same inputs and ouputs as input, but with Promise<> wrapping output
function asThreaded<I, O>(func: (...args: I[]) => O): (...args: I[]) => Promise<O> {
this is close, but it turns func(a:number, b:string) into func(...args: (number|string)[])
can fortran people help me as well
id help you but im too drunk :(
function a<Args extends any[]>(func: (...args: Args) => ao): ...
function asThreaded<A extends any[], T>(f: (...a: A) => T): (...a: A) => Promise<T> {}
understandable problem
so slow
insane
ao
u didnt even type everything out
and made a typo
r u upset
cant say anything ๐
ur jealous
says the one malding rn
thanks
tonight we will feast vee
what
she will be cooked
WHO
shes already so fat
Hello Ven.
@steady fog @real hinge @solemn python @sullen fiber @hazy sinew gogogogo
@tranquil vapor
HORROR PATH FINDING

dijkstra day
I've decided to do it not immediately to spite the tryhards and also I'm lazy
swift devs never heard of split
today seems weird cause it's basically dijkstra but with extra restriction that u must turn every 3 moves
idk if that makes it easier or harder
i probably won't do today
i hate path finding
i will brute force
tf is today
tbh doesn't seem brute forceable
this makes me feel sick in the head
you're learning this shit in university buddy
this looks so stupid
dijkstra
dont call me buddy girlie.
shut up zt
I'm currently debating whether or not to do this now or tomorrow
some believe that the fate of our worlds is inflexible
i will A* in uiua tomrorow
actually the must turn every 3rd move doesn't matter much
|| basically just sort paths by length and then find the shortest path that doesn't have straight lines longer than 3 ||
no
dijkstrafasi
I can no longer continue
i love big o notation
WE HATE DJAKSTRA WE HATE DJAKSTRA WE HATE DJAKSTRA WE HATE DJAKSTRA WE HATE DJAKSTRA
i need to figure out how to make hashable point type in swift guhhh
io must make a struct
Where/how do I learn to solve problems like this
I am completely lost outside of bruteforce
I am using the wonders of wikipedia
same
d17.swift:46:15: error: value of type 'Set<Point>' has no member 'append'
KILL
have u done all of this year in swift
no
@proper totem GET OFF OF FORTNITE. SANTA NEEDS YOU
i am playing with my sister 
@proper totem 
what are you going to do when she asks you why santa didn't bring her anything this year

I am going to visit her so I will be the gift
also am going on a trip over the next week and will catch up
wrap yourself up
but finals and some other stuff ruined my head last week will recover soon uwu
aw ok, take care
I think my algorithm ran itself into the wall what
it just does 133 iterations and then dies after not being able to find minimum distance to the next point
maybe I should actually keep track of turning, maybe thats why that was introduced
i hear minky
weird creature
guh i cant think of how to do this
swift lsp using 2 gb of ram
husk
ok well I have a basic implementation of Dijkstra's algo
just need to add the parameter of not being able to go straight for too long somehow
@solemn python help me
how
ill do that later, I need to sleep
im looking at the pseudocode on wikipedia
Graph.Edges(u, v) returns the length of the edge joining
wtf
I ignored the pseudocode
o
youll have to if you want to do it in a reasonable time
nฤฑo
I hate how reading the megathread everyone is like "yeah I just copy pasted my premade dijkstra algorithm"
I found a shorter way
example is wrong
for some reason it starts at index 1
so bad
what
what
there
whats this image
sort wha
wdym
didnt sort anything
guhhh I don't understand what these numbers are from
guh whateve
guh
@real hinge
you must remember
sometimes slower is better
insallah
may the light show you the way
maybe
its definitely sleepable
i'll read it later
zz
beautiful
github copilot should not generate strings
did someone solve yet
BEN
HERP
my stupid code doesnt obey me
it finds a shorter path
(by nuking 3 step max rule)
its very kotlinable
i threw today because i used bfs instead of dijkstra (ive never used dijkstra before)
adding automod rule s very \w+able that perma bans you
IMPLEMENT DIJKSTRA
I dont want to ๐ญ
you love advent of code sweats
they have 1000 algorithms prewritten
READ DIJKSTRA WIKIPEDIA
lazy
or google rust dijkstra
you will teah me
I found a pathfinding module
but I bet using these is as much complicated as writing one
i might skip today i hate dijkstra
NO
and imo no fun in just implementing someone else's algorithm
do not skip
wrong
this is such a super uiuable moment
i bet he woke up and said "today is very dijkstrable"
he said today is very bfsable (it wasnt)
me when advent of code
@tranquil vapor aoc time
do on phone
SOVEEEE @real hinge
VEN
I figured out that its impossible
zt so lazy
guhh
my algorithm explodes for some reason
maybe I shouldnt have implemented my own algorithm
VEN
also I doubt djakstra itself would work
TEACH ME TOO
that max 3 way thingy causes the biggest issue
i just wrote this code for you @real hinge
use std::cmp::Reverse;
use std::collections::{BTreeMap, BinaryHeap};
use std::ops::Add;
type Graph<V, E> = BTreeMap<V, BTreeMap<V, E>>;
// performs Dijsktra's algorithm on the given graph from the given start
// the graph is a positively-weighted undirected graph
//
// returns a map that for each reachable vertex associates the distance and the predecessor
// since the start has no predecessor but is reachable, map[start] will be None
pub fn dijkstra<V: Ord + Copy, E: Ord + Copy + Add<Output = E>>(
graph: &Graph<V, E>,
start: V,
) -> BTreeMap<V, Option<(V, E)>> {
let mut ans = BTreeMap::new();
let mut prio = BinaryHeap::new();
// start is the special case that doesn't have a predecessor
ans.insert(start, None);
for (new, weight) in &graph[&start] {
ans.insert(*new, Some((start, *weight)));
prio.push(Reverse((*weight, *new, start)));
}
while let Some(Reverse((dist_new, new, prev))) = prio.pop() {
match ans[&new] {
// what we popped is what is in ans, we'll compute it
Some((p, d)) if p == prev && d == dist_new => {}
// otherwise it's not interesting
_ => continue,
}
for (next, weight) in &graph[&new] {
match ans.get(next) {
// if ans[next] is a lower dist than the alternative one, we do nothing
Some(Some((_, dist_next))) if dist_new + *weight >= *dist_next => {}
// if ans[next] is None then next is start and so the distance won't be changed, it won't be added again in prio
Some(None) => {}
// the new path is shorter, either new was not in ans or it was farther
_ => {
ans.insert(*next, Some((new, *weight + dist_new)));
prio.push(Reverse((*weight + dist_new, *next, new)));
}
}
}
}
ans
}
rust so ugly
I WAS ABOUT TO SEND THAT

horror
https://github.com/TheAlgorithms/Rust/blob/master/src/graph/dijkstra.rs @tranquil vapor someone stole your algorithm
I found exact same here
what if ven stole
but he told us that he wrote hinself
he lies
impossible
how
insaneee i will dmca
what about the SMB-Gmaym algo
I agree
@real hinge hi
death
that be very venable
wow
how unlucky
the reason my day 15 part 2code was working on the example
but not the input
is cus 7*1+5*2+6*3 and 6*1+7*2+5*3 are equal
so my broken slot code didnt matter
wait wdym
like in the example
in box 3
my slot code was broken, and i had the lenses in the wrong slots
but because of this, the result was still the same
LOL
Background: The man or boy test was proposed by computer scientist Donald Knuth as a means of evaluating implementations of the ALGOL 60 programming language. The aim of the test was to distinguish compilers that correctly implemented "recursion and non-local references" from those that did not.
I have written the following simple routine, wh...
LMAO WHAT IS THIS
man or boy test
What about the girl compilers and the women compilers
Or the enby compilers???
fr
guh
theres a Heap class in a swift lib
but i wanna do enitrley stdlib
im going insane
i just want a heap ๐ญ
I DID DAY 15 PART 2 @tranquil vapor
finally
the fix was literally just โ -> โโ
cus i confused indices for ordinals AGAIN
guh
@steady fog @steady fog @steady fog @steady fog
I'll try and do it on the plane if I can
I should have internet and an outlet so rustc doesnt murder my battery
why are you on a plane
i wanna cry
you love
Yeah it's dumb
oh no stars
Oh
:c
That too
i cant focus
true
going strong
LOL
TROLELD
i love stack smashing
stack smashing
ur call stack exploded
how
my array was too short
Box<()>
for some reason it doesnt read the last char
I like how p1 mentions the color but not why you need it
Funny p2 tease
Or it would be even funnier if it was irrelevant
ok im not going in sane
He should do that one day
nop
this is literally just
i dont wanna do 2d array in C
Repeat of what
oh no
pipes part 2
oh nononon i need to use malloc
and another one
im going to accidentally malloc all my ram
oh im thinking of another year
that had up down left right directions
i love C
@sullen fiber
wrong
how
sorry
@sullen fiber enum Direction { UP = 'U', DOWN = 'D', LEFT = 'L', RIGHT = 'R' };
โ:"RULD"
ruld
yea my fav order
ulgy
SAME
@real hinge hi
I did every day except 17
youre late
Will try again innmy freetime tho
i wanna get at least every part 1 done
need to figure out how to use malloc :)
Do
same
Malloc ia nothing
i will malloc all my ram
you just go sizeof(char or blabla) *8
is sizeof the bits or bytes
okay
Teach me the ways of the complex
i learned from
ive never seen that before
at first mostly this i think
so inefficient
Intro to the geometry complex numbers.
Full playlist: https://www.youtube.com/playlist?list=PLZHQObOWTQDP5CVelJJ1bNDouqrAhVPev
Home page: https://www.3blue1brown.com
Brought to you by you: https://3b1b.co/ldm-thanks
Beautiful pictorial summary by @ThuyNganVu:
https://twitter.com/ThuyNganVu/status/1258219199769440257
Errors:
- On the first sket...
@solemn python ๐ i hope this is good for u its nice and slow and visual and kinda interactive
I mostly know what a complex number is just not sure how to apply it to a 2d array in a program is what I meant
But 3b1b is very cool
i like it cus u can generate direction vectors from "RULB" index
like e^(i * index * pi/2)
not so bad in uiua โฟ:eรiรฮท
That's worse
naa
Why is the n droopy
Also what's i
its i
I mean the sqrt of -1 but in reference to the program
like sqrt(-1)
its i
it does this e^(i * index * pi/2)
but index isnt in that code cus that code assumes the index is on the stack
I can't just type i and expect rust to understand
Oh I see
if it did
It's just a some languages are good moment
you could do it
I'm sure I can find an implementation
yea rust has op overloading
its good enough
im sure u can just raise a f64 to a complex power
yea u can cus
math
it only has one solution
vap will be derefereneced
oh lol
i think i accessed memory outside of the array
itll be fine im sure
The big number lib in rust has complex but not easy 4 + 3i syntax
You have to ::new
is there like a macro
i will read your memory
Hm I guess 3i doesn't count as multiplication does it, so it would be hard to do fancy syntax without a proc macro
rare sightings of zeet typing like a normal person
can u like
And at that point just use a tuple lol
4 + 3*i
uiua
uiua very curse
not uiua
I guess that would get PEMDAS'ed so sure
How
rust
Maybe I'll mess with it later but meh,
actually it'd be i()
tuples are fine for now
@steady fog I am waiting lesson to start
do
So I can do aoc
Not if i is a unit struct
uiua would be +4*3i
guh
i cant return the array
thats guh
the yearly visualisable problem
@steady fog i^3
@rustic orchid
I thought it was sand problem st first
Last year I had lot of fun making that
@steady fog sand problem
yeee
mantika moment
I LOVE Windows 10
zeet talking like an actual person

@real hinge windows 10 user
Bad
@real hinge@real hinge
@sullen fiber today is so uiuable
oldest windows keybind
Zt will run the shortcut
i dont have on linux do you love
They should make it win + L tbh
i tried doing it using my custom grid and miserably failed for some reason
port to linux kernel
Someone tried to do actually
some beleive the fate of our worlds is inflexible
||unbounded drawing from 2019 day 3, kernels from day 3 this year, and pipes part 2 for filling||
some believe zeet cannot spell
Do you even need to ||flood fill||
||Can't you just iterate over all lines, finding difference between boundaries||
I will try the laburnth tactic
you can do ||exactly the same thing we did in day 10||
@real hinge will press ctrl shift alt win [all the keys]
Yea
will not regret
||yea thats what i did for part 2 pipes anyways||
or ||shoelace formula||
Count Left blocks blabka
||but u need corner information for edge cases iirc||
wdym
you love CSAW + o
oh
i guess true but thats so specific im scared it wont be applicable to part 2
i mean i did it using ||flood fill|| initially for some reason im now rewriting it to use my custom grid and be cool
call to undeclared function 'getline'; ISO C99 and later do not support implicit function declarationsC/C++(clang-diagnostic-implicit-function-declaration)
@real hinge
I got it just fine using ||will be doing aoc next year but not this one unfortunately||
part 2 is just ||big number!! you will never beat big number!!||
||oh ok im based then||
Tho depending on the way you do it
You need to rewrite solution
i thought we would be mixing colors but no ๐ญ
why
Optamization
it workss
(null)(null)(null)(null)(null)
(null)
||im storing my grid in a Map<Point, Char>, then iterating from minrow to mincol and doing windings count, i have now come to the realization that i was counting the path too which is why my answer was wrong||
how do i get the size of the pointer array
why is it null null null
printing non existant items
sizeof(&arr) maybe
prints only a few of the items
wait its an array of pointers?
use a different language
never
@steady fog did you do jython yet
whats jython
why are u using a pointer array
unknown size
no fucking way they made kotlin
malloc()
http://jython.org/@steady fog@steady fog
why didnt that ping me
did u do it in kotlin yet
attached to link
oh
idk
do today in kotlin
nop
fire
what did u guys use to store the grid
2d array
i probably wont
mmmmmm
double free or corruption (out)
uiua has complex nums?
yea
i am switching to uiua
LOL HUGE
no im not
YOU WILL
Telling you
YOU DONT HAVE TO SPOILER
No one can understand that
you might understand it
NO
@real hinge h
Hidrogen
you cannot spell
Your computer doesnt have much time left
You will soon write data to random memory and corrupt your OS
Char is smaller technically
you are scared
Yop
is there sscanf like thing in rust
maybe
im doing dynamically
dynamic
let grid_length: i32 = values.clone().filter(|(a,b)| *a == "R").map(|(a,b)| b.parse::<i32>().unwrap()).sum();
let grid_height: i32 = values.clone().filter(|(a,b)| *a == "D").map(|(a,b)| b.parse::<i32>().unwrap()).sum();
I am genius
ok my part 2 code needs cleaning
for some reason its not counting these 2 points
well uhh
do i HAVE to shoelace
idk




