comp.lang.ada
 help / color / mirror / Atom feed
* Advent of Code Day 8
@ 2020-12-09 20:04 Stephen Leake
  2020-12-09 22:44 ` John Perry
  0 siblings, 1 reply; 8+ messages in thread
From: Stephen Leake @ 2020-12-09 20:04 UTC (permalink / raw)


Not a satisfying puzzle; brute force try all fixes seems to be the only
solution.

-- 
-- Stephe

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Advent of Code Day 8
  2020-12-09 20:04 Advent of Code Day 8 Stephen Leake
@ 2020-12-09 22:44 ` John Perry
  2020-12-10  8:25   ` John Perry
  2020-12-10 19:24   ` Stephen Leake
  0 siblings, 2 replies; 8+ messages in thread
From: John Perry @ 2020-12-09 22:44 UTC (permalink / raw)


On Wednesday, December 9, 2020 at 2:04:57 PM UTC-6, Stephen Leake wrote:
> Not a satisfying puzzle; brute force try all fixes seems to be the only 
> solution. 
> 
> -- 
> -- Stephe

That was how I felt, too: brute force. I looked at it a while to find a better way.

If you didn't like that, I regrettably have some bad news about Day 9's puzzle.

john perry

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Advent of Code Day 8
  2020-12-09 22:44 ` John Perry
@ 2020-12-10  8:25   ` John Perry
  2020-12-10  9:07     ` Maxim Reznik
  2020-12-10 12:25     ` gautier...@hotmail.com
  2020-12-10 19:24   ` Stephen Leake
  1 sibling, 2 replies; 8+ messages in thread
From: John Perry @ 2020-12-10  8:25 UTC (permalink / raw)


Day 10 allows for a non-brute force solution, and this is worth the effort.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Advent of Code Day 8
  2020-12-10  8:25   ` John Perry
@ 2020-12-10  9:07     ` Maxim Reznik
  2020-12-10 16:50       ` John Perry
  2020-12-10 12:25     ` gautier...@hotmail.com
  1 sibling, 1 reply; 8+ messages in thread
From: Maxim Reznik @ 2020-12-10  9:07 UTC (permalink / raw)


Do you consider my solution for Day 9 as brute force one? ;)

https://github.com/reznikmm/ada-howto/blob/advent-2020/md/09/09.md

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Advent of Code Day 8
  2020-12-10  8:25   ` John Perry
  2020-12-10  9:07     ` Maxim Reznik
@ 2020-12-10 12:25     ` gautier...@hotmail.com
  1 sibling, 0 replies; 8+ messages in thread
From: gautier...@hotmail.com @ 2020-12-10 12:25 UTC (permalink / raw)


> Day 10 allows for a non-brute force solution, and this is worth the effort.

Regarding part 2, you are probably dead before a brute-force solution finishes...

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Advent of Code Day 8
  2020-12-10  9:07     ` Maxim Reznik
@ 2020-12-10 16:50       ` John Perry
  2020-12-10 19:24         ` Stephen Leake
  0 siblings, 1 reply; 8+ messages in thread
From: John Perry @ 2020-12-10 16:50 UTC (permalink / raw)


On Thursday, December 10, 2020 at 3:07:22 AM UTC-6, Maxim Reznik wrote:
> Do you consider my solution for Day 9 as brute force one? ;) 
> 
> https://github.com/reznikmm/ada-howto/blob/advent-2020/md/09/09.md

I really like this approach, but it seems equivalent. I wondered if I misunderstood the approach, so I worked it out the example problem by hand both ways, and both perform roughly the same number of "additions": 11 for the first, 14 for the second. So unless I've misunderstood something (and the example may be a bad one) this also seems brute force.

(Thanks for pointing out the error in my code, by the way. Judging by my comments, I misread the directions.)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Advent of Code Day 8
  2020-12-10 16:50       ` John Perry
@ 2020-12-10 19:24         ` Stephen Leake
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Leake @ 2020-12-10 19:24 UTC (permalink / raw)


John Perry <john.perry@usm.edu> writes:

> On Thursday, December 10, 2020 at 3:07:22 AM UTC-6, Maxim Reznik wrote:
>> Do you consider my solution for Day 9 as brute force one? ;) 
>> 
>> https://github.com/reznikmm/ada-howto/blob/advent-2020/md/09/09.md
>
> I really like this approach, but it seems equivalent. 

+ 1.

You process each number in the input file only once, which is very nice.
It avoids keeping all the numbers in memory at once, so could work for
_very_ large files (although then you'd need integers much larger than
64 bits as well).


-- 
-- Stephe

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Advent of Code Day 8
  2020-12-09 22:44 ` John Perry
  2020-12-10  8:25   ` John Perry
@ 2020-12-10 19:24   ` Stephen Leake
  1 sibling, 0 replies; 8+ messages in thread
From: Stephen Leake @ 2020-12-10 19:24 UTC (permalink / raw)


John Perry <john.perry@usm.edu> writes:

> On Wednesday, December 9, 2020 at 2:04:57 PM UTC-6, Stephen Leake wrote:
>> Not a satisfying puzzle; brute force try all fixes seems to be the only 
>> solution. 
>> 
>> -- 
>> -- Stephe
>
> That was how I felt, too: brute force. I looked at it a while to find
> a better way.
>
> If you didn't like that, I regrettably have some bad news about Day
> 9's puzzle.

Yes. Now on do day 10.

-- 
-- Stephe

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-12-10 19:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09 20:04 Advent of Code Day 8 Stephen Leake
2020-12-09 22:44 ` John Perry
2020-12-10  8:25   ` John Perry
2020-12-10  9:07     ` Maxim Reznik
2020-12-10 16:50       ` John Perry
2020-12-10 19:24         ` Stephen Leake
2020-12-10 12:25     ` gautier...@hotmail.com
2020-12-10 19:24   ` Stephen Leake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox