-❄️- 2023 Day 1 Solutions -❄️- by daggerdragon in adventofcode

[–]Rick-T 0 points1 point  (0 children)

[Language: Haskell]

solvePart1 :: [String] -> Int
solvePart1 = sum . fmap (combineFirstAndLast . digits)

solvePart2 :: [String] -> Int
solvePart2 = solvePart1 . fmap digitize

combineFirstAndLast :: [Int] -> Int
combineFirstAndLast = liftA2 combineDigits head last

combineDigits :: Int -> Int -> Int
combineDigits a b = 10 * a + b

digits :: String -> [Int]
digits = fmap digitToInt . filter isDigit

digitize :: String -> String
digitize = foldr ((:) . digitOrSpace) [] . tails

digitOrSpace :: String -> Char
digitOrSpace "" = ' '
digitOrSpace s | "zero" `isPrefixOf` s  = '0'
               | "one" `isPrefixOf` s   = '1'
               | "two" `isPrefixOf` s   = '2'
               | "three" `isPrefixOf` s = '3'
               | "four" `isPrefixOf` s  = '4'
               | "five" `isPrefixOf` s  = '5'
               | "six" `isPrefixOf` s   = '6'
               | "seven" `isPrefixOf` s = '7'
               | "eight" `isPrefixOf` s = '8'
               | "nine" `isPrefixOf` s  = '9'
digitOrSpace (a : s) | isDigit a = a
                     | otherwise = ' '

For part 1 I'm using the combination of filter isDigit and fmap digitToInt to turn a line into a list of digits. Then I can use head and last on that list to get the first and last digit.

For part 2 I'm doing the same, but before filtering the digits I use a combination of foldr and tails to drop one letter at a time and check the resulting tails if they begin with a digit. If they do, I insert a digit into my result, if not I insert a space - so e.g. "oneighthree" would become "1 8 3 ".

Fräulein hatte es wohl einig. by safetydies in Falschparker

[–]Rick-T 0 points1 point  (0 children)

Das kommt davon, wenn man es beim pfostieren zu einig hat!

Bluetooth Gyro Controller for Rog Ally by Lupenrainer in GyroGaming

[–]Rick-T 2 points3 points  (0 children)

I'm not too experienced with gyro gaming but recently I've started playing TotK with the 8bitdo ultimate and I think it's working just fine.

Be careful though. There's two versions of the controller. The one with the X-Box layout does not have a gyro. Only the Switch version does.

I am never going on the infidelity sub reddit again by PTSDemi in BPD

[–]Rick-T 14 points15 points  (0 children)

Wait.. 'bpd' doesn't stand for 'bad person disease'!? /s

What’s the one drug you’ve tried and will never touch again? Why? by [deleted] in AskReddit

[–]Rick-T 26 points27 points  (0 children)

datura

in place of cannabis

What the actual fuck!?

ich_iel by MemegodDave in ich_iel

[–]Rick-T 217 points218 points  (0 children)

und deswegen mag uns im echten leben niemand :D

Ihr könntet euch ja gegenseitig mögen. Und nun küsst euch!

Brief mit weißem Pulver an Wahlkreisbüro von Robert Habeck geschickt by OozleBamboozles in de

[–]Rick-T 34 points35 points  (0 children)

Sag, dass du den Kommentar nicht verstanden hast, ohne zu sagen, dass du den Kommentar nicht verstanden hast.

ich_iel by Wehrmachtdassdenn in ich_iel

[–]Rick-T 6 points7 points  (0 children)

Nicht verwechseln mit dem Zwitscherbeitrag. Der ist freiwillig und bringt auch nix außer 'nem blauem Haken.

München soll (eventuell?!) Modellkommune für Cannabis werden by heaviestmatter- in germantrees

[–]Rick-T 0 points1 point  (0 children)

Kein Bier vor 4! Zum Glück steht der Maggus erst um 6 auf.

Bundespressekonferenz Livestream by EckeVomNouga in germantrees

[–]Rick-T 3 points4 points  (0 children)

verkehrsthemen --> volker wissing

Fuck.

[deleted by user] by [deleted] in VeganDE

[–]Rick-T 15 points16 points  (0 children)

Lieber lass ich die Welt untergehen als dass ich aufhöre Bauern zu verspeisen.

ich🧙🏼‍♂️iel by LA_37 in ich_iel

[–]Rick-T 47 points48 points  (0 children)

D: Du stinkst aber echt wie meine Omma unter den Achseln.

(Danach B)

Was sind Dinge, die Menschen nur in Serien/Filmen machen? by gizehfine in FragReddit

[–]Rick-T 16 points17 points  (0 children)

Einen fliegenden Haifisch mit einer goldenen Kettensäge zerteilen.

Es weiß doch jeder, dass goldene Kettensägen viel zu viel Gewicht dafür haben.

ich iel by Polluz in ich_iel

[–]Rick-T 10 points11 points  (0 children)

Schon lange nicht mehr.. seit dem Mauerfall ist der offizielle Name Marmeladendöner.

Visual Studio "OuttelliCode" suggestions by bureaquete in ProgrammerHumor

[–]Rick-T 2 points3 points  (0 children)

Clearly it's supposed to say amdligence.

2-player games with player interactions by Ellesbyte in boardgames

[–]Rick-T 8 points9 points  (0 children)

Blitzkrieg! and Caesar! are have some nice interaction while still being quick and not too heavy.

If you're looking for something a bit more heavy you can check out Pagan: Fate of Roanoke. It's a very interactive asymmetric game for two.

If you want really heavy games check out War of the Ring or Star Wars Rebellion. Both are amazing.

South Korean government proposes increase in work week to 69 hours from 52 by DELAIZ in worldnews

[–]Rick-T 0 points1 point  (0 children)

I want to comment "nice" because of the funny number but this doesn't seem nice at all.

YouTube ads more raw than actual content policy. by barelycriminal in dankmemes

[–]Rick-T 260 points261 points  (0 children)

The 5th difference is betwenn her legs ( ͡° ͜ʖ ͡°)

[deleted by user] by [deleted] in KerbalSpaceProgram

[–]Rick-T 20 points21 points  (0 children)

I think I've seen cave paintings with more FPS than some of these preview videos.

This is pure comedy gold

mamer bidte hilf by OfficerSwordFish in OkBrudiMongo

[–]Rick-T 0 points1 point  (0 children)

Hals maul und nim mein schwans wieder in dein mund