Advent of Code 2018

adventofcode.com/

It's near to that time of year again, people, and the reddit competition will soon start up again. Are you going to let those twitter trannies win? Or are you going to prove your compsci degree was worth something?

(protip: it wasn't, watch as some jap codes the whole thing in assembly naked atop mt. Fuji)

What is it?
Advent of code's a programming advent calendar. 2 problems a day for every day of advent, you paste the output data into a text box. You need to register via one of a few 3rd-party websites, because there's a leaderboard: first person to complete a day's challenges get 100 points to his total, second 99, so on. If I remember correctly, someone from 4chan came first last year, but don't quote me on that.

The site's a bit cancerous, especially the sign-up thing, but it's still pretty fun. Try out a new language, or have some fun getting back to basics with one you already know.

I'll be doing it in C, with a little helper library for quickly reading files. How about you, user?

Attached: advent.png (1079x777, 105.37K)

Other urls found in this thread:

adventofcode.com/2018/leaderboard/private
youtube.com/watch?v=vTIIMJ9tUc8
wordsandbuttons.online/fortran_is_still_a_thing.html
twitter.com/SFWRedditVideos

C++ as usual

Haskell though I might need to fallback onto Java.

No I have this thing called a "job".

gimme a large guac bacon thiccburger combo with a diet coke wagie

probably yeah. If all you care about is one-shot speed to an answer then math > programming, frequently, and it doesn't matter at all how maintainable or reliable your code is. I prefer constraints like 2017's 1ms-per-answer, and I like looking at how easily I can answer the second question with code for the first answer, and I like comparing solutions across languages.
Last year I had a lot of fun with OCaml. Doing it with Ada this year.

Was thinking of doing Ada or Racket this year, but I'll probably just do it in Mathematica, again.

I'm going to give it a shot with C++.

anyone doing perl?

Attached: perl-scripts-done.jpg (600x425, 27.21K)

8 hours work, 8 hours relaxation, 8 hours sleep. These challenges shouldn't take more than 30 minutes, and that would be considered slow. You clearly have found time to post on Zig Forums, so don't try and produce that excuse.

literal lol


Sounds fun. Time to show these zoomers the poower of Java.

Attached: 82dd4805f460694942c62e8ac5e73bcd3dba28a8eed15a6f5b5ef08bcbd6d20d.jpg (540x540, 23.27K)

Only poos use Java. Old neckbeards would use Perl for this stuff.

*sips*
Damn gramps, you're up late.

Who Fortran generation here? Not me

you are tho
Fortran's still used for what it was used for. Programming has grown; Fortran hasn't shrunk. Julia's a promising alternative.

Rustfag reporting in. I created a private leaderboard: 208834-4a1a9383

C++ fag here.

what the fuck is this

You can use this code to join the provate leaderboard I created.
adventofcode.com/2018/leaderboard/private

semitic cancer

That's a garbage scripting language which will always be beaten by LuaJIT.
Fortran on the other hand is nearly as fast as C.

Increasingly not. While I probably use LAPACK indirectly everyday, I've noticed more and more Fortran libraries being converted to C, which is natural as the Fortran talent pool shrinks to zero.

how does this actually work? i didn't do it last year. assuming you sign up, it seems like reddit is the easiest to generate account information for, is it like these other code competition websites where you submit the source and it compiles and gives you metrics? what are the limits? nothing but the standard library i assume?

Reddit is the easiest way to sign up, as you don't need to submit any email information. The account is just used to track your progress.

There is no source code submission to their site, and no limits on what you use, you take the input they give you (usually a text file), and just type the solution into their site.

They give you a problem and you then have as much time as you want to give them back the solution to the problem. For some easy challenges, you could even guess or work them out on a calculator.

I have classes and other shit. Does anyone have time for this? Maybe web design trannies and neets

You have time for posting here, but cannot make time for 10 minute puzzles? Please, the reason is that you cannot program.

it's a pretty nice system, and actually very easy to duplicate. Rather than one of those dice-roll programming threads, we should just have an AoC clone on a hidden service.
Doesn't need tracking. Not even a cookie except for convenience. It just needs to provide successive questions and input text given prior answers. You can do that purely in an nginx server configuration, or with mod_rewrite rules, since the answers are tiny: just map query strings to local files.

(cont.)
the hard parts are the name, logo, theme, ASCII arts, and--good puzzles

The hard part is coming up with interesting puzzles, that is a lot harder than it initially seems to be, since you're looking for that perfect balance of challenging, solvable and providing some satisfaction. The AoC creator said he spends several months getting them ready.

there are so many more entertaining things to do then complete shitty little programming problems some first year CS major can do. like shit post on 8ch. of course if it is actually a 10 min problem.

you can start on previous years' tasks now. They aren't "shitty little programming problems"; they're a lot of fun.

If only.

Code golf is a lot of fun. I like to play code golf with my old programming assignments. I already know what the computation is supposed to achieve, now I can spend my effort to expressing that computation in the shortest amount of characters.

well, you shan't see Ada participating in any business like that.

Heh. At least with Ada, everyone will be able to understand your code, even if they don't understand Ada.

Is it worth trying this out with Perl? Or should I just stick with Python?

Attached: maga-christchan.png (496x594, 263.99K)

Doing it in Java. No time to fuck around with ancient functions.

YES
that's not a big leap, user. Have you considered Erlang, D, or OCaml? There's a lot to these languages but you've got just enough time left before December to be able to use them, and they're all a lot different (in different ways) from Python.

The true Aryan Master Race participants use a different language each day. It certainly is tempting, but would require a much larger time commitment. Doing the first few in assembly shouldn't be too hard though, the difficulty usually ramps up towards the end.

Depends on when they go live. If I can do it before bed, I'll be perling it, but I have a job so..

"MOTHERFUCKER" !!!
true aryan master race, huh?! just like jesus was a fuckin arab nomad & non-white, the so-called aryan race originated in INDIA!!!
but U...my little bitch....r white, like the rest of these whore-sons on 8ch!!!
so fuck_off & do something worthwhile in compsci worth ur real-biological-daddy's smut!!!

genetic fallacy. What white people have done lately doesn't have a lot to do with prehistoric human migration.
plus, genetic ignorance: yeah, white people were in India, but then they fucked the natives. You, today, have some measure of untouchable racial admixture :) That's probably the simplest way to think about it :)

