comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Advent of Code Day 3
Date: Thu, 3 Dec 2020 15:37:43 +0100	[thread overview]
Message-ID: <rqat7n$jss$1@dont-email.me> (raw)
In-Reply-To: <86r1o7gi36.fsf@stephe-leake.org>

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

  reply	other threads:[~2020-12-03 14:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-03 13:00 Advent of Code Day 3 Stephen Leake
2020-12-03 14:37 ` Jeffrey R. Carter [this message]
2020-12-03 20:32 ` R R
2020-12-04  7:21   ` Maxim Reznik
replies disabled

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