comp.lang.ada
 help / color / mirror / Atom feed
* Advent of Code Day 3
@ 2020-12-03 13:00 Stephen Leake
  2020-12-03 14:37 ` Jeffrey R. Carter
  2020-12-03 20:32 ` R R
  0 siblings, 2 replies; 4+ messages in thread
From: Stephen Leake @ 2020-12-03 13:00 UTC (permalink / raw)


easy puzzle; the only mildly difficult part was getting the wrap right;
I made my own string type to allow starting at index 0. I made the map
indices match Emacs line, column display for easier debugging.

--
-- Stephe

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

* Re: Advent of Code Day 3
  2020-12-03 13:00 Advent of Code Day 3 Stephen Leake
@ 2020-12-03 14:37 ` Jeffrey R. Carter
  2020-12-03 20:32 ` R R
  1 sibling, 0 replies; 4+ messages in thread
From: Jeffrey R. Carter @ 2020-12-03 14:37 UTC (permalink / raw)


On 12/3/20 2:00 PM, Stephen Leake wrote:
> easy puzzle; the only mildly difficult part was getting the wrap right;
> I made my own string type to allow starting at index 0. I made the map
> indices match Emacs line, column display for easier debugging.

I just used

    if Pos > Line'Last then
       Pos := Pos - Line'last;
    end if;

and the default 1-based indices for Strings returned by the Ada.Text_IO.Get_Line 
function worked fine.

The fun bit was how big the answer to the 2nd part was.

-- 
Jeff Carter
"I'll get broads up here like you wouldn't believe.
Swingers. Freaks. Nymphomaniacs. Dental hygienists."
Play It Again, Sam
125

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

* Re: Advent of Code Day 3
  2020-12-03 13:00 Advent of Code Day 3 Stephen Leake
  2020-12-03 14:37 ` Jeffrey R. Carter
@ 2020-12-03 20:32 ` R R
  2020-12-04  7:21   ` Maxim Reznik
  1 sibling, 1 reply; 4+ messages in thread
From: R R @ 2020-12-03 20:32 UTC (permalink / raw)


My fun part was that for the first time in my programming career I could make use of a modular type that wasn't a power of 2.

Rolf

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

* Re: Advent of Code Day 3
  2020-12-03 20:32 ` R R
@ 2020-12-04  7:21   ` Maxim Reznik
  0 siblings, 0 replies; 4+ messages in thread
From: Maxim Reznik @ 2020-12-04  7:21 UTC (permalink / raw)


My day3 solution is here: https://github.com/reznikmm/ada-howto/tree/advent-2020

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

end of thread, other threads:[~2020-12-04  7:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03 13:00 Advent of Code Day 3 Stephen Leake
2020-12-03 14:37 ` Jeffrey R. Carter
2020-12-03 20:32 ` R R
2020-12-04  7:21   ` Maxim Reznik

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