#AdVENt of Code
1 messages · Page 13 of 1
Not to mention having to calculate the actual value of those, bc the formula only deals with the count
||binomial coeff|| in uiua is so pain
nah i think ur overestimating
for my input given that i have a way to iterate through them it reduces my iteration count from 5.5mil to 32k
||naive 2^k vs nCr counts||
putting this here in case i need it again later cus it was a pain to write
||```
Naive 2^k count
/+ ⁿ:2 ⊐≡/+ =@? ≡⊡ 0 Table
nCr count
Fac ← /×+1⇡
≡⍜°⊟(⊃(-:⊓⧻/+|⋅⧻) ∩°□) Table
≡(÷:⊃(Fac|×∩Fac ⊃(⋅∘|-:)) °⊟)
/+
@solemn python I KNOW
I KNOW HOW TO ITERATE
I KNOW
i'll write about it later
I will delete them today
||basically just read the "row partition" section of the article i linked earlier, im just gonna iterate through all the a sets that satisfy the system||
oh real
i had part 2 spoiled for me so i alr know it wont be worth waiting
kinda glad i did tho cus i would have been annoyed otherwise
like eagely said it feels lazy
WHY DID U HAVE P2 SPOILED
maybe if u post it to github and put the unlicense the copycat can blame you in case of a lawsuit
simple wont license
i think doing it like a normal person is faster
its not
in uiua
uiua is NOT fast
imagine uiua is python but even python would be faster at a bruteforce
not fully just the jist
it takes 200ms in kotlin
it would take 30m for part 1 in uiua
today is gonna take seconds as well then ig
so ur saying a solution exists that between naive and what im doing rn?
hmm
i can think of another way but its basically the same just
its literally ||part 1 with a cache||
both work
yes
||ngl if i wasnt doing this at a library i could use perf and find out what was making my impl slow||
||but yea that solution where u walk through the 2^k possibilities and check if they match, it is super slow in uiua||
wait i thought of an optimization
nope slower
fuck u uiua
wait i thought of another
bro just ||bruteforce it with memoization pls||
explain or die
|| im about to brute force my fist in your face with memoisation (you will never forget) ||
TRUE
what did u do for part 1
||count the ?s as k, iterate through 2^k as k-bits, use the bits as a mask to insert # or . into the ?s, count the partitions for each iteration and check if they match and if so increase accumulator||
||i dont actually use strings but yea its basically that||
also i just realized why it was slow and i made it a lot faster
from 30m to 3m
still kinda slow
im trying to understand
ok thats smart
but idk how youd use it for part 2
i did ||iterate through each string recursively, check the first char, recursively add the function to total for the rest of the string||
||pass in the config and the group sizes, check first of config if its in ".?" then result += count(config without first char, sizes) if its in "#?" then check if there is a . or a ? after the group (substr until groupsize) and if yes add count (config substr until groupsize, group sizes)||
that was a terrible explanation
nah it made sense i think
its basically the same as mine but recursive rather than iterative
i dont know if you can do more than one recursive call in uiua
recursion is experimental
@sullen fiber IS THIS YOUR ALT https://mk.absturztau.be/notes/9n67o737plebb937
thats just the uiua frontpage
mandelbrot so easy in uiua tho uiua so cracked
also you love large matrices displaying as images
it can also do this in ur terminal lol
@tranquil vapor https://www.uiua.org/
A stack-based array programming language
click the arrows next to run NOW
ok i was wrong @solemn python its so bad for part 2
im just gonna typescript today with eagle's idea
Yeah I know lmao
I was testing it on P2 not P1 and needed to go bigger than i128s lol
Factorials are crazy
why tf is 🚓 🚑 🚒 right to left
SCARY
@tranquil vapor learn Hebrew
Is Hebrew rtl
aaaaaa
i hate this math stuff
I dont know how any of it works and am just getting numbers with no clue how they relate to each other
technically both
well both can, because its the same problem, one is just magnitudes larger
as with like 1/2 the p2s this year
what should first step of p1 be
I have math
idk what to do with it
but I have numbers
solve the problem
especially considering its arbitrary precision arithmetic rather than fixed precision
but anyways
the number is how many possibilities right
first step: parse input
I did
first number is the amount of possibilities that the 1,2,2 stuff is valid
given the length of the springs
the 2nd is the amount of possible arrangements for the springs list in general
the 3rd is the amount of possible spring lists when replacing the ?s with every possible option
ok i give up on the math for now
i just can't think of a way to calculate this without at least generating some of the spring list stuff
should I solve this with ai
ok yeah I give up for real this time
there might be a way but I don't know enough about probability or math in general to figure this out
if you find it vap pls tell im curious
b/c its in my search query
of
ty the type of fella to google for of row
so true
I just found a polynomial time algorithm to do this
That's crazy
O(n^2) rather than O(2^n)
IHATERECURSIONIHATERECURSIONIHATERECURSIONIHATERECURSIONIHATERECURSIONIHATERECURSIONIHATERECURSIONIHATERECURSION
im trying to do this the smart way but it is so hard to debug or even conceptualize recursion
Recursion is never viable for me because I cant get tail call optimization to work in js. (I don't know if it even exists)
TMR I'll try to write the polynomial time algorithm in the morning
In rust
@solemn python
Or maybe tonight if I use my friends laptop
time to delete my recursive function and try again for the 3rd time

ill get it eventually probably
ok well I looked at the megathread for a hint or two and now I think I figured it out
its actually pretty simple once I actually thought through what the function was supposed to do and added comments to literally every ifelse path
NOOOOOOO
i made it so far without worrying about the borrow checker and lifetimes
and when I go to cache shit I realize I can't add a slice to a map
Update: As of July 22, 2023 Safari is the only browser that supports tail call optimization.
use bun maybe?
Good excuse to finally try bun
guh fucking wasm has tco
tail calls can always be rewritten as loops
So I should use porffor
This true simply do@delicate crane
but recursion less lines and less indent than loop
@delicate crane have you done day 8
will not wait
did you just steal my code
yes

evil
@delicate crane hi
unsteal my code
never
LOVE
@solemn python hi
tyminky
@solemn python get ready
well i was gonna do gleam
but its dum and wont let me do a single file
haskell it is
I dislike this
i kept confusing rows and columns
i did now what i should've done from the start, just write one version and transpose
p2 im just going to throw some code at it and hope it works
can confirm this is the correct intuition for p2
p1 took me 25 mins, p2 38
see above
it's not that bad tbh
I should make a 2d array lib for rust
because the amount of times I have used 2d arrays is crazy
do not
i will
where is the reflection in this shit?
##.##.#.#..##
##.##.#.#...#
.#.###......#
.###.##..#..#
##.#.##....##
.#..###.###.#
.#...#...#.##
#.#.##.#...##
#.###.#.##.#.
#.#.#...####.
#.#.#...####.
#.###.#.##.#.
#.#.##.#...##
rows 10&11
ah
Oh man do I have a language for you
question for p2 solvers: ||the smudge is second to last column, first row?||
..###..##..
.#.#.....##
#.##..##.#.
#.#..###..#
.#..##.##.#
.#....##..#
#.####.##.#
#.####.##.#
.#....###.#
.#..##.##.#
#.#..###..#
#.##..##.#.
.#.#.....##
..###..##..
..###..##..
where is the reflection in this one?
its not 7.5
I swear to fucking god if 14 and 15 counts as a center
I see it
it does
all it has to do is hit the edges
not have more than 2 lines reflected
I way overthought reflections
my code that worked is way simpler
for p2 solvers, what the actual fuck?
workin on it
ngl p2 is easy edit of p1
it probably would be if I wasn't so bad at programming

I know exactly how to do it, my setup is just horrifying
its only vaguely usable
||in your function for determining if a specifc center is actually a mirror
- keep track of smudgeFound (default to true for part 1)
- replace line equivilance checker with oine that will allow smudge only if !smudgeFound
- when equivilance checker uses a fuzzy, set smudgeFound to true
- only return line is mirror if smudgeFound
||
||```js
const vert = findReflectionVert(pattern)
if (vert !== -1)
return vert
const horz = findReflectionHorz(pattern)
if (horz === -1) console.error(i) // <--- add this
return horz * 100
for me it was because I wasn't finding all the reflections, so add code to see if you have the same problem
Uiuable
YES
dreeam of solution
I already am having those dreams
I can't sleep once I see an AOC problem
brain will keep working on solution and I cant sleep until I solve it
ok I need to sleep
I have 2 finals tomorrow
I don't want to have a backlog of p2s 
3ms for p1 + p2
p1: ~1.5ms
p2: ~1.5ms
gonna try and see what multithread does to that time because I want to tuck with the js lib I found yesterday
ZLJDKLSJLKDSJKJKDSJKLSAJDSLAS
tip: it helps to read the problem before overcomplicating everything
I didn't read too much of p2, please explain your mistake
I didn't realize all you needed for the answer was the ||smudge'd reflection||, not the rest
why would you keep bad data in your (very good) summary of all the patterns
I absolutely love how the outputs to the problems wouldnt help at all in most cases because how they are joined together
if it can figure out how to fetch the example yeah I can just add --input example and it will run on example input and even comare it to the solution
is part2 terrilble again
it manages to get p1 example solution but not p2 for some reason
Are you sure your only ||accepting smudge corrected mirrors||?
I short-circuit when I find lines that ||are mirrored, minus one char||
No clue
@real hinge did you read my advice last time you asked?
didnt see
lememe look
.
You are telling me you don't in any part of your code, loop over each pattern and check for vertical/horizontal mirrors
terrible
I check each group horizontal first
then rotate the input
and use same function
||question literally says to check vertical first and ignore horizontal for stuff that had vertical||
question can explode
I am getting too low anyway
oh I found the problem
this has 2 mirrors
but first one is invalid
so it eplodes
Explod
okay completed first one
it turns out I neeeded to trim the group 
it was treating empty line as a gorup
i fucking hate rows and columns in coding
cause if u use 2d array you need to arr[y][x]
you're one off 
i had to do it using lists (ugly) instead of grid because it for some reason was returning an answer lower by like 300 but correct for example and i couldnt figure out why
||
private fun findMirror(grid: List<String>, smudges: Int = 0) = (1 until grid.size).firstOrNull { grid.take(it).asReversed().zip(grid.drop(it)) { a, b -> a.zip(b).count { (a, b) -> a != b } }.sum() == smudges } ?: 0
private fun transpose(grid: List<String>) = List(grid.first().length) { i -> grid.joinToString("") { it[i].toString() } }
override fun solvePart1(input: File) = input.sdnl().sumOf { findMirror(it.lines()) * 100 + findMirror(transpose(it.lines())) }
override fun solvePart2(input: File) = input.sdnl().sumOf { findMirror(it.lines(), 1) * 100 + findMirror(transpose(it.lines()), 1) }
||
this would be a lot longer with grid, which is the opposite of what im trying to achieve with it
You see, I have finals today
Which is a nice motivator
you will love p2
i guess i had that too, multiple times but when i did list implementation instead of grid i accidentally ordered it correctly
It doesnt seem too bad
FUCK thanks for reminding me
i have midterms
hope you fail 
doesnt matter if i fail cause its just bonus points 
either way, not very nice zt
das y ur in da hole
NO
oh wow
i dont like that this is arguably more concise than my uiua
Just write something for rows, then rotate the array for columns
||or just transpose the array, by swapping x and y||
@solemn python are u still curious about the polynomial time alg for yesterday
u mean like how u did in part 1
so variable changing applies vertically too
variable changing 😨
FIRE
i tried that, it didnt work, so i did it with lists instead of custom grid, and it started working
rip leaderboard i guess
thats what i did lol weird
i mean it did work but not with my custom grid for some reason
i rewrote it with lists
and it magically started working
i was getting like 300 and change below correct answer
ikr thats why im learning python
yes
so fire
js and umm uhh
native i hope
ive never met anyone that uses it
yes
fire
wdym
its super slow in console
wdym in console
with graalvm on jvm it competes with c
u can type kotlin in console
like a REPL?
and itll open up one of those input thingies
whats a repl
not
did u know theres a function
inline fun Boolean.not() = !this
also theres 2 types of kotlin users
list.filter { it.isNotEmpty() }
and
list.filterNot { it.isEmpty() }
list.filter { it.isEmpty().not() }
list.filter { !it.isEmpty() } better
hop on julia repl
kotlin seems like a stupid language to repl
function reference
list.filter(String::isNotEmpty) assuming it's a list of strings
anyone else notice that it seems like it ends on day 14
like how its visually laid out
i wonder if the layout will change drastically tmr or if it just will extend
now THIS
is fire

