this post was submitted on 13 Dec 2023
6 points (80.0% liked)

Advent Of Code

770 readers
1 users here now

An unofficial home for the advent of code community on programming.dev!

Advent of Code is an annual Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.

AoC 2023

Solution Threads

M T W T F S S
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25

Rules/Guidelines

Relevant Communities

Relevant Links

Credits

Icon base by Lorc under CC BY 3.0 with modifications to add a gradient

console.log('Hello World')

founded 1 year ago
MODERATORS
 

We all know and love (!) the leaderboard, but how about a different method?

One can solve a problem with a simple, naive method resulting in a short program and long runtime, or put in lots of explicit optimizations for more code and shorter runtime. (Or if you're really good, a short, fast program!)

I propose the line-second.

Take the number of lines in your program (eg, 42 lines) and the runtime (eg 0.096 seconds). Multiply these together to get a score of 4.032 line-seconds.

A smaller score is a shorter, faster program.

Similarly, (for a particular solver), a larger score is a "harder" problem.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] HeckGazer 4 points 11 months ago (1 children)

Another wrinkle is how do you count the lines? I've done several of this year's AoC in "one line" of JavaScript because you can just chain split().map().reduce().filter() etc. together indefinitely. Some languages like JS or python can do so much in one line

[โ€“] [email protected] 2 points 11 months ago

I probably should have made it clearer this is a somewhat tongue-in-cheek proposal :)

You're quite right - pretty much any program can be golfed into a single line.