Also, given the time that some people solve the puzzle, doing it too nice
is actually not the best use of time in AoC.

Now, I'll try to solve quick and this will for sure lead to interesting
things in Pharo.

>From Reddit, people solve it quick then make it nice.

Phil

On Mon, Dec 3, 2018, 03:45 Richard O'Keefe <rao...@gmail.com wrote:

> The key question is "what do you mean by improve"?
> I'd start by asking "what are you doing that you will still have to do in
> part 2, and what won't you do?"  So looking at part 2, you will want to
> convert the lines to integers, and
>   input := Array streamContents: [:lines |
>     'input.txt' asFileReference readStreamDo: [:in |
>       [in atEnd] whileFalse: [lines nextPut: in nextLine asInteger]]].
> gives you a chunk of code you can use in both parts.  So you might
> want to have
>
> Day1
>   changesFrom: aFileName
>     ^Array streamContents: [:changes |
>       aFileName asFileReference readStreamDo: [:in |
>         [in atEnd] whileFalse: [changes nextPut: in nextLine asInteger]]]
>   partOne: aFileName
>     ^(self changesFrom: aFileName) sum
>   partTwo: aFileName
>     ...
> The file name should not be wired in because you want some test files.
>
>
>

Reply via email to