minmax ur stackframes
no it it will just end on day 14
bad
{} better
nop
true
zt loves func references in crystal
yop
/run ```cr
puts ["zt", "banana"].map &.upcase
Here is your cr(0.36.1) output @tranquil vapor
["ZT", "BANANA"]
very good
@hazy sinew I received kotlin(1.8.20) compile errors
file0.code.kt:1:1: error: expecting a top level declaration
println("Hello World!")
^
file0.code.kt:1:8: error: expecting a top level declaration
println("Hello World!")
^
file0.code.kt:1:9: error: expecting a top level declaration
println("Hello World!")
^
file0.code.kt:1:10: error: expecting a top level declaration
println("Hello World!")
^
file0.code.kt:1:22: error: expecting a top level declaration
println("Hello World!")
^
file0.code.kt:1:23: error: expecting a top level declaration
println("Hello World!")
^
Error: Unable to access jarfile code.jar
/run
fun main() =
println("Hello World!")
Here is your kotlin(1.8.20) output @hazy sinew
Hello World!
omg it works
/run
fun main() = "me when".map { it.toInt() }.reduce(Int::xor).let { it * it }.toString(16)
@hazy sinew I only received kotlin(1.8.20) error output
Error: Invalid or corrupt jarfile code.jar
/run
fun main() = println("me when".map { it.toInt() }.reduce(Int::xor).let { it * it }.toString(16))
@hazy sinew I only received kotlin(1.8.20) error output
Error: Unable to access jarfile code.jar
/run
fun main() =
println("me when".map { it.toInt() }.reduce(Int::xor).let { it * it }.toString(16))
@hazy sinew I only received kotlin(1.8.20) error output
Error: Unable to access jarfile code.jar
stupid bot
agreed
smart

im trying to understand berlekamp-massey
wtf is he cooking
ok i get it
its not useful
les goo
I finished day 12 part 2 too
ig its good
god now I feel relaxed
full gold
wont feel relax after dinosaur attack
where will I get dinosour attack


🦖
wow timescript is super cursed
@warped dust look
[number, ...number[]] is meh but D & {} is crazy..
D & {} is just non nullable
so
if u just do D, and u do new Tensor([5, 5], x => x)
instead of inferring from the first D, and using it for the second D
it cries that they arent equal
TimScript
so ig D & {} is like a "derived" type, so it actually uses the first D then
fucked
idk how it works really im just assuming cus thats how i fixed it
LOVE
@real hinge
fallocate -l 1G mantika.explosion
git add mantika.explosion
git commit -m "add big explosion"
git push
run anyway
vscode cloud changes
when I finish aoc I just store changes in cloud
and pull in my main computer
github cant handle 1gb
so actually its not a big explosion
@warped dust CHALLENGE
are you sure
wait i should stop treating this thread as general chat
yea but ur uploading 1 file
for 1 file yeah possible
obviously the linux kernel github is more than 1 gb
too late
i tried uploading the 10mil input for day 4 and it told me to use github lfs and to also go fuck myself
CADDY INSANE
I think it got ratelimited
not related my to my config issues just restart triggered it

I should have reloaded h
gat damn
I am so skilled
not the shitpoop :sob
i was keeping up then the mental health exploded before i could finish day 12
maybe i will catch up over the weekend
been too busy after the pipes 
i kinda have no motivation to do it rn
gave up after day 4
@warped dust return
It's been a fun morning ritual walking to the library after waking up
I think imma keep doing them after waking up when I get home
A lot more enjoyable than doing at midnight
just finished d13p2
only minor change to my program from last night which is nice
basically I was just ||not checking if a smudge for 2 specific lines matching would actually expand into a valid reflection||
so instead of ||returning from the iterator instantly I just stored if the current reflection in the picture was smudged and then find the one valid smudged reflection at the end after checking everything||
ok finished d12p2
holy shit ||dynamic programming|| is crazy
how is it so fast wtf
I was not expecting that
and my code is very bad too
@solemn python
ready for what? it to release? it already did
Lolol
is this the last day of aoc?
there are 25 innit?
why does it just stop
no, see how 15 is going downwards
no
LOL
I think we go back down the islands
NO MORE
ruby?
i did crystal does that count as the same
have you done elixir
I guess
nop
nim?
do it
ill do that another day
This is like
raw wasm
6 chars in Uiua
never
I might do this in my phone rn
insane
@steady fog@steady fog
Today is crazy Uiuable
you love disassembled rust wasm
@sullen fiber forbidden from using usuaia
YAY
today looks cancer
@real hinge hi
hi
i shouldve been way faster on p2
i solved it exactly when everyone else did
#100 is 17:15
wasted like 5 mins on part 1 wondering why my shit wasn't working bc i hard coded ||10 - i for the load lol||
this was basically 1 trillion elephants exactly
for part 1 i just ||made a function that rolls rocks to the north and that was faster than everyone but 7 people ig||
p1 done
for part 2 ||made the function go in all directions made a cache and iterated through the cycles, checked the cache and if a state is repeated calculate that for 1 billion and get the remaining cycles, then just break and iterate through the remaining cycles manually||
same
I love a billion iterations
a trillion elephants
wtf did u do to make it not compatible
||Split columns into groups by #, number them, count O them mul by number||
for part 1 || i iterated column wise with a hashmap with indices of cube rocks, incrementing the highest index on round rocks||
suprized
i just used kotlin for it ||```kotlin
grid.withIndex().sumOf { (i, row) ->
row.count { it == 'O' } * (grid.size - i)
}
mantika cant spell
i'm so pissed i did part1 in basically 1 try but i hard coded some shit for the sample
i have an interesting idea i wanna try
just need to figure out how to do it in elixir
Yea but I didn't do gravity
huh
literally here i hard coded ||grid.size for 10||
lmao
Lol rip zain
wait that shouldnt work
wtf
why does that work
wait i thought only rocks that touched the north row directly or via other rocks should count, but i forgot to implement that and it ended up being right
does elixir have a way to shorten this
Enum.map(fn m -> m |> String.split("") end)
surely theres something
dont feel like scouring documentation right now
its all rocks
Just after they shift
yea i get it now
Ok gravity is a lot shorter in Uiua than my stupid group thinf
ok elixir has some cool concepts
i kinda like this
@hazy sinew we need to port to kotlin
i originally was gonna sum all the rocks and then check if theyre touching the north or not but forgot to do that and got the right answer
kt prob alr has it
pipe operator
dang it, no bruteforcing for me :(
example?
Day 12?
today
Omg today is real
i was thinkling i could sort the values
but
that would also move the #
idk how to get around that
maybe next year I will be able to actually do aoc
Dynamic programming will get us through part 2 alhamdulillah
At some point it probably repeats
1 billion actually isnt that long
should take about 1h40 to bruteforce in kotlin with an inefficient function
guh i thought i was onto something
i was gonna transpose, then sort the values
it wouldve been so simple
Idk how to do part 2 in a fast way
But I can do it in a funny way
Probably intended ig
My guess would be try to find a point where it repeats
If it exists
Then modulo it with 1000000
Do the rest
actually it seems much faster
might just let it run for the memes
oh wait nvm
im running it on the example lol
hah
but I might let the example run for the memes :)
tymonky
at 34% at 10ish mins
@solemn python how did you do part 1
well after ||adding an LRU cache|| it gets the wrong answer anyways
@solemn python@solemn python@solemn python tell
it does work
how
My AoC repository: https://github.com/hyper-neutrino/advent-of-code
Join my Discord! https://discord.gg/j9uunTRRJm
0:00 Part 1
4:50 Part 2
Want to improve your mastery or learn a new language? Try Codecrafters, a platform where you learn by building your own project! I've always believed that learning by doing is the best way to learn to code ...
||guh I assume my "go any direction but north" logic is failing||
AoC is so hard to debug and I hate it
hm I think I have a better idea for my dumb direction logic
||what if instead of having separate logic for each direction, I just flip the board, run the north code, then flip it back||
he didnt place on leaderboard today
sorting is overcomplicated
how
or maybe not sorting but bro is talking about diagonally flipping a matrix and then inverting the columns bro just make 4 for loops and a switch case and change the row or column that ur changing
its better to start writing than to think about how to do it simpler
you should only think when your bruteforce doesnt work
except i dont know the lang
today it was obvious that it wouldnt work so u can get straight to cycle detection
for loops and indexing shouldnt be too hard right
i guess
Laughs in Uiua
see you guys in a year
NO ONE SANE USES UIAIAWE
I'm sane tho
wrong
I'm super sane
is that for today
@steady fog 0.003%
yes
cause today doesnt even take that long
I believe that it will repeat after some time
2h max
mantika mastery
it repeats after 7 cycles bro
I move them one by one
Manti I promise it should be much sooner
so do i
HUH
how
idk for him it was 7
i didnt print for mine i just calculated the output
For me it was 98
maybe 7 is example
||guh my rotations appear to work but my answer is wrong||
oh wait im an idiot as always
I can't figure out how to best cache this
tmpfs in ram formatted as zfs
not what I meant
too late
holy
nice one, solution
it really does take time to kick it in
anyways who cares, my solution is bad but works, I should sleep
how do rolling rocks and non rolling rocks make sense
if none of the rocks are attached and you tilt the plane all the rocks are gonna fall
you need the square rocks to be attached to the ground
but then it doesnt matter if theyre square
and it makes more sense for the rolling rocks to be square because if they get stuck on a square theyre just gonna roll to the side and continue if theyre round
maybe the cubes are concave
maybe were tilting it exactly north and not part of a degree to the side
noooo
cuz its vscode
good editor
my dad used to use emacs apparently
i dont
I imagined they were much bigger than the rocks like bricks
Or Cinder blocks
well they arent on the grid
actually now that i think about it maybe all the stones are big
cuz i dont imagine ur gonna be tilting small rocks
and applying pressure
i was wondering why my puzzle input resulted in 0
lmao i had that
brute force so slow
fun timeskip(cycleLength: Int, startOffset: Int, totalCycles: Int) = (totalCycles - startOffset) % cycleLength
now i dont have to remember the formula anymore
ventika so smart
today was easy
my solution takes ~10s
@real hinge
i wonder how much faster it would be if it didnt use ruby
hop on crystal
and tbh u can probably optimise these but im lazy
ven do you know elixir
nop
part1 or two
two
my solution:
|| rotate map in a loop and put the resulting array into a map with the loop index. after every rotation check if the array is already in the map. if yes, we have a cycle, so use index from map to calculate how many rotations until a cycle happens and break the loop
now subtract the amount of rotations done with the loop from 1000000000 and take modulo with the amount of rotations until cycle to get how many rotations are left to do, then do those rotations
||
hey i did that too
i will reboot to linux and check how long crystal takes
cause ruby so slow
that takes 10 seconds?????
fix
it takes 71ms in kotlin with exactly the same method
I was gonna optamize mine furthger
but uhhhh ureaxjsal
ruby so bad
optamize
is crystal and ruby same
literally same code but ruby
crazy how much of a difference it makes
love
you probably did something that is really inefficient like read the input again every iteration
no
and didnt notice
its the same code bro
i dont think ruby has jit
ruby might not be much slower in every day apps that do IO and stuff
but this is pure CPU work
where compiled languages are a shit ton faster
venny
❯ diff solution.cr solution.rb -w
0a1,2
> require "set"
>
87c89
< map = File.read_lines(file).map &.chars
---
> map = File.readlines(file, :chomp => true).map &:chars
94c96
< map = File.read_lines(file).map &.chars
---
> map = File.readlines(file, :chomp => true).map &:chars
96c98
< prev_maps = {} of Array(Array(Char)) => Int32
---
> prev_maps = {}
103c105
< dump = map.map &.dup
---
> dump = map.map &:dup
i dont speak weirdly formatted ruby
wait are ruby and crystal the same thing
no
almost
crystal is just ruby with types
||
--- solution.rb 2023-12-14 17:54:13.123423262 +0100
+++ solution.cr 2023-12-14 17:53:11.742596153 +0100
@@ -1,5 +1,3 @@
-require "set"
-
def tilt_north(map)
(0...map.first.size).each do |j|
loop do
@@ -86,23 +84,23 @@
end
def solve1(file)
- map = File.readlines(file, :chomp => true).map &:chars
+ map = File.read_lines(file).map &.chars
tilt_north map
puts calculate_load map
end
def solve2(file)
- map = File.readlines(file, :chomp => true).map &:chars
+ map = File.read_lines(file).map &.chars
- prev_maps = {}
+ prev_maps = {} of Array(Array(Char)) => Int32
rotations_done = 0
cycle_happens_after = 0
1000000000.times do |i|
rotate map
- dump = map.map &:dup
+ dump = map.map &.dup
if prev_maps.has_key? dump
rotations_done = i + 1
cycle_happens_after = i - prev_maps[dump]
||
this is the only difference between the files
it has no semicolons and no braces so its python
"Crystal’s syntax is heavily inspired by Ruby’s, so it feels natural to read and easy to write, and has the added benefit of a lower learning curve for experienced Ruby devs."
those are very minor similarities
i dont care
that's like saying javascript is c++ cause they both have classes and {}
no because c++ has semicolons and types and js doesnt
i see def, no semicolons, no types, prev_maps = {} which is python syntax
its python
stop coping
also theres no variable declaration keyword
the difference is that crystal is actually good
while python stinks
anyway
im surprised ruby is this slow
ofc its gonna be slower than llvm, but 62 times? O.O
nah not even python2 takes 15 seconds
when it comes to performance, Ruby tends to be slower than Python
from random dev.to post
elixir captures are funny
i thought ruby was llvm?
ruby is interpreted
why would u use ruby then
cool language
crystal is
python bette
crystal de crystal de
ven what lang should my extensible modular de be in
go, v, crystal
i enabled ruby jit and it's still 14s
crystal
can i hot load scripts into the same runtime
lua 

