Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
akadajet
Sep 14, 2003

akadajet posted:

it’s almost time

yeah, time to pretend leetchode is fun and interesting

Adbot
ADBOT LOVES YOU

MrQueasy
Nov 15, 2005

Probiot-ICK

akadajet posted:

it’s almost time

https://twitter.com/ericwastl/status/1728651939653538074

https://twitter.com/ericwastl/status/1728654506764710172

fack you
Sep 12, 2002

For Life

DrPossum posted:

more like advent of chode

MrQueasy
Nov 15, 2005

Probiot-ICK
less than 24h!

I just love this event so much. Can’t wait to see the ridiculous saving Christmas scenario Wastl has come up with this year.

akadajet
Sep 14, 2003

MrQueasy posted:

less than 24h!

I just love this event so much. Can’t wait to see the ridiculous saving Christmas scenario Wastl has come up with this year.

and the crowd chants....
chode! chode! chode! chode!

MrQueasy
Nov 15, 2005

Probiot-ICK

akadajet posted:

and the crowd chants....
chode! chode! chode! chode!

oh poo poo! sorry (turns around and an exaggerated zipper sfx plays)

echinopsis
Apr 13, 2004

by Fluffdaddy

DrPossum posted:

more like advent of chode

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

DrPossum posted:

more like advent of chode

Armitag3
Mar 15, 2020

Forget it Jake, it's cybertown.


can't wait for someone to try and do all the challenges with chatgpt

MrQueasy
Nov 15, 2005

Probiot-ICK

Armitag3 posted:

can't wait for someone to try and do all the challenges with chatgpt

That happened last year. The site is asking people not to take up leaderboard positions with AI solvers this year.

Armitag3
Mar 15, 2020

Forget it Jake, it's cybertown.


MrQueasy posted:

That happened last year. The site is asking people not to take up leaderboard positions with AI solvers this year.

like I said...

Cybernetic Vermin
Apr 18, 2005

the leaderboards are nonsense. and i don't say that just because i am not getting up for 6am this year.

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
I'm gonna try it in Rust this year, so that I can clear some cobwebs off of my resume and learn something new

Cybernetic Vermin
Apr 18, 2005

i'm going *explicitly* least-resistence this year. don't have that much time to spend but intend to get it all done, so no time to get fancy.

MrQueasy
Nov 15, 2005

Probiot-ICK

Cybernetic Vermin posted:

i'm going *explicitly* least-resistence this year. don't have that much time to spend but intend to get it all done, so no time to get fancy.

my favorite part is that once the problems are out, they stay up and you can still submit an answer years later.

MrQueasy
Nov 15, 2005

Probiot-ICK
third place in our leaderboard on day 1! :woop:

Second part threw me for a loop.

Cybernetic Vermin
Apr 18, 2005

surprisingly tricky for a day 1 yeah, e.g. not quite pure primitives given overlaps can trip things up.

personally i don't care for doing them years later, i plan to attempt to keep strict same-day-solve. but being fairly busy this december that'll probably be difficult enough without learning much new.

josh2112
Jul 25, 2007
Is that a meteor? That's a cool meteor.
twone

MrQueasy
Nov 15, 2005

Probiot-ICK
:argh::argh::argh:

Hed
Mar 31, 2004

Fun Shoe
I tried to get a private leaderboard going at my work and I think everyone else gave up when they saw part 2.

Cybernetic Vermin
Apr 18, 2005

Hed posted:

I tried to get a private leaderboard going at my work and I think everyone else gave up when they saw part 2.

i rather liked it for my own enjoyment, but i had exactly that thought "wow, real early for a short of tedious parsing exercise" for most people

MrQueasy
Nov 15, 2005

Probiot-ICK
day 1 has usually been a parsing or straightforward math problem

part 2 was surprisingly difficult imo because it was difficult to debug, not necessarily because what was needed was overly tricky

Cybernetic Vermin
Apr 18, 2005

MrQueasy posted:

day 1 has usually been a parsing or straightforward math problem

part 2 was surprisingly difficult imo because it was difficult to debug, not necessarily because what was needed was overly tricky

as noted i think the issue is that most would reach for the primitives provided by their standard library, and be a bit flummoxed by "returns an iterator providing the *non-overlapping* matches". it is for sure a bit more steep than the last few years.

which is not necessarily bad. but it is new for day 1 i think.

echinopsis
Apr 13, 2004

by Fluffdaddy

akadajet posted:

has anyone said “advent of chode” yet?

Cybernetic Vermin
Apr 18, 2005


gently caress you

Pinterest Mom
Jun 9, 2009

MrQueasy posted:

day 1 has usually been a parsing or straightforward math problem

part 2 was surprisingly difficult imo because it was difficult to debug, not necessarily because what was needed was overly tricky

it was especially tedious to debug I think because the example data didn't have hard cases

Asleep Style
Oct 20, 2010

Pinterest Mom posted:

it was especially tedious to debug I think because the example data didn't have hard cases

all my tests pass but there's still something wrong with my part two solution. I'm sure it's something dumb but I've been combing through my debug output for a while trying to find a line that's being parsed incorrectly

this puzzle feels specifically like it's meant to be tricky for chatgpt do solve directly given all the trouble it has with prompts like "how many times does the letter p appear in the word prompt?"

