#AdVENt of Code
1 messages Β· Page 1 of 1 (latest)
@true hatch @exotic meadow @native pewter
@drifting hornet @solemn python @tacit wigeon
@proper totem @warped dust
forceful add
Yooooo
its the funny man
I spent entirely too long making overly complicated solutions to part 2
Then realized I was an idiot
Congrats
WAIT IT STARTD?
12:00am EST
3 hours ago
bro kidnapped them π
rate my solution
I'm not reading a screenshot please send your code in a message like a big boy
I don't understand a single symbol in that language/10
like that will make it more readable
I don't have to look at an image at least
||```
Lines β ββ‘β @\n. &fras "input.txt" # Lines
GetDigits β Γ β(-@0) β€@9.β
GetValue β + Γ10 ββ’(β’β) β½β 0.
Part 1
/+ β‘(GetValue GetDigits) Lines
Part 2
Words β {"zero" "one" "two" "three" "four" "five" "six" "seven" "eight" "nine"}
GetNumbers β /+ β‘(Γβ:Wordsβ(ββ©β).)Words
/+ β‘(GetValue +β(GetNumbers)(GetDigits)) Lines
@steady fog advebnt of code here
Thank
tyminky
i dont even get the question wahhhhhhh
where the fuck is the second 7
That's in the first message of the thread
7 is the last and first digit
Smh editing
You got pinned anyways
I did rust because yes
malware thrwad
JAVA
AAAAAAAAAAAAAAAAAAAA
HERYU
HEY
look at my solution imma show u but like in a normal way
that must be pain
im asleep
im doing it in swift
My code is ass but we aren't being graded on this so who cares
part 2 gave me trouble
OK ima sleep now. Remind me tomorrow to implement testing based on the examples
If it works it works
Hm that would be smart
Except when I tested the examples and it worked but the actual data didn't work lol
Well it's not always gonna cover the real world data
Yeah
Just like normal tests
@warped dust how my solution works
||so zero is considered a number as well? i have to turn it into the character then get the first and the last?||
It's not
I just ignored 0 completely
no as in zero i meant like words that are numbers
Yes that too
guh
yea they dont show up
It explicitly lists all valid cases, one of which is not zero
i just did it so that ||.indexOf("one") === 1||
How do I get
https://aoc/year/day
With part 2 revealed, before I have even gotten part one?
u cant
Then the dream of tests in my hot reloads is dead
||ok so the answer of nine567 is 97||
yes
alr
also ||eightwo is 82||
ty
they dont tell you that and it made me die a lot
horror
They should have made clearer the situation of like ||5twone|| because that confused me for a bit
But I figured it out eventually
Though that might also have been just me doing stuff the hard way
Anyways eepy time
yeah
Is AOC solution always a number?
ehy is uiua read backwars
no
uhh
Fuck
vavjkwars
2 is a command to push 2 on the stack
IRTS BACKWRS
if u do 2 3 4 you'd expect it to be on the stack in that order
the answer is the author is stupid actually
Ω Ω Ψ±Ψ§Ψ³Ψͺ Ψ¨Ω ΪΩΎ Ψ±Ψ§ Ψ―ΩΨ³Ψͺ Ψ―Ψ§Ψ±Ω
are aoc inputs always split by newlines
trje
very often they are but i mean its not always a 1d list
shrug
u can go thru last years to see like
$<.each on top
i will golfed ruby pill vap
You should think of it like any of the numerous other languages that put functions before their arguments. This group includes languages of vastly different kinds, like C, Haskell, and Lisp.
yea this makes sense
oh that page made me realize how to remember the order of - and div
me
time for aoc
what lanuage do iuse
rust
uiua
shopify horror
shopify loves ruby
im going to hurt somebody
why is the rtuby language server shit
AAAAAAAAAAAAAAAAAAAAA
guh its so over
i wrote code and it should work but it doesnt work
i think its cause of some weird ruby thing i dont know about
you wanna be me so bad
overlaps
i thought regex also matched overlaps
insane
WTF IS THAT
much saner ruby
|| i initially just did first = line[re] and last = line.reverse[re]. then i realised that will turn two into owt xd
i will shrimply reverse my regex too
||
should i start a private leaderboard
we have
from last year
whar
WDYM
it doebt
girlie..
im confused
oh i thought the number indicated how many stars u have in total
and persisted from last year
dumbas
adveht of car
there are prob devs that would join in if they saw on channel list
but even normal channel is hidden cause of insane onboarding
cta
should i post in #announcements
yop
we dont want whitenames in aoc
dont we
nop
yoiure kinda right ig
but then you have dumb people in the channel
**solve.ua: **
Lines β ββ‘β @\n. &fras "input.txt" # Lines
GetDigits β Γ β(-@0) β€@9.β
GetValue β + Γ10 ββ’(β’β) β½β 0.
# Part 1
/+ β‘(GetValue GetDigits) Lines
# Part 2
Words β {"zero" "one" "two" "three" "four" "five" "six" "seven" "eight" "nine"}
GetNumbers β /+ β‘(Γβ:Wordsβ(ββ©β).)Words
/+ β‘(GetValue +β(GetNumbers)(GetDigits)) Lines
fire
WHAT IS THAT
ancient hieroglyphics
see: this amazing video #1180052078631071827 message
linear algebra language
terrible
you didnt read instructions
u werent supposed to include "zero"...
i did
they should have put zero just to catch people like u
treye
i added it cus it made math easier
bestie where does it say zero...
cause u dont have to +1 the index?
weiiird
oh uyrkinda based
real ones do
|| ```rb
i = nums.index num
return (i + 1).to_s unless i.nil?
real ones going to sleep
gn
nini
do ruby users actually use the no bracket syntax? as in puts banana.to_s.reverse.last over puts(banana.to_s().reverse().last())
its like the anti-lisp
:3
@warped dust tomorrow i will do it in qilang
i think so but not when there's too many nested calls
wtf is that chinese ass lookin apl dialect namr
sorry i got racist
those are the only ones i know
this is so bad
File.foreach(file) do |line|
end
real ones use
File.foreach file do |line|
end
{|line| }
nop
can u
malware
WHY IS THAT REAL
vee loves $<.each{puts _1}
dont
HOW
cant
(line.scan re).flatten
how do i remove parens here
(parse(m.first) + parse(m.last)).to_i
mmm
Integer parse(m.first) + parse(m.last)
NO
;33
LOL do you really have to PascalCase global variables
where
thing = 42
Thing = 42
def banana
puts thing # doesnt work
puts Thing # works
end
says the scalar integer
Integer π³
$><<thing
malware
this syntax is so cursed
def parse num
i = Nums.index num
return String i + 1 unless i.nil?
return num
end
vee loves $><<"h"<<"e"<<"w"<<"w"<<" "<<"o"<<"\n"
i and String i + 1 or num
Aaaaaaa
WAIT IT STARTS TODAY
AAAAA
5h ago
Iβm on a bad timezone for this
It's ok there's 25 more days
6am
Same
Iβm not awake at 6
Ackshully itβs 11:27am
Is that utc
Qhat
i wana work on beam so bad
i love erlabg
but my brain isnt working but i also CANT SLEFB
im beinf held hostage to write a good etf lib bc NONE exist for rust
binged like 7 kuzgesagt vids
Holy
true
i know what i should actually work on
deadly viruses
makin bioweapons
worse than smallpox
They caught like every single one of us
vee will be patient zero
why did they start day 1 with such a meanie one
truue
i can imagine many people not figuring it out and immediately getting annoyed xd
fr it was so lame
theyre making the prompts more yap to prevent the ai ppl
fuck people who use ai on the leaderboard
or even use ai at all for this
why would u do that
omg i thought each line is guaranteed to have two digits
there goes my cute 1loc solution
what is this
its like a small coding challenge for every day of advent :3
they get progressively harder, so you have time to slowly learn the language
if theres something in AOC that can theoretically be done in css, ill make it in a discord theme 
funny one line
||
console.log(input.map(x => x.replace(/one/g, "one1one").replace(/two/g, "two2two").replace(/three/g, "three3three").replace(/four/g, "four4four").replace(/five/g, "five5five").replace(/six/g, "six6six").replace(/seven/g, "seven7seven").replace(/eight/g, "eight8eight").replace(/nine/g, "nine9nine").replace(/\D/g, "")).map(x => x[0]+x[x.length - 1]).map(x => +x).reduce((partialSum, a) => partialSum + a, 0));```
Of course `input` has to be in the form `["abc", "xyz"]`
||
Yeah that's what I used
Then just gitignored /**/input.txt
Yeah
Relative to the file it's included in
It's not a good idea in most cases
It's only good for static assets
That u want to include in ur program at build time
Weeeee
You could do o1e t2o t3e... n9e instead of one1one two2two... nine9nine
Yeah that works
I was doing replacements at first but I realized it was so much easier to just treat the input as immutable and just use indexes
That sounds really complicated
yes
same
well i was using an array-based language so i had to or else it was too complicated
my solution sooo easy but i got screwed over by the same thing everyone else got screwed over by

I don't know how everyone got so screwed by that
It took me like 5 seconds to fix once I realized there was overlap
because they dont give u the edge case that suggests otherwise
the issue is not fixing it
the issue is realising that is a thing
i only realised cause i manually checked every line and what my code was finding
jesus
i only had to check like 20 lines but still annoying xd
im just glad i didnt have to get that far and someone told me
They suggested the possibility by including an overlap in the example.
For me that was enough
When AOC leaderboard
true
wait what
mine didn't have any overlaps
they did it was an example
like eightwo5
said it would be 85
but didnt mention that the full list would be 8 2 5
Pretty sure examples are constant
r they?
my example was
two1nine
eightwothree
abcone2threexyz
xtwone3four
4nineeightseven2
zoneight234
7pqrstsixteen
last digit on each line. For example:
two1nine
eightwothree
abcone2threexyz
xtwone3four
4nineeightseven2
zoneight234
7pqrstsixteen
is this punishment for picking a functional language
filter :: (String -> Boolean) -> String -> String
im going insane
wait is it using the wrong filter
It's so much more simple
||I just check the char index of 0-9, "one"-"nine" and sort||
That would take like 5 more lines of javascript to implement than running replaceAll
And my current solution is 4 lines of actual code
I mean if you do the word number word trick sure, I was just having issues with prioritizing replacements
And I didn't think of that trick
@native pewter https://adventofcode.com/2019/day/2
what
check that one out
im still fighting the purescript compiler 
oh my b

lmao mb tail doesnt do what i thought it does

this language is so shit google autocorrects purescript to typescript
FINALLY DID IT
@unique hearth im abducting you
it worked
RunInstruction β +4: ββ‘; β(:β
ββ)(β) (β|+|Γ) ββ(β[ββ] β β. β2)(β‘2) β(β‘0)(β1) β: β4β,,
@warped dust uiua cpu
i should really comment my code
i think im gonna start doing julia

LMAO
part 2 is FUCKED UP and im not doing it in uiua at all
no damn way
i need some sort of polynomial contruct to do this
finished making my code more readable ||```rb
pt1
p$<.map{f,*,l=_1.scan(/\d/)*2
eval f+l}.sum
pt2
d=%w?_ one two three four five six seven eight nine?+(?0..?9).to_a
p$<.map{f,,l=_1.scan(/(?=(#{d?|}))/).flatten2
d.index(f)%1010+d.index(l)%10}.sum
\K doesnt work like i thought π
would be 2 chars less..
pipebomb operator |
it does one of those 3 functions
dont vapsplain i know its a switch
YOUR MOM
i need to actually learn uiua
do\
just read the tutorial
do basic things
and then do like some day 1 aoc puzzle
uiua will be real on day 4
fear
vapsplain bahaha
true
oh i did today in uiua
a nice
how did you solve it? i am sure it must be a lot nicer than what i did
it looks probably the same?
uiua.vim when
sec lemme get the video
ah neat
why is wee wuh webpage so sloww
i should comment my code like you
okay this is a lot better
i made a p1-only solution that is really nice though /+β‘(+Γ10β’:β’β.β½β€9.-@0)ββ‘β , @\n
yea thats fire
how did i miss β find existing aghh
what is this
but not where it matters
β‘(|1 )
function signatures
because i do /β it can't infer the amount of arguments
yeah
for 1.1?
yes
The second number is optional. If it is not given, it is assumed to be 1.
oh yea also i assume u ran into that bug
i think formatter actually does this shorthand automatically
where find fails if the needle is larger than the haystack
didn't run into that exact issue but a similar one yeah
ah i saw u accounted for it and assumed
that particular issue with find was fixed in main branch
i had to wait 10m for uiua to recompile to do part 2 lmao
i had some fucked up attempts
ah i am running uiua from source so i probably wouldn't have run into this issue then
yea true
at first i was like trying to tokenize it and accumulate it
oh replacing
it was scary
this looks not good yeah
UIUA THREADING
note that comments were added after the fact, this was just as bad, if not worse, than your code looks while working on it
ah yea fair
oh i should make it multi threaded and see if that makes it run through the bigboy at an acceptable pace
probably not
after a day or two of using uiua
its mostly not that bad to read if things are spaced well
mhm
but stack manipulation is definitely hard to track
it's a lot better than it was in the beginning
yea i heard there were ocean operators or smth
πππππππππππ
and they got removed
WTF I DIDNT KNOW IT HAD STDIN
bro said dialog
wait
ocean was for arrays but that was a thing yeah
nvm its really bad i see
i had to basically relearn uiua because it's so actively developed almost nothing was like how i remembered it
yea aa
it's all improvements though
one thing i really like is planet notation
also under and inverse
are pretty magic
what is reach
dig but twice
WHAT IS DIG
planet..
ββ£β
they should rename
you will see
dip makes no sense
type dig
unkwnown
oh true cus its not
real
has to end in i
digi
diggigigididiigiidigi
wtf scam that doesnt work
Finished release [optimized] target(s) in 7m 42s
Installing /home/rini/.local/share/cargo/bin/uiua
wee wuh
fuckin underlines in strings are format strings
isnt it just with like
hey guys i just did aoc day 1 in uiua
||```
[
β‘"ruby" β‘"-e" β‘
$ p$<.map{f,*,l=_1.scan(/\d/)*2
$ eval f+l}.sum
]
;&runi
the fuck
how tf do i read stdin into an array
are u readlining til empty?
idk how stdin works i suggest filing
get that corny ass smile out
how does it detect EOF
it returns 0
β’(&p.)(0β ) &sc
and make ur do function join into the array
make senseee
ohh
ok so ur using != 0 "hello"
!= is a pervasing function
so its checking if all the chars are != 0
..........................
uiua is literally the only language where stdin is for no reason fuckin harder to handle than actual files
i just rebased my day 1 on apple swift template

they did some stuff better than me
organization wise
LITEAR>YAWL ?
are u sure it returns 0
cus for me it FAILS
what the docs say
sorry i didnt know this part was so bad
&fras "/dev/stdin" # FUCK YOU
on linux
β1 β’(β β‘β£&sc(0;))(Β¬ββ‘0 β¬0β‘0 .) []
i did it
omfg
the loop is try catching the &sc and throwing away the error in place of a 0
and boxes the string or 0
joins
bleh
hop β£&scβ 0
wait
based
yea for comparing things that are arrays
use match
= will go thru arrays
it'll also go thru boxes
@warped dust someone in the discord said
&ru @\0 0
LOL
this is real
readuntil nulbyte fd0
i save and it does the thing
oh uiua watch is formatter?
it runs but also formats
does that fuck up ur cursor
sometimes it goes offscreen
F
real
also doesnt fuck up undo history
vim cracked
vscode cries so hard if you edit a file externally
enough uiua for now i must beam
day one star one, requires the following c boilerplate 
#include <stdio.h>
extern int star_one (void);
int main () {
int result = star_one();
printf("%i", result);
return 0;
}
LOL DAYUUM
i found out the file extension needed to properly embed x86 asm on discord so here it is
get ready besties
yop
its iceland island
SO MUCH TO PARSE
this one seems easier than day 1
idk i didnt read it yet i just got jumpscared by the amount of things to parse
imma get coffee
I could probably turn it into an object in a text editor
oh damn it is slightly more annoyinh
The Elf explains that you've arrived at Snow Island and apologizes for the lack of snow.
fuckin climate change
what if i did erlang today
do
yop sane
abandon uiua tbh not sane enough
uiua guy said hes gonna add some ops to make string manip saner
reall
parsing this is easy tbh
true in a normal language
how the fuck do you parse values sequentially from a string without having to splice into substrings constantly
did part 1
erlang wtf is a head mismatch
u need to its lame
i cant figure out how the fuck to do it in rust
its been half an hour and ive gotten nowhere
insane fr
im not confused i dont know how the fuck to do it in rust
can u not split strings or smth??
pain
oh its so easy
wysi
yeah
what'd you write it in?
swift
oh nice
ill send in a bit i want to make timings use ms
part 2 done
I'm certainly not going for shortest program award but it works and thats what counts
I don't care how cool my solution is I just like doing this tbh
i still cant figure out how to parse this stupid shit
i cant get my regex to work either
as soon as I saw the problem I went to my terminal and cargo add regex'd lol
Hmm I can't figure out how to get this on one line
||Could probably use regex for all of part one||
yeah its certainly possible
what the fuck is it doing??
I used 2 regexes
one parses ID + picks, then I manually split by semicolon and run another regex
just easier for my brain
I have 4.splits() and 5.replace() just for part one lmao
as I said, not the coolest but definitely functional
like literally my solution just parses the input into vecs of structs and then I analyze the data afterwards
but it looks cool to me so thats what matters
I love parsing data into rust structs
its so fun
and then you can dbg! and look at all the beautiful structs and numbers
mine is mostly splits
||why did you all parse game ID out of it, just shove into an array and game ID is just idx + 1 (assuming zero based indexes)||
||3 splits per game, 1 split per draw, then a split for each color that draw has||
if you are codegolfing than sure but
erl is killin me
rini i did
that came out more condescending than I meant it to, mostly just asking because i found it easier that way since I saw there were no gaps in the data xd
i did day 1
||meh clarity my games are in structs||
kill me
making sense to me was more important to me at the time than being fancy
my code is very verbose
did i cook
||I used a .includes("red"), then drops all non nums, compares it against avalible||
yeah i was kinda thinking like in advance are they gonna try to fuck it up
i just wrote what came to mind
and splitting a lot works
yeah
I don't even know what this language is or what it means and I am very scared
it is scary
rituals are being performed
its scary ur not wrong
are ligatures just making it look scarier than it is or does it actually use weird unicode
the ghosts of christmas past, present, and future are being summoned with your code
no yea those are real
fear
how tf do you type that
the formatter turns the function names into symbols
oh that's not as bad then
write them yourself coward
im happy with this improvement
i should set up a input fetcher for mine
oh wow part 2 is so easy
should I make an autosubmitter
is that possible without looking at html, I assume its a POST form
for real it surprised me
but also I can't really test that so
i literally had to calculate part 2 in order to do part 1
Oh
@delicate crane whatd u do
its easier just to cut out the middleman though isn't it
pt1.erl:4:9: a binary field without size is only allowed at the end of a binary pattern
uh probably in a normal langauge it is
nvm i hate erlang
im doiing uiua
how dare you steal my leaderboard spot smh my head
do u want my parser
sawry
4 is just that spot that isnt 1st 2nd or 3rd but just a failure
rea
can do inside functions
ok 5th placer..
i feel like there's a better way to do this but it wouldnt come to my head
LOl
kill me
u need to remove games that have too many of certain colors pretty much
o
did it like this too
whats the limit
you love null byte
i give up
rust is dogshit to do aoc in

i regret doing C#
without a proper project this is hell
The Elf would first like to know which games would have been possible if the bag contained only 12 red cubes, 13 green cubes, and 14 blue cubes?
@somber smelt are these the limits
i spent an hour and got absolutely fucking nowhere
regex doesnt work
cant find a single sequential reading lib for rust
meh its not that bad for me
yes
oh
just a shit ton of unwraps
swift is kinda nice to do this in
if r > 12, drop game
if g > 13, drop game
if b > 14, drop game?
b/c I don't have time for proper error handling
This is my parser:
||```ts
console.log(input.split("\n").map((game) => game.split(":")).map((x) => x.map((y) => y.replace(/\s/g, ""))).map(x => [+x[0].replace("Game", ""), x[1]]).map(x => [x[0], x[1].split(";")]).map(x => [x[0], x[1].map(y => y.split(","))]));
ye u go over each game's draws and check for that
I think thats just your regex
okay
mine works fine, if I split the lines into easier to parse sections
split is your friend not ur enemy
yeah
initially I started writing the ultimate regexβ’οΈ trying to parse a single line in one go then realized I was stupid
loops are very cool things that don't translate well into regex
yes
as I said, it becomes 10x easier if you just split the picks manually
then regex them
it's something to do with nested groups
and I have no clue how to fix it
regex is not worth it for aoc tbhhhh
i only use regex for strings that are funny
use harmony instead 
unregular expressions
is that like a grammar builder and parser
oh bleh
I love it when rust crates literally just invent their own syntax through the dark magic of macros
its so funny
why is the lsp server not doing anyhting
long solution, give me a minute to clean it before committing it, then I will link
wtf
wtf did u cook..
how did i get 21 as my total
mine was sub 100 lines
test data result should be 8
IT KEEPS THROWING ERRORS
54 lines :p
greater than 40 lines is long for me
@warped dust@warped dust@warped dust
I just need time to fix variable names and make typescript happy
how am i getting 10
71 lines including whitespace and function boundaries for p1
i will feed rini to the flies
