Previous thread: adventofcode.com/ >Advent of Code is a series of small programming puzzles for a variety of skill levels. They are self-contained and are just as appropriate for an expert who wants to stay sharp as they are for a beginner who is just learning to code. Each puzzle calls upon different skills and has two parts that build on a theme. You need to register with an account but you can appear as anonymous.
Private leaderboard join code:
368748-e33dcae3
People who are inactive for 5 days will be kicked, but other leaderboards can be made if desired.
Alternative leaderboard for those waiting for inactives to be kicked from the first:
That's me. The puzzles have been very easy but if you're a codelet of similar levels you can still find a fair amount of challenge in them.
Carter Thompson
yeah man just just email your solution to tonight's puzzle to tim cook and zuckerberg, i'm sure they'll get you set up
Nathan Butler
>not already using https everywhere they deserve it.
James Baker
ftp://actualautism.lmao
John Miller
Python should be banned from AoC
Jordan Martin
>using an extension for common sense lmfao rude
Carson Richardson
I'd do it in C but I haven't reached the part of the book yet that explains how to implement hash maps.
Angel Stewart
I think what should be done instead is a refactoring of scoring, some people don't know much more than Python, it is *the* "I don't program" language of today and schools widely adapt it. It just so happens you can make things in it ridiculously fast.
it redirects all http to https whenever possible, it's convenient and you can't fuck it up
Ethan Long
Top guy is doing it in ruby IIRC
Connor Carter
"ridiculously fast" as in prototyping than yeah for sure, but I cringe every time I have to open up a python based GUI tool. Electron runs better ffs.
Cameron Hughes
thanks man, I've been looking for a job for ages now
Parker Myers
you got a college degree or some kind of portfolio?
Julian Jones
depends on what electron program you're talking about, some can be really optimized like vsc then there's shit like atom or even discord. for gui, python is just not suitable and people who use it to make games, god, why.
Andrew Roberts
i have a crappy video game I made a few years ago on my github, other than that it's barren, but I have been working on two video games in the last couple years that aren't on there none of that gamemaker/godot/unity crap though
Joseph Thompson
what you mean? raw C/C++?
You should learn marketable skills my dude
Anthony Morris
>I'd do it in C do it faggot
i've been doing them in C++ with zero experience, though I know Java, C#, F#, Python, Lisp. i try to finish fast, but that's not my goal. learning is.
it's a good way to learn a new language because a) you've worked through the problem b) you can then read how the wizards did it c) ??? d) profit
Oliver Martin
first in python, then lua with love, and now C with sdl what should I learn? I also don't want to make video games anymore, it sucks
Nolan Edwards
>what should I learn? well what do you like to do? web? mobile apps? back/front end development? compilers?
Connor Cox
all I've done is video games, I know I would hate webdev from looking into it awhile back, at least front end I guess compilers? I liked doing all the file parsing I did so far with my games
Jeremiah Rogers
nah for real I haven't even got pointers down yet, I really want to practice more shit in C outside of the K&R exercises but I find anything real just requires knowledge I don't have yet, and I don't want to half learn it by reading the minimum amount to get something to compile, I want to read through it properly when I get to it in the book.
Asher Lopez
>I haven't even got pointers down yet why they're just variables that point to addresses and tell you what's there with the * operator don't be scared lol
Ethan Reyes
Agreed.
Ruby too. And I fucking love Ruby. Either that or leaderboards need to be split up by language category if you want a "leaderboard". Like if you do everything in Python you get put on the "python" leaderboard, but if you mix languages you get put on the "mixed" leaderboard, and for every answer you give you have to include the source file.
Asher Rivera
Just throw CVs until you get an interview with some HR dumb retard that doesn't ask a single coding question, and answer "yes" to everything
Luke Reed
Why would I use Ruby in 2018? Not attacking, I genuinely don't know where it's used these days. It looks kinda cute
Would be hard to verify without compiling it through their website.
Else you'd have to make the source file public so people can report when someone uses a python script in the C group.
But then that's a whole other headache.
Jaxon Ross
I know /what/ pointers are I just don't know how or when to use them in programs yet, and when I get to chapter 5 of the C book, I will.
Gabriel Russell
It's comfy. That's literally it. Ruby on Rails is great if you want to shit out a website in 3 seconds (seriously, there's a 'scaffoled' keyword that generates the entire skeleton for a POST ready website), but Ruby in general is pretty fucking slow and doesn't have the tremendously robust library support Python has to make up for it. JRuby is pretty fast (JIT JVM compilation of Ruby code), and Ruby itself is a very, *very* smartly designed language that is probably the closest thing to a truly OOP language since Smalltalk But it's slow as shit, has no decent GUI framework to interact with (not even a good TK one), and suffers mildly from an inherited philosophy of Perl's MTOWTDI with aliasing and operator overloads.
It's a fantastic scripting language but you don't really wanna do much serious with it.
If you could be about on par with githubs language detection that'd be enough. You'd have to lump C/C++ together though since it's really hard to determine if they're different based on lexical scans alone.
Mutability.
Evan Smith
To everyone that helped me on Part 2 of Day 1, I did it! Thanks for your help!
Jordan Nelson
What do you think about Crystal (compiled Ruby)?
Robert Davis
if you know array indexing you know pointers because a[0] is *ptr and a[1] *(ptr+1) and so on. once you read up on them you will see how easy and useful they are, along with references.
Lincoln Peterson
can someone post their input and answers for part 2. I'm realizing there might be an edge case with my program that my input (and the sample input) just happened to perfectly miss
Charles Wright
A pointer points to a memory address.
This mean it's value is simply the memory address.
When you prepend it with " * " (like *ptr) you are asking C to give you the value stored at the memory address. When you prepend it with " & " (like &ptr) you are asking for the address where the pointer itself is stored.
So just think of it like * goes forwards and & goes backwards.
For instance suppose you have:
int a = 3;
Then asking for "a" is asking for the value of "a" which is 3. And asking for "&a" is asking for the memory address where "a" is stored.
*ptr = value at memory address ptr = memory address ptr is pointing to &ptr = memory address of ptr
a = value at memory address &a = memory address of a *a = doesn't mean anything because 3 doesn't point to a valid memory address
imagine also a pointer to a pointer (call it ptrptr)
ptrptr = memory address ptrptr is pointing to *ptrptr = memory address ptr is pointing to &ptrptr = memory address where ptrptr resides
Just remember backwards (&) and forwards (*).
Kevin James
would *&a compile?
Dominic Johnson
So could the guy that got hired at a friend's company. >Friend: So, you're a senior engineer? >New guy: Uh, I once took a course of JS >Friend: How the fuck did you get hired? >New guy: Just said I was hot shit at the interview. Based civil service job, I can't be fired, #makingit
Jace Rivera
You will mostly use pointers to mutate data in a function.
All arguments given to a function are passed by value, meaning the function gets a copy of the thing you passed to it, not the actual thing. This means that if you want an integer to be changed by a function, you can't do:
void square(int num) { num = num * num; }
int x = 5; square(x);
x would still be 5 after calling square(). Instead you need to do:
void square(int *num) { *num = num * num; }
int x = 5; square(&x);
Now the function takes a pointer to an integer, and you pass the function the pointer to x. x will be 25 after calling square().
Connor Edwards
Apparently it does. It'd be fairly pointless to do but it works as expected.
very important with passing large structs since it's by reference(the memory address which is only 4-8 bytes) compared to by value(literally copying over the entire struct)
Asher Clark
that's more a case for references void square(int &num) { num = num * num; }
int x = 5; square(x);
Charles Watson
Not mature enough. Ruby's saving grace has little to do with the actual language spec, really. It was designed to be comfy, and holy FUCK is it comfy. Which is why Elixir exists. "What if we took Erlang and wrote it like Ruby?" The result is a wonderfully distributed functional language that's a pleasure to write, read, and use.
Crystal could be dope. The fact it doesn't allow for null-ref at compile time (much like kotlin) is great, and if it's as fast as they say it is with Ruby-style do block's it could be crazy powerful with such expressive, fast code. But I'm not holding my breath. It doesn't have backing from a major company and that's usually what it takes to get a new language some traction. Go had Google behind it (with the authority of Rob Pike no less) and has seen quite a bit of success. Rust is backed by Mozilla and used by precisely fucking nobody but Mozilla. Clojure took off because it's JVM ready functional programming, and Java is too ancient to readily adapt that paradigm. React.js is more popular than Vue because it's backed by Facebook, despite Vue being less retarded.
If Crystal manages to accomplish what it wants and, more importantly, has a robust, built-in multi-threading or multi-process system, it'll be great. Until then it's just a toy language.
Napping before the next challenge drops. See you guys in a few.
Jason Mitchell
This is some abstract shit without context
>C++ >String parsing God help you.
Evan Sullivan
you'll be late and you know it
Elijah Robinson
Best of luck, I'm playing vidya to keep myself awake for it. What I'm playing really needs focus.
Camden Johnson
This is my first AoC, so I've been doing 2017 for practice. Just did days 13 & 14. Both felt easy but still took me like 1/2 hour each just to get everything worked out. Really wish I had a faster speed
Aaron Davis
Great, Jow Forums is fucking breaking now. I can't update the thread even though I know there are new posts in it.
Hunter Moore
making a new post that he cant see
Zachary Collins
It fixed it when I posted, no fucking clue what happened
>doesn't understand what a cache is These are the people participating in this shit?
Thomas Clark
I know what a cache is.
Anthony Sanchez
dont know
Xavier Diaz
Reminder to post "solved!" a few minutes after the challenge has been released, regardless of your progress or even having looked at the problem.
Austin Brown
essentially recreating the table they use for the example is the most elegant, imo, but it's not the most efficient
Christopher Bell
Reminder to post "FUCK" literally the second the challenge is released, regardless of your progress or even having looked at the problem.
Michael Scott
reminder that using python is literally cheating and you should feel bad about it.
Oliver Taylor
reminder to use the best tool for the job, whether it's python or APL
Eli Bailey
and people will use it anyway, and win, that's why competing without using python is simply asinine. just have fun and enjoy that the execution speed of yours can't dream to match theirs UwU
Nolan Cook
reminder that it's just a fun competition, so use anything you want.
Wyatt Ross
as long as it's functional :^) and I don't mean that it works
Cameron Harris
Being reasonable? Get out.
Jose Baker
I hope yesterday was the first wall and today will be comfy I'm tired and have work tomorrow
Jordan Rivera
>inb4 more text parsing
Benjamin Thomas
I feel like the last couple of days have been ez mode and today the real brainlet filter will drop.