python, of course.
why use something else when the speed of writing code trumps everything else? pycharm has also good GUI for debugging.

found the LARPer

>Being this triggered. Low caste pariah Poo detected. You will never be Brahmin guy, you know this.

Triathlon: One low level language like D/Nim/Go/Crystal, one Functional Language like Haskell/Scala/Clojure, and one high level language, Python/Ruby/PHP/Perl.
Pentathlon: Add an assembly language and a lisp/scheme.

...

LOL no it wasn't. I'm doing systems programming (not in India) and all I did was a languages degree. Will indebted faggots ever recover?


This. I'm writing code all day long.

...

You're not impressing anyone here, fgt. Either participate in AOC or GTFO.

if you were trying to win this thing then this logic is sounds since the speed or memory usage are completely irrelevant.

some of the puzzles are like, "simulate this CPU until a 32-bit integer overflows". Even if you're the first to throw some shit together that will eventually work, what'd scored is the first submitted answer.

A worthy challenge, but still the 'master race' pursuit is using 25 different languages.

PowerShell.

Attached: 68baa79e008fa27a5294414784e674e0a8969696205418a7446c74f1bfc699eb.webm (640x360, 9.78M)

youtube.com/watch?v=vTIIMJ9tUc8

Attached: java bros.png (1342x1022, 1.46M)

You can't just use 25 different languages, you need to use 25 different languages with 25 different paradigms. I would add on a stack based on (forth), a logic based on, maybe a shell language. Don't know if you could get to 25 though.

There's just not enough paradigms to cover it. At best you could stipulate that you span all of the major classifications. Another alternative is using 25 different assembly architectures, that would be God Tier. I don't think anyone here is white enough to pull that off though.

experience of reading a Python book: "you can use this feature to turn spam into eggs, teeheehee"
experience of reading an Ada book: "27 US servicemen died because one of you little shits didn't pay attention to the next paragraph"

...