e: sorted it. it was several dumb things

Asleep Style fucked around with this message at 01:26 on Dec 2, 2023

Petanque
Apr 14, 2008

Ca va bien aller
enjoyed remembering how haskell worked for the first time in 11 months, and also making it nice and succinct. fits neatly into a standard terminal window

code:
import Helper
import System.IO
import Data.Char
import Data.List

parseNum :: String -> Int
parseNum x
    | firstDigit x = (digitToInt . head) x
    | otherwise = maybe 0 (+1) $ findIndex (flip isPrefixOf x) l
    where firstDigit = (&&) <$> not . null <*> isDigit . head
          l = ["one","two","three","four","five","six","seven","eight","nine"]

calibrate :: (String -> [Int]) -> String -> Int
calibrate foo = sum . map (calibration . foo) . lines
    where calibration = (+) <$> head . reverse  <*> (10 *) . head

main :: IO ()
main = do
    let part1 = map digitToInt . filter isDigit
    let part2 = filter (/= 0) . map parseNum . tails
    run $ calibrate part1 
    run $ calibrate part2

MrQueasy
Nov 15, 2005

Probiot-ICK

Cybernetic Vermin posted:

as noted i think the issue is that most would reach for the primitives provided by their standard library, and be a bit flummoxed by "returns an iterator providing the *non-overlapping* matches". it is for sure a bit more steep than the last few years.

which is not necessarily bad. but it is new for day 1 i think.

Most good languages have a find-last in their stdlib these days.

toiletbrush
May 17, 2010

MrQueasy posted:

Most good languages have a find-last in their stdlib these days.
Find last doesn't work for Day 2, though.

I'm also stuck on Day 2, all my tests pass, I get the expected result from the example, but my final answer is wrong. I've checked the first ~100 lines and they're all correct...

...oh, maybe it does, and thats why my answer is wrong. doh.

toiletbrush fucked around with this message at 02:18 on Dec 2, 2023

MrQueasy
Nov 15, 2005

Probiot-ICK

toiletbrush posted:

Find last doesn't work for Day 2, though.

I'm also stuck on Day 2, all my tests pass, I get the expected result from the example, but my final answer is wrong. I've checked the first ~100 lines and they're all correct...

It does with a regex? \d|one|two|three|four|five|six|seven|eight|nine

DIFFERENT HINT:
search your puzzle for oneeight, sevenine, fiveight, twone

BIGGER HINT:
1oneight => 18, oneight1 => 11

MrQueasy fucked around with this message at 02:20 on Dec 2, 2023

toiletbrush
May 17, 2010

MrQueasy posted:

It does with a regex? \d|one|two|three|four|five|six|seven|eight|nine
So the line I'm stuck on is...
szsvltgsc1onecccbfour3oneightfh

Should the answer be 11 or 18? I assumed it was the first, because one of the examples says zoneight234 should give 14

Edit: cool, thanks...it should be 18. I wish they'd made one of the examples make it explicit.

toiletbrush fucked around with this message at 02:24 on Dec 2, 2023

Pinterest Mom
Jun 9, 2009

toiletbrush posted:

So the line I'm stuck on is...
szsvltgsc1onecccbfour3oneightfh

Should the answer be 11 or 18? I assumed it was the first, because one of the examples says zoneight234 should give 14

18. if you have a line that's *just* xxoneightxx, that also parses as 18 because both "one" and "eight" count there.

Archduke Frantz Fanon
Sep 7, 2004

MrQueasy posted:

Most good languages have a find-last in their stdlib these days.

:negative:

Archduke Frantz Fanon
Sep 7, 2004


well now i have a better understanding of how to work with regex in typescript :shepicide:

MrQueasy
Nov 15, 2005

Probiot-ICK

Archduke Frantz Fanon posted:

well now i have a better understanding of how to work with regex in typescript :shepicide:

I am truly sorry for your lots. I couldn't figure out where find-last lives in the kotlin stdlib so I just ran find-first starting from each index of the string because each one was pretty short, and there weren't many lines

Achmed Jones
Oct 16, 2004



im not doing advent of code but instead of running a bunch of find-firsts i'd reverse the string and use find-first on eno, owt, etc.

"why would you do that, achmed?" you ask. "that's deranged"

"because you can't stop me"

MrQueasy
Nov 15, 2005

Probiot-ICK

Achmed Jones posted:

im not doing advent of code but instead of running a bunch of find-firsts i'd reverse the string and use find-first on eno, owt, etc.

"why would you do that, achmed?" you ask. "that's deranged"

"because you can't stop me"

Solving things this way is very satisfying and advent of code often gives me the opportunity

cool av
Mar 2, 2013

Achmed Jones posted:

im not doing advent of code but instead of running a bunch of find-firsts i'd reverse the string and use find-first on eno, owt, etc.

"why would you do that, achmed?" you ask. "that's deranged"

"because you can't stop me"

i asked copilot chat to solve part 2 and it did this but without reversing the searched strings

Adbot
ADBOT LOVES YOU

MrQueasy
Nov 15, 2005

Probiot-ICK
you could also tailrec backwards splitting the string into beginning/end and just look for the end to start with a match

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply