24 ms·
Advent of Code 2021
- Mountain_Skies 5y agoIf you enjoy Advent of Code, be sure to check out their sponsors. Not only because their support helps make AoC possible but also because they often have their own coding challenges that can be a fun compliment to AoC itself.
- Barrin92 5y agoEric Wastl who makes Advent of Code also made the Synacor Challenge (https://challenge.synacor.com/ https://challenge.synacor.com/) a bunch of years ago which is similar to the Intcode AOC problems and a lot of fun.
- Mountain_Skies 5y agoNice, now I'll have something to do in January while going through AoC withdraw.
- qiqitori 5y agoI don't follow AoC but I think Eric Wastl is awesome because he used to transcribe anime music (or someone with the same name). (E.g., search for 'eric wastl haibane renmei')
- tester34 5y agoI wonder how popularity of "exotic" languages increases when AoC's around F#, Lisp and so on
- riffraff 5y agoThere's always some cool stuff done with Raku, I'm giving it a chance this year as my "second language", we'll see how it goes.
- Jenz 5y agoLisp is exotic?
- Scarbutt 5y agoEsoteric is the word I would use.
- carnitine 5y agoSeriously? Lisp of all languages? Also esoteric is already applied to languages like Brainfuck which are designed to be as abstruse as possible.
- Scarbutt 5y agoYes, Lisp and F# are esoteric programming languages in the industry.
- mrtranscendence 5y agoI've only seen "esoteric" refer to programming languages that are deliberately constructed to be obscure or unusual, usually in ways that make them unusable in some practical sense. Your Brainfucks or Malbolges, say. I've never heard of anyone applying that term to Lisp or especially F#. They might be unpopular, but they're usable, practical languages with good implementations.
- ByteJockey 5y agoA lot of people consider anything not in the tiobe top 10 to be esoteric (especially for the purposes of enterprise work). Maybe obscure is a better word here?
- mrtranscendence 5y agoObscure is a good choice. I’d probably use niche. Honestly, esoteric could be a good word to describe lisp, except for the fact that it seems to already exist as a term for a category that wouldn’t include lisp.
- jarpschop 5y agoWhy would Alexandria Ocasio-Cortez' presence increase the popularity of some programming language?
- speg 5y agoAdvent of Code.
- BiteCode_dev 5y agoThat sounded like a joke :)
- gerikson 5y agoThe price of humor on HN is eternal downvotes.
- Nicksil 5y ago>The price of humor on HN is eternal downvotes. Not if its funny.
- Toutouxc 5y agoIt's important to understand that for every person familiar with the name and the abbreviation there are roughly 22 people who have no idea who she is.
- overkalix 5y agoNot particularly exotic, but the last two years I pushed myself to do them in elixir (although my solutions become progressively shoddy until I quit, usually around day 10-12). Then I promptly forget everything I've learnt because I can't introduce the language in my work.
- mcjiggerlog 5y agoIt seems like 80% of people I've heard talking about AoC are planning on doing it in Rust (including me!). It's definitely a great way to get up to speed with a language you're interested in learning.
- jstx1 5y agoIn last year's survey Rust was around 10%. It's definitely overrepresented but not quite that much.
- aunderscored 5y agoI definitely enjoyed doing rust. I'm planning on doing go, rust, and python. We'll see how well that holds up
- ducharmdev 5y agoYup, I'm doing Rust this year as well. I've worked through rustlings a couple times in the past, but haven't had many excuses to use Rust. I was proud last year when I got to day 18 with Python, but I'm setting the bar much lower this year. I don't have any experience with C/C++ (just C# and a bit of Go), so thinking more carefully about memory mgmt is new to me. But the functional aspects of Rust are pretty exciting.
- asicsp 5y agoSome create a language just for AoC, for example: https://github.com/healeycodes/adventlang https://github.com/healeycodes/adventlang
- jstx1 5y agoThere's definitely a selection effect - the type of person that will spend time on Advent of Code is also likely to be the type of person that learns and uses more exotic languages, or at least languages that aren't used that much commercially. Some stats to confirm - https://preview.redd.it/jrhlcxrzy0761.png?width=2275&format=png&auto=webp&s=6ffe20ec96234a4f9a3ed9a07a32cf2ba503a6a5 https://preview.redd.it/jrhlcxrzy0761.png?width=2275&format=... - taken from from last years' unofficial survey - https://www.reddit.com/r/adventofcode/comments/kj53l1/unofficial_aoc_2020_survey_results/ https://www.reddit.com/r/adventofcode/comments/kj53l1/unoffi...
- mikewarot 5y agoI'll balance that out for you, I do my programming in Pascal. I'm going through the old ones as well, hoping to back-fill in answers to all of them. https://github.com/mikewarot/Advent_of_Code_in_Pascal https://github.com/mikewarot/Advent_of_Code_in_Pascal
- petercooper 5y agoAPL is the language I only ever see around AoC. But it's so impressive too. Like the first part of today's solution is "+/¯1↓x<1⊖x" (stolen from someone on Reddit) and I'm like.. ok, I need to learn this language one day. (Since their solution is now being discussed, it's from here: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmsacv9/ https://www.reddit.com/r/adventofcode/comments/r66vow/2021_d...)
- maximus-decimus 5y agoand this is the solution in Q, including paring the file: `(+/) 1_ (>':) "I" $ read0 `:input_1.txt` I don't think their second solution actually works unless I'm missing something though : +/¯3↓x<3⊖x This compares every element to the the one 3 positions before it, when the question was to take the sum of each 3 elements and check if it's smaller than the previous sum.
- ollran 5y agoAPL is quite common in the code golf scene.
- Jtsummers 5y agoInteresting solution. 1⊖x Rotates the sequence so the first becomes the last. x < 1⊖x Element-wise compare each, resulting in a list of 1s and 0s ¯1 ↓ x<1⊖x Drop the last element because it's actually not part of the solution (thanks to the earlier rotation). +/ ¯1↓x<1⊖x Sum all of them, since it's just 1s and 0s this gives a correct count. Part 2 is solvable (unless I missed something, works on the sample data) by just changing two characters from that solution. Neat.
- petercooper 5y agoThanks for the explanation! I just found someone with a different approach who has similarly broken it down on Twitter: https://twitter.com/janiczek/status/1465969017089363969 https://twitter.com/janiczek/status/1465969017089363969
- 5y ago
- runevault 5y agoI've been getting back into f# lately and going to use it for AoC to give me real challenges to work on instead of arbitrary ideas, so it is certainly helping one of the mentioned for me.
- phillipcarter 5y agoI'm using it as an opportunity to try out Crystal. I have zero Ruby experience, so it's a fun experience coming in from a "no, actually, none of this is familiar to me" perspective. Nice language.
- throwawaygal7 5y agoI really like this event but wish the name would be changed to something more sensitive. Would this have been named 'Kwanzaa of code' or 'Diwali of code' or 'lesser eid of code'? Of course not
- matsemann 5y agoHow is it insensitive? In my country (Norway) there's advent calendars for everything and has been since I was a child. Home made advent calendars with a small gift each day, or store bought with a chocolate, beer, liquorice, or similar per day. There are special advent calendar TV shows, where an episode is released each day in December.
- throwawaygal7 5y agoHere you go: Advent is a season of the liturgical year observed in most Christian denominations as a time of expectant waiting and preparation for both the celebration of the Nativity of Christ at Christmas and the return of Christ at the Second Coming. Advent is the beginning of the liturgical year in Western Christianity, and is part of the wider Christmas and holiday season.
- matsemann 5y agoI know what advent is, as I said I and my fellow countrymen do loads of advent stuff. Why does that make this offensive?
- silicon2401 5y agoThere's nothing insensitive about the word 'advent'. Additionally, you are free to start a Kwanzaa of Code or Diwali of Code or both and people are free to join.
- petercooper 5y agoI had to look up the etymology and it basically comes from Latin ad-venire or "to come".. so symbolizes merely the eventual arrival of something or prelude to something.
- zora_goron 5y agoRelated thread from last week: https://news.ycombinator.com/item?id=29292818 https://news.ycombinator.com/item?id=29292818
- LandR 5y agoLike every year, I feel I'm being lured in by an overly easy day 1. Then somewhere between day 10 and 15, there will be a steep increase in difficulty and I'll tap out for the year. Then come back to the puzzles over the course of the year and maybe knock out another one or two.
- SketchySeaBeast 5y agoYup, the first couple of days are always simple, but then you're on Saturday of week 2 and wondering why it's already 4 AM.
- codingdave 5y agoAgreed - I did Day One by copy/pasting the input into a spreadsheet and calculating the answers in additional columns. I suspect I'll need to actually write code soon, though. And give up soon after that.
- jaywalk 5y agoI did the same thing. I was about to start writing some code, and then figured it would be much quicker to just drop it in Excel and write a couple formulas.
- drc500free 5y agoI usually get at least 10-15 days in using Excel, and sometimes can do the later ones as well. Some of the problems are MUCH easier this way, especially since I moved to Product years ago.
- bhrgunatha 5y agoThere are some plots [1] of the time taken for the first 100 solutions to part 1 (silver dot) and part 2 (gold dot). They're a good visual indication of the relative difficulty of each question and how the difficulty of the second part increases. [1] http://www.maurits.vdschee.nl/scatterplot/ http://www.maurits.vdschee.nl/scatterplot/
- 5y ago
- vidro3 5y agothis always sounds appealing but i really don't find these types of problems fun to do, mostly frustrating.
- penjelly 5y agodont those statements contradict eachother? it sounds appealing how? cause its a challenge exercise? But challenges are frustrating?
- anandoza 5y agoYou don't understand how something can sound appealing at first, but then in practice isn't enjoyable?
- penjelly 5y ago"always sounds appealing" implies the same thing happens every year to parent comment. either you dont enjoy it or you do? its not like the type of exercises change year to year. theyre coding challenges everytime.
- vidro3 5y agoyes, i get tricked every year. at first it's 'ooh some neat challenges to help me improve or learn new skills' then it's like, 'ugh this is annoying and i don't like it.'
- jstx1 5y agoOne of the fascinating things is reading other people's solutions. You get wild extremes - from easy clean solutions that I would never think of to some very weird choices. Especially in the first few days when the puzzles are easier it's more of the latter - there are some extreme abuses of Python in today's solutions thread on reddit. I get that it works but I also hope that nobody I work with ever writes code that way. I assume it happens more with Python because beginners are more likely to use it and because it gives you so much flexibility. On the flip side, it's a bit humbling to see people solving the difficult days extremely quickly or having very concise and elegant solutions.
- bussierem 5y agoI really enjoyed the early part of this last year, but I got to Day 19 and suddenly it became "if you memorized some mathematical concepts and an obscure algorithm and also recognize that this exact algorithm is the only efficient solution to the problem then you can solve this in 5 seconds, otherwise it will never finish running with any other algorithm". I immediately quit. I'm not doing these to prove I'm smarter than other people or memorized random math concepts, I'm doing this to practice writing code or to learn a new language. Not sure if this is indicative of other years (This is the farthest I've persisted in the 3 I've tried) but it was EXTREMELY demotivating, and killed every desire to continue or to even try it again next year. *EDIT*: Apologies, I was incorrect on the Day where this happened. It was actually Day 13, with the Chinese Remainder Theorem being the solution. I must have copy/pasted a solution in frustration and continued past that point. My mistake.
- petercooper 5y agoAt the time, I had the same thought process as you. I did eventually come back and do the rest of the days though which were surprisingly trivial in comparison! I seem to recall some people did manage to solve that day using brute force with a non modular approach though.
- bussierem 5y agoI'm quite surprised, I spent hours on multiple different solution and every single one was brutally slow.
- petercooper 5y agoMy memory is hazy, but I seem to recall it involved a lot of parallelization and running it for a couple of days on high end gear along with luck. So definitely not the intended approach! :)
- TYMorningCoffee 5y agoFor Day 13, I played around with the numbers and eventually noticed that you could increment by the product of the numbers you consumed so far.
- deleted 5y ago[deleted]
- paxys 5y agoAdvent of Code has become an annual tradition for me. I do wish that they would update their scoring in some way to prioritize something other than how quickly you can write up the solution every day at midnight when the question is released.
- estomagordo 5y agoAny ideas? The only thing I can think of is time after you saw the problem, which would work with an honor system on a social/friendly leaderboard.
- OwlsParlay 5y agoThe only thing I can think of is if they teamed up with LeetCode to allow people to use the built-in compiler to solve the problems. Obviously for the folks who use <ObscureLanguageX> this wouldn't work but it would be a nice collaboration otherwise.
- paxys 5y agoI don't know the technical solution for this, but there can be some judgement on the quality of the solution (like how efficient it is in terms of time and space). Here's an example – in part 2 of day 1 of this year (2021), there's no need to actually add up the 3 measurement range, since the middle 2 values will always cancel out. You simply need to loop through the array compare index i with i+3. Maybe there should be an extra point for people who figured this out? Another problem is that the input set is always small enough to make a brute force solution the most favorable one. So what they are really judging is the speed at which someone can read/parse the input file and write some loops.
- matsemann 5y agoSounds like https://open.kattis.com/ https://open.kattis.com/ would be right up your alley.
- the-smug-one 5y ago
- timvisee 5y agoLast year I solved all puzzles in less than 1 second. This year, for lack of a better goal, I'll be trying to do the same: https://github.com/timvisee/advent-of-code-2021 https://github.com/timvisee/advent-of-code-2021
- estomagordo 5y agoMan, it takes me longer to even read a problem statement!
- auxym 5y agoI think they mean 1 second of program execution time :)
- ta988 5y agoTry 500ms and divide by two every year
- taftster 5y agoMoore's law and all that.
- Toutouxc 5y agoI thought you were trolling at first. :)
- gray_-_wolf 5y agoTo be honest I'm amazed by the times. Mine (reasonably written C) is 4ms, so 0.025ms is quite amazing. Any idea what magic does rust do inside to achieve this speed?
- flaie 5y agoI have been solving these since years, I find it a nice way of assessing a language and deep dive since it will cover lot of parts of what makes a language. I have been porting my old solutions in other languages into Kotlin over the time, and will be again doing them in Kotlin. I find it a nice language for AOC since custom extensions and DSL possibilities, it has a good builtin libraries and you can always fallback on Java, even if it has some shortcomings. Regarding the AOC per se, I take it as a fun daily challenge, I know I won't be able to be part of the top 100, at least I would with some luck during the first 3 days, and then.. nope, that's life, try not to be too competitive. Last year it took me 8 hours to solve day 20, but it's a game, you should have fun doing it (I had), if not people should stop. However, I strive in trying to write pretty, compact, idiomatic and as functional as possible code, which means that sometimes I will write an ugly solution in 5 minutes, and will take an hour to make it beautiful. Besides I like to read the story, I know plenty of friends who don't even read the adventures of Santa, they just solve the puzzle and that's it, they don't even know they saved Christmas :-D !
- matsemann 5y agoYeah, kotlins stdlib for collections is great. Has all kinds of variants of reducing, grouping, filtering, mapping, taking, dropping etc one can think of. Today's solution was to just call the window function.
- 101011 5y agoSpoilers dude! I haven't started yet.
- Jtsummers 5y ago> which means that sometimes I will write an ugly solution in 5 minutes, and will take an hour to make it beautiful. I think I spent 2 hours last night just playing around with different methods of solving it after my initial version. Other libraries, slightly altered algorithms. I think that's one of the parts I enjoy the most, solving the puzzles is fun. Trying a dozen different variations is, for me, more fun (and more edifying).
- 5y ago
- briffle 5y agoLooks like the Sysadvent has started again today, after taking last year off. Its great for those of us on the more OPS side of DEVOPS: https://sysadvent.blogspot.com/ https://sysadvent.blogspot.com/
- WesleyJohnson 5y agoThis is the first year I'm going to participate. Not really interested in competing with anyone else, just against my own imposter syndrome. Based on the responses regarding the obscure algorithms you may need, I'm no longer confident I'll win against him either.
- Toutouxc 5y agoLook at this this way: other solid, good, honest programmers (just like you) on HN and reddit agree that some AoC puzzles require obscure algorithms, and they also get stuck on those.
- uyt 5y agoIf you're doing AoC you should join the subreddit /r/AdventOfCode: https://www.reddit.com/r/adventofcode https://www.reddit.com/r/adventofcode There's usually a lot of different solutions (including many in esoteric languages or code golfed) along with screencasts and visualizations to explain how they got there. I find that even when the puzzles are easy I still learn a lot from the community by seeing all the different ways to skin a cat!
- kewpiedoll99 5y agothose poor cats.
- the_only_law 5y agoI was going to do something fun, but gimmicky and try to implement them all in like SPL/2100 on an emulator running RTE, but quickly found I'd end up spending the month learning the latter. I've been trying to think I've something, else fun to do or maybe use a language I've been itching to try, like Ada, but I’m not sure any of the questions will be of a nature to let me utilize the strengths of that language and I fear it will all end up being really boring procedural algorithms. I can think of a ton of other gimmicky solutions, but none that are very fun.
- shever73 5y agoIt's great to have AoC back again. Last year was my best yet, where I managed to get up to day 23. This year, I'm focusing on keeping the solution to as few lines of code as possible.
- boutell 5y agoTackling it in TypeScript this year, which is interesting because I haven't used TypeScript before (I'm experienced with JavaScript). This is a good way to really drill it into my fingertips. If you care to follow along: https://github.com/boutell/advent-of-code-2021 https://github.com/boutell/advent-of-code-2021
- volfied 5y agoI recommend using a runner like https://github.com/caderek/aocrunner https://github.com/caderek/aocrunner, so you can focus on coding, rather than project set up.
- penjelly 5y agotsc file.ts && node file.js is pretty simple but yeah.. i guess as the scope increases it may require a dist folder or scripts edit: wow nevermind im seeing a sibling comment here is using the browser and it looks like a major headache..
- kryptiskt 5y agoI'm also doing it in Typescript this year, but I'm doing it in the browser to get a little modern web experience (I'm a C++ developer by day). I have a pretty nifty setup with Snowpack that will rebuild it and refresh the browser automatically when I save, and a little scaffolding for making a widget for a problem, I don't use a framework: https://github.com/melted/aoc2021 https://github.com/melted/aoc2021.
- Toutouxc 5y agoI'd like to remind everyone that it's totally okay to do the first 10-15 days and leave the really hard stuff to people who are smarter or maybe have more free time. The first few days will still be fun. I'm checking out Elixir this year, because I write 95 % Ruby at work and I'm getting really intrigued by the functional stuff seeping into it.
- SketchySeaBeast 5y agoAlso, you can be strategic, the weekend ones are built to be longer than the weekday ones, so there's still some fun to be had later on even if you get stuck.
- thanksfortherem 5y agoThanks for the reminder, guy who knows Ruby and is learning Elixir and makes authoritative comments.
- qsort 5y agoIt's also okay to just do the problems without the competitive aspect. I love competitions and all, but sure as hell I'm not waking up at 5AM for an entire month in the pursuit of internet points.
- mumblemumble 5y agoMy main use case for AoC is practice with new languages. So I tend to prefer to do the same one from several years ago over and over, because then I can focus on grokking the language and not the problem, and I can compare my solutions across languages to get a better feel for how they affect how I solve problems. The leaderboard is occasionally interesting to me for the first week of December, but, realistically, I can't see getting invested in it without also moving far, far to the west of where I live now.
- andreineculau 5y agoThought about that last year. You wouldn't have your solutions public but any chance?
- sdevonoes 5y agoOnly reason I don't do Advent of Code is because you have to wake up at 5-6am in Europe. I barely can make me a coffee at that time.
- Jtsummers 5y agoYou don't have to wake up early, only if you want to be part of the 100 first solvers. I gave up on that after my first year, if I can't solve it at night (10pm my time now, used to be midnight) in less than an hour, I punt to the next afternoon.
- ZoomZoomZoom 5y agoSome need to wake up early just to complete a task before the next one appears.
- jstx1 5y agoThe global leaderboard really isn't the point for most of the people who do AoC. You can always do the puzzles later in the day.
- nineplay 5y agoI love Advent of Code. As I sit here trying to prepare for my next set of 'leet' interviews, I wish employers could switch over to this style of tech questions. Advent of Code requires good coding and problem solving skills. Leet coding requires you to memorize every operation for dozens of data structures like how to insert elements in a min heap. ( Insert elements at the end and swap with the parent until the tree is correctly ordered again. Good luck figuring this out in 20 minutes if you don't know it ahead of time. ) ( Now prepare yourself to remember how to insert/delete/search for elements in every other data structure with any number of different qualifiers when it's not going to be obvious at the outset of the question what kind of data structure to use ) ( Oh and make sure you've memorized the time and space complexity ) ( Not that I'm bitter or anything )
- kristaps 5y agoMy current company actually did just that - I got to solve two AoC2020 puzzles for my code sample.
- nouveaux 5y agoDo you mind sharing what company did this? Seems like a great place to work?
- weatherlight 5y agoooo what day where the puzzles from?
- jhenkens 5y agoI'm there with you 100%. I just took a break after 6 years of consecutive employment. Apparently I did well at my job - remained an IC, but was given more recognition via titles and more and more cross-org design meetings. But now after 6 years of solving hard big scale problems, I've got to come back to how to interview for companies again. Incredible waste of time spending days studying leetcode, interviewing for companies I'd likely not work for just to practice skills I haven't needed in 6 years.
- pedrosorio 5y ago
- deleted 5y ago[deleted]
- patrickdavey 5y agoI love adventofcode. I have a rule I follow now which makes it a lot more enjoyable: if I can't make headway on a problem after trying for a day or so, I'll use the subreddit to find a hint, and then usually that's enough to help me to the answer. Very occasionally I just completely cheat (often the pure math based questions). I don't like missing out on the stars.... I mean it's the only way you get to see the awesome ascii art when you collect all 50 for the year. Many thanks to Eric and team for what must be a huge effort to run such a fun programme. Oh, the other thing I do: I don't even start until sometime in January :) far less stress and keeps the whole family much happier ;)
- floitsch 5y agoPerfect time to explore Toit (http://github.com/toitlang/toit http://github.com/toitlang/toit) :)
- Cyphase 5y agoAnyone who's interested is welcome to join the group in #adventofcode on Libera.Chat. We hang out there and in the spoilers channel, especially around and for some hours after the release time each day. Lots of interesting discussion goes on. A lot of people aim for the leaderboard (which is certainly not required), then afterwards discuss solutions, optimizations, rewrites, edge cases, and more. We also have an IRC leaderboard (the AoC site has a private leaderboard feature). It's all good fun! Disclosure, just in case: I'm one of the ops in the channel.
- orange_puff 5y agoThis is my first year participating. I've solved about 20-30 questions from previous years and really loved them. I tried to compete last night for top 100 and was 7 seconds off (rank 123). I shouldn't have tested my code for the first problem because it was too trivial!! But, that gets the competitive aspect of this challenge out of the way immediately so I can simply have fun with these problems :) I am excited for them to become a bit more challenging because my friend and I are going to work on them together.
- clircle 5y agoI'm using Advent of Code this year to learn Common Lisp. I started doing the 2015 exercises a few days ago, and I'm having the most fun you can have with a computer.
- kemiller 5y agoI love these puzzles, and I'm grateful they only let you do two per day or I'd never get any work done.
- exdsq 5y agoRust this year! We should have a daily HN post to share our solutions for open code reviews :)
- Jtsummers 5y agoThey have a daily mega thread for solutions over on Reddit: https://www.reddit.com/r/adventofcode/ https://www.reddit.com/r/adventofcode/ https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/ https://www.reddit.com/r/adventofcode/comments/r66vow/2021_d... It's interesting to see the various solutions, especially when you realize, "Oh, duh, I did more work than necessary." and can go back and improve your own with the new knowledge.
- exdsq 5y agoMy Rust implementation was horrible! First time I'd written Rust. It's fun to see peoples far better Rust solutions or, amazingly, the most recent solution that was in Powershell!
- Jtsummers 5y agoMine was delightfully mediocre. No actual blunders, but several missteps that I removed later (like calling enumerate and then in the next step using map to remove the index...). I've written some Rust in the past but it's been long enough I only remember the basic language syntax, not the libraries.
- jodrellblank 5y agoRust looks like a very popular choice this year: https://aocweb.yulrizka.com/?year=2021&day=1&language=Rust https://aocweb.yulrizka.com/?year=2021&day=1&language=Rust
- whalesalad 5y agoI wish I could take a month off from my client obligations to jam on stuff like this. I always get started - make it a few rounds - and then get crushed by the pressure of everything else. These sorts of games are so fun with TDD. Red. Red. Red. Red. .... Green! Anyone here currently on any kind of sabbatical to just decompress and learn new stuff?
- joshgrib 5y agoSeconding this as a great time to use/try TDD! Every problem comes with a small sample input and output, so you get a test case for free
- w-m 5y agoAnybody interested in getting a just-for-fun HN user leaderboard going? Here's my code: 194284-90c48b41 In the last couple years I usually stopped up after a few days when I didn't find the time to do one of the puzzles or got stuck with the Rust borow checker. Maybe having a leaderboard helps with the motivation to keep on going! :)
- Cyphase 5y agoHaving a fun group to do it with does. Come join us in #adventofcode on Libera.Chat! We also have an IRC leaderboard.
- gmfawcett 5y agoThanks for the open invite. I probably won't finish until February or so, but I'll cheer you on in the meantime!
- akpa1 5y agoThanks for the invite, looking forwards to playing! Personally, joining leaderboards like this certainly help with motivation, though I couldn't say why.
- YoungWeb 5y agoThis is my first time encountering this and I like it. I am looking forward to completing these this month.
- MYEUHD 5y agoIs it considered cheating if I use another program (such as wc) to know the number of lines in the input file?
- saagarjha 5y agoWhen I download my input data I have it print out the number of lines in the process. I find this to be quite helpful, in general.
- Mountain_Skies 5y agoThat's for you to decide but the point of the exercise, besides having fun, is finding a solution. If wc is something you'd use to solve a similar problem, seems reasonable to use it here too and within the spirit of the challenge.
- ninju 5y agoAny software tools are acceptable. I used Excel to solve 2021 day 1
- Cyphase 5y agoPeople have solved puzzles by hand in the past. No tool is off limit, including your brain, pen, and paper. I would say the only thing that's "cheating" would be looking up solutions to "solve" the problem faster than other people, whether they be the rest of the world on the global leaderboard (which is unlikely since the people who make the leaderboard are good about not posting solutions until it's full) or some friends you're competing with on a private leaderboard. Otherwise, let your conscience be your guide. As the saying goes, when you cheat, you're only cheating yourself.
- kryptn 5y agoNah, not in my opinion. Use whatever you want to solve the problems. Ultimately you have to submit an answer to the site for the day. Even then, if you go and look up solutions it's still up to you whether or not you call that cheating.
- reikonomusha 5y agoAoC is often used to learn a new programming language, but it can also be used to improve them—especially less established ones. Theres a small community [0] of people who decided to try out Coalton [1], which is a Common Lisp DSL that has a strict, Haskell-like type system, and has strict evaluation (not lazy) semantics. Pattern matching, algebraic data types, all that jazz are supported directly in a Common Lisp environment. For example, here is a function to read in the first problem's data, which makes use of the usual high order functions (map and filter), as well as currying (only one argument provided to /=, making it curried): (declare read-aoc-data (Unit -> (List Integer))) (define (read-aoc-data _) "Read the data for problem 1." (let ((data (fromSome "Couldn't read AOC1 data." (read-file-into-string aoc1-input-file)))) (map parse-int-or-fail (filter (/= "") (split-string #\Newline data))))) Type annotations, as in any good ML, are optional (except when there are polymorphism bugs, like one found during AoC!). Unlike Haskell, purity isn't demanded. There's a small contest [2] with all sorts of prizes for doing AoC in Coalton and contributing back to the project through tutorials, PRs, and bug reports. [0] They hang out on Discord https://discord.gg/cPb6Bc4xAH https://discord.gg/cPb6Bc4xAH [1] https://github.com/coalton-lang/coalton https://github.com/coalton-lang/coalton [2] https://coalton-lang.github.io/20211129-aoc-contest/ https://coalton-lang.github.io/20211129-aoc-contest/
- dunefox 5y agoOh man, I'm using CL for aoc this year and just figured out how to install Coalton. Maybe I'll do couple of days in it as well!
- mynameisash 5y agoI didn't know anything about AoC until just recently when I took a very brief look at the 2020 problems (but didn't deep-dive). I'm trying to find good problems that can help me learn SAT/SMT solvers, but there doesn't seem to be much out there. Anyone know how well-suited these are for AoC?
- surfer7837 5y agoAm doing it in Haskell. Every year I do it in Haskell, and then promptly forget half the language until I start it in December again
- djhworld 5y agoEnjoy doing these when I can, although probably takes me 6 months to complete the puzzles, doing them here and there. Not really into the competitive aspect, although I guess it doesn't matter that much anyway. There was on AoC a few years ago that got you to build a toy computer, to the point where you were running simple games on it. That was mind blowingly fun!
- sireat 5y agoDecided to try Golang this year. Compared to Python and Scala it is way more verbose for simple challenges as this. I almost feel like I am back in the early 1990s of writing C. I miss zip, sum, map and list comprehensions...
- WoodenChair 5y agoGo has first-class functions and now has generics. So, you can definitely implement zip, sum, map, filter, reduce, etc. The fact that they're not included in the standard library I think has more to do with the opinionated creators of the language than any limitation[0]. You can absolutely implement them yourself (and a couple of these are pretty trivial to implement) in a library as an aid. I've done that in the past. I miss them too. In fact at the link below you'll see one of the creators explicitly say they're easy to implement (and his own implementation pre-generics) but he doesn't think you should use them (Rob Pike). "Having written it a couple of years ago, I haven't had occasion to use it once. Instead, I just use "for" loops. You shouldn't use it either." 0: https://github.com/robpike/filter https://github.com/robpike/filter
- Jtsummers 5y agoLooking at it, I wouldn't want to use it either. It seems to add a lot of overhead. In the first 15 lines of the function it's mostly implementing type checking at runtime using reflection. Every single time this is used it would redo that type checking. In most statically typed functional languages that would just be done once at compile time and the implementation would be the equivalent of the last 7 lines or so. I imagine with generics it could be greatly simplified, but I don't know Go well enough to venture how it would be done. Though if it weren't faster than that version I'd be shocked. For clarity, I was looking at reduce.go, all the others seem to do similar tricks with reflection that would also add overhead that generics should eliminate.
- WoodenChair 5y agoRight, using generics all of the reflection should be unnecessary and the implementation should be much simpler and more performant.
- Xavdidtheshadow 5y agoAoC is one of my favorite events of the year. I find the puzzles to be much more approachable than things like Project Euler. I regularly credit my yearly participation for making me a better programmer. I also do a daily writeup of my solution, which helps make sure I understand the problem and help others who are learning. I found it super rewarding last year, so I'm doing it again this year. They're in my GH repo. Here's today's: https://github.com/xavdid/advent-of-code/tree/main/solutions/2021/day_1 https://github.com/xavdid/advent-of-code/tree/main/solutions... My big tip is that you probably don't need to worry about competing for the leaderboard (unless you really want to). Go at your own pace, don't stay up weird hours, and take a break.
- Waterluvian 5y agoI respect that AoC gets very difficult and is for an audience that isn’t me. But I love the format and what I’d enjoy is a similar project where the difficulty doesn’t really increase, but each day is a different problem domain. Breadth not depth. For example, perhaps we start with some data processing from a file. Then answer some basic statistics question about the data. Then maybe some basic signal processing. We form an image. We transform the image. We play the image as audio. We break it into packets of some sort then share it on a “network.” We reassemble it. We build a state machine and pass it the reassembled data in some way. We discover some new output. Etc. etc. culminating with some fun discovery that inside that original data was a secret code or whatever. And instead of an intense challenge, we’ve just had a fun walk through an intro to two dozen subdomains of CS/sweng. You may not have immediately known the answer to each puzzle but you never felt lost.
- zerr 5y agoInteresting, what kind of difficulty is it? Does one need to know some particular theory topics, e.g. Computational Geometry or advanced/exotic data structures & algorithms? Or is it about the size/complexity of the solution? Or is it an A-ha moment?
- cjbprime 5y agoOn the very easy end of tech interview style problems, requiring almost no computer science theory yet having concrete solutions, but there's a split between part 1 and part 2 of each challenge, and one of the most interesting parts is having to abstract the first solution to accomodate the second (which might e.g. introduce a new constraint or scale up the problem).
- d_burfoot 5y agoAoC starts easy and gets harder over the course of the month. Having done both tech interview problems and AoC, I can assure you that the later AoC questions are not on the "very easy end".
- Waterluvian 5y ago
- GabeIsko 5y agoMore like, advent of excel
- nnoitra 5y agoCopilot came up with? Nah, it really did not. Some poor soul on GitHub did though and wrote good documentation for it. God bless them.
- nnoitra 5y agoWhat is this Advent Of Code for?
- macintux 5y agohttps://adventofcode.com/2021/about https://adventofcode.com/2021/about In short, it's a creative set of challenges released once/day for 25 days during December. It's also a creative community of people solving the problems (sometimes programming, sometimes with other tools, even just pencil & paper) and more than that creating visualizations and new programming languages, learning new programming languages... It's just a fun ride. To me it's the digital equivalent of RAGBRAI, which is a rolling party across Iowa each year that happens to be on bicycle. Advent of Code is as much about the community as the problems. (Minor wording edit.)