"MOTHERFUCKER" !!!
zogmutts, huh?! just like jesus was a fuckin American & from Texas, your so-called anti-zog sentiment originated is JEWISH COMMUNISM!!!
but U...my little bitch....r an arab-lover, like the rest of these philosemites on 8ch!!!
so fuck_off & do something worthwhile in compsci worth ur real-biological-daddy's smut!!!

I wish I was autistic enough to decipher what your point here is.

it's an observation. If you opened a random Python book and a random Ada book, that's what'd you see. If you can see that and think nothing of it, then you can go thinking nothing about my remarks.

How about writing a list of 25 languages, with a few alternatives thrown in. (Python OR Javascript, C++ OR Java OR C#, any *nix shell, etc)

Yeah I understand that. I've read both subjects and agree but I just don't understand how makes sense in the context of a reply to .

Ada or Eiffel
ATS or Idris or Coq
C or HolyC or Objective C
C++ or hard drugs
Clojure or Scala or Kotlin or Java
Crystal
D
Erlang or Elixir
Forth or PostScript or Oforth or Factor
Go or save time by just sucking Rob Pike off
J or a K-like or APL
Julia or Mathematica
Common Lisp or Emacs Lisp
Lua or LuaJIT
Mercury
Nim
OCaml or Reason or SML or Haskell
Perl or Perl6 or Python or Ruby or PHP
Red or Rebol
Rust or communism or becoming a furry
Scheme or Racket
Smalltalk
Swift or C# or Objective C again, why not
Tcl
Zig or Jai or Myrddin or Odin

You don't write code. You language hop and write bubble sorts. I can smell it on the breeze.

prove it with your list of 25 languages.

why not any alternatives?

it's a hybrid and I don't remember any other functional-logic languages, or if they're even usable.
you could alternate it with Prolog (for a logic language) or Haskell (for a pure functional language).

:- module average.:- interface.:- import_module io.:- pred main(io::di, io::uo) is det.:- implementation.:- import_module list, string, int, float, exception.main(!IO) :- float(A) + float(B) = Sum, Average = Sum/2.0, io.write_string("Enter two integers: ", !IO), get(A, !IO), get(B, !IO), io.format("The average of your two numbers is %.2f\n", [f(Average)], !IO).:- pred get(int::out, io::di, io::uo) is det.get(N, !IO) :- io.read_line_as_string(Res, !IO), ( Res = ok(Str) -> string.det_to_int(string.chomp(Str)) = N ; throw(software_error("Unexpected: conversion failed")) ).1. !IO is shorthand for !.IO, !:IO, which is short for IO0, IO1, where IO0 is the state of the world you're passing to a predicate, and IO1 is the state of the world the predicate is passing back to you. With !IO, lexical order matters: that write_string() happens before those get()s, because it's written out as IO0, IO1, IO2, IO3.
2. but otherwise, order doesn't matter at all. So I put the 'important' calculations at the top of main(), for readability.
3. that A -> B; C thing in get() is an if/else/then. You can also write if/else/then but Mercury devs fucked up the attempt at wider appeal and those aren't an improvement. They should've imitated Erlang.
4. yeah this a trivial language-hopping program but I just wrote it for comparison while going through an Ada book. I learned Mercury ages and I don't language-hop anymore I swear.
5. apart from performance (impressive vs. prolog but not vs. most static languages) and maintainability goals, Mercury is cool as a practical logical language that also nails the logical aspects down very well. Prolog is slippery and hard to understand af in comparison. With Mercury you'll write something, and then think "oh, I can use this exact same code to do this other thing" where the data goes in the other direction or you return all possible outputs from ambiguous inputs, and then add a declaration to permit that use. f.e., :- func limit = int.limit = 1000 / 2.:- pred bounded_increment(int, int).:- mode bounded_increment(in, out) is semidet. %

Ayyy well yall Aryan white boiz be up in all dem 25 languages real gangsta ass niggers like muself be rocking dat VHDL good stuff. Hardware for hard niggers ya heard? microprocessors are 4 micro penises. flippity flop, Iz rocking da clock with ma D motherfuckers.

No U

Red is still fucking dead
Also the list is nice

At least add in Prolog. I like how you left out javascript though.

All criticism is in part self-criticism. I hope you at least learn heap-sort soon.

serious man's serious list of serious programming languages

32-bit ARM assembler
Ada
Awk
Bash
C
C#
C++
Cobol
Fortran
Go
Java
JavaScript
Common Lisp
MUMPS
PHP
PowerShell
Python
R
SQL
Swift
TypeScript
Verilog
Visual Basic
VDHL
64-bit x86 assembler

No alternates permitted.

See for variety

Can you faggots stop LARPing? You're fucking annoying.

Gas yourself for that one.

You're a LARPing faggot.

Then do Verilog, we need people who can make ASIC shit so Zig Forumscoin can be a thing

Either Awk or Bash, create an extra space
C or D without GC
Either C# or Swift or Kotlin or Java and another free space
JS or Typescript or Coffeescript, another space
Needs more variety
Python or Ruby or Perl or PHP
R or Julia or Octave
Never, another space

1. Clojure or Haskell or Scala
2. J or a K-like or APL
3. Nim or Crystal
4. Red or Rebol

I know an IT bigwig manager who is in his 50s and knows +100 langs to varying degrees. It's his fetish.

as if
wut is

...

...

work from home
do that as infrequently as possible
boil some water, pour it into oatmeal or noodles, eat
takes an insignificant amount of time
showering what? your code with affection?
it's wintertime, it's God's own grace period on home cleaning
make them as infrequently as possible. My last appointment this year was to vote in the in the midterms. The appointment before that was four months prior.
like code?
cut into your sleep time.

I was pointing out the typo. VHDL on the other hand is quite excellent.


Again, you find time to make these stupid posts on Zig Forums, you could find 10 mins to write a program. Plus who says you have to keep up with their schedule, you could batch them up to until the weekends. Perhaps you just don't want to do them, that's fine, but the "I would if I had the time" excuse just makes you sound like a non-programmer.


A good rule of life, is to consider that there might be smarter people out there than you (unless you're me). That should be obvious, because while you sit struggling for days to convince a python interpreter that you can conform to a grammar, you can observe other men are building rockets and landing probes on mars. It's not uncommon for top programmers to have mastery of several languages. Unless you are retarded, you don't stop learning once school/university ends. Heaven forbid, some people might start to master other fields, like math, physics and electrical engineering.

...

absolutely #REKT

neet confirmed

I have some bad news about the continued development of LuaJIT, user.

wordsandbuttons.online/fortran_is_still_a_thing.html
which one of you wrote this?

I wrote it :)

isn't mercury just prolog with more constraints that help performance? for example, you can do the same bounded_increment in prolog using clpfd:
limit(clpfd,500).bounded_increment_clpfd(A,B) :- limit(clpfd,L), A #< L, B #= A + 1.
where the biggest difference is that you don't have to declare the inputs and outputs or the determinism. Another neat thing is that you can even write
bounded_increment_clpfd(N,A,B) :- limit(L), A #< L, B #= A + N.
which will also work in all directions.

Sure. It's like dynamic vs. static types, but in logic. In Prolog you can intend to write a deterministic predicate (never fails, always one result), accidentally write a semideterministic one (can fail, one or zero results) and nothing will tell you except a bug and then troubleshooting. In Mercury all of that's explicit and the compiler checks it for you.

Since you seem knowledgeable about this stuff, I have a question: Under what circumstances would it be better to use a logic language like Mercury or Prolog as opposed to something like C? From my point of view it seems like it would only be useful for database lookups, but I’m sure I’m missing something.

Nah, I rarely use it. One thing I like about logic programming though is that you can express a relationship once and then use it repeatedly in different ways. It's not something you'd notice yourself missing in a normal language: if you were writing a unit converter, you'd normally just write e.g. celsius_to_fahrenheit() and also fahrenheit_to_celsius(), where each function separately encodes the relationship between those two units. That's a bad example because with non-toy units you'd pull them from a database and have a common base unit or something, but you're always duplicating something. Want to append a "\n" to a string? Use this thing (an operator). Want to strip a "\n" from a string? Use this other thing (a function). With logic those could use the same thing.
With Mercury vs. C you're also getting a Haskell-tier type system and purity, and 'programming in the large' benefits, so there's a lot of non-logical stuff to talk about. And Mercury interfaces extremely well with C because it's a transpiling memelang--that also targets Java and Erlang, but not JS somehow

REPENT SINNER