i am teh anti lua
linux users love lua for their configurations
lua kinda cozy
badbadbad
not super cozy but a tiny bit cozy
@proper totem hi
i wrote my first programming language in lua 
hewo @steady fog @steady fog @steady fog
hewwo
yop
i want to try crystal it seems neat
will do once motivation comes back from negatives
I've done ruby for work but it was Bad ruby in a project that I just needed to patch enough to get barely working so I don't think it's a good gauge of how writing it feels
crystal would be so amazing if its language server was better
but its terrible 
the fate of most lesser used languages
ruined by bad LSP
well it could be worse ig
but its really not it
ruined by bad lsp or strangely bigoted leadership (or both [hello nim])
nim makes me scream
can you run ruby code with crystal
momtika
nop
theyre a bit different in some things
[1, 2].map &:to_s # ruby
[1, 2].map &.to_s # crystal
arr = [] # ruby
arr = [] of String # crystal
crystal requires you to specify type of arrays, maps, sets, etc
bit weird that those annotations are required, could probably infer
esp on returns, you already know the type silly
yeah like it already does for other vars
ig they wanted to be explicit about arrays
why does this comparison fail
Enum.count(~c"###", &(&1 === ~c"#"))
returns 0
???
unhusk
insane code
mentally ale
zeet did u solve part 1 yet
no
wrong
@tranquil vapor how is yours so fast
mine takes 0.98s minimum
do you check arrays in all directions
maybe its because I rotate the array and check again with same function all the time
i wrote good code 
tbh my code isnt even vastly optimised
i could optimise it better
I just take O's to top
rotate and do same thing
ig this horribly written function takes most of the cpu time
checking normally would be way faster but I dont wanna do that
@real hinge figure out why mine doesn't detect O correctly
how
I put virus in your computr
whyyy
money
oh
you create new array every time
that's probably why
yop
**solution.cr: **Lines 6-8
||```cr
if map[i][j] == 'O' && map[i - 1][j] == '.'
map[i][j] = '.'
map[i - 1][j] = 'O'
rust analyzer is the best
yop very good
I do kinda same too
just rotating creates new array
what adds those errors in the line @real hinge
That's not even rust analyzer
That's just rustc
whats the difference
why tho
isnt rust analyzer just language server
do you mean you physically rotate the array by 90°
how else would I rotate
Rustc gives the error
Rust analyzer puts it in your editor
yes
I did that too




