I’m wondering - some people are posting solutions ...
# advent-of-code
I’m wondering - some people are posting solutions without input parsing. IMHO that should be part of the solution. What do you think?
I can see both sides of the argument - the input parsing is a bit boring, but on the other hand in some of the challenges it can take up a decent amount of the total code. For the current challenge, it seems quite natural to base the solution on something like
. Difficult to say!
readInput(name: String)
, you can map this list to
Im transforming on a sequence<string>
I expect everything to come in the form of lines. But it's also my first AOC, so let's see
The only piece of code I've hidden away in an abstract class I'm extending, is reading the contents of an entire file into a string. The actual string -> input part, I write out and show in solutions. Preprocessing the input before you go through using it, is a big part of solving the problems at hand. And it can be way more complicated than just making a list of ints too. Preprocessing is done outside my two functions as well. For example, I was doing AoC2018-day17 the other night where you basically had input instructions that specified lines on a grid. By preprocessing this data, I don't store the input as those line instructions, but rather as a map<Point, Tile>. This preprocessing can sometimes be quite a bit of code, depending on the complexity of the input, so I feel hiding it wouldn't be fair. But thats how I process input, and everyone uses their own approach.
👍 1
I‘ve always felt that the “cleanest” approach is to solve each challenge as a program (fun main) that reads the input as a string from stdin and then prints two strings (or numbers) to stdout.