comp.lang.ada
 help / color / mirror / Atom feed
* Advent of Code
@ 2020-11-28  3:12 John Perry
  2020-11-28 18:40 ` Stephen Leake
                   ` (6 more replies)
  0 siblings, 7 replies; 36+ messages in thread
From: John Perry @ 2020-11-28  3:12 UTC (permalink / raw)


Does anyone know about Advent of Code, and has anyone ever participated for Ada? It's typically a sequence of programming puzzles posed as an Advent calendar: one for each new day.

   https://adventofcode.com/2020/about

Older examples are here:

   https://adventofcode.com/2020/events

I had thought of it, but I don't have too much time. Some languages maintain their own mini-communities and leaderboards, and it might be a way to raise Ada's profile (or even SPARK'S?).

john perry

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

* Re: Advent of Code
  2020-11-28  3:12 Advent of Code John Perry
@ 2020-11-28 18:40 ` Stephen Leake
  2020-11-29  3:36 ` Jeremy Grosser
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 36+ messages in thread
From: Stephen Leake @ 2020-11-28 18:40 UTC (permalink / raw)


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

> Does anyone know about Advent of Code, and has anyone ever
> participated for Ada? It's typically a sequence of programming puzzles
> posed as an Advent calendar: one for each new day.
>
>    https://adventofcode.com/2020/about

Thanks for the heads up. I'll give it a try, but one a day may be too
much for me.


-- 
-- Stephe

Written from unceded ancestral homelands of the Huichiun, an Ohlone
people,for which I pay Shuumi Land Tax

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

* Re: Advent of Code
  2020-11-28  3:12 Advent of Code John Perry
  2020-11-28 18:40 ` Stephen Leake
@ 2020-11-29  3:36 ` Jeremy Grosser
  2020-11-29 14:03 ` Bojan Petrovic
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 36+ messages in thread
From: Jeremy Grosser @ 2020-11-29  3:36 UTC (permalink / raw)


On Friday, November 27, 2020 at 7:12:23 PM UTC-8, john....@usm.edu wrote:
> Does anyone know about Advent of Code, and has anyone ever participated for Ada? It's typically a sequence of programming puzzles posed as an Advent calendar: one for each new day. 
> 
> https://adventofcode.com/2020/about 
> 
> Older examples are here: 
> 
> https://adventofcode.com/2020/events 
> 
> I had thought of it, but I don't have too much time. Some languages maintain their own mini-communities and leaderboards, and it might be a way to raise Ada's profile (or even SPARK'S?). 
> 
> john perry

I did Advent of Code in Ada last year. I got distracted by other projects and didn't finish it, but found it to be a very good way to learn with focused problems. My solutions are up on GitHub if you're curious, but knowing what I know now, they're far from optimal and some parts are definitely in need of refactoring.
https://github.com/JeremyGrosser/advent

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

* Re: Advent of Code
  2020-11-28  3:12 Advent of Code John Perry
  2020-11-28 18:40 ` Stephen Leake
  2020-11-29  3:36 ` Jeremy Grosser
@ 2020-11-29 14:03 ` Bojan Petrovic
  2020-12-01  7:08 ` John Perry
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 36+ messages in thread
From: Bojan Petrovic @ 2020-11-29 14:03 UTC (permalink / raw)


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

> Does anyone know about Advent of Code, and has anyone ever participated for Ada? It's typically a sequence of programming puzzles posed as an Advent calendar: one for each new day.
>
>    https://adventofcode.com/2020/about

Hi,

I solved a couple of challenges from the last year's AoC in both Ada and
Rust, just to get a feel for the differences between them in a puzzle
solving context:

https://github.com/ALPHA-60/advent-of-code-2019

I've been organising a weekly recreational coding workshop at my company
for the last couple of years, and we've been solving Project Euler and
Codility task. I stopped doing it in March because of the Covid-19
situation, but we'll reboot it online on December 1st, when AoC 2020
starts, though our schedule will remain the same - one AoC problem
per week.

A while ago we did some interview question exercises on #Ada Telegram
group, so maybe we can do it again there.

Regards,
Bojan

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

* Re: Advent of Code
  2020-11-28  3:12 Advent of Code John Perry
                   ` (2 preceding siblings ...)
  2020-11-29 14:03 ` Bojan Petrovic
@ 2020-12-01  7:08 ` John Perry
  2020-12-01 11:37   ` Max Reznik
                     ` (2 more replies)
  2020-12-01 18:33 ` Per Sandberg
                   ` (2 subsequent siblings)
  6 siblings, 3 replies; 36+ messages in thread
From: John Perry @ 2020-12-01  7:08 UTC (permalink / raw)


Well, the first day wasn't too bad. It took me an hour, mainly because I'm not as familiar with Ada as I'd like. Once I re-learned file input & remembered the declare clause, it was quick.

I'll follow Jeremy Grosser's example and post my solutions to GitHub, too.

   https://github.com/johnperry-math/AoC2020.git   

john perry

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

* Re: Advent of Code
  2020-12-01  7:08 ` John Perry
@ 2020-12-01 11:37   ` Max Reznik
  2020-12-01 11:37   ` Jeffrey R. Carter
  2020-12-01 12:17   ` Stephen Leake
  2 siblings, 0 replies; 36+ messages in thread
From: Max Reznik @ 2020-12-01 11:37 UTC (permalink / raw)


Someone posted on reddit:

https://www.reddit.com/r/ada/comments/k4fn9w/anyone_else_participating_in_advent_of_code/

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

* Re: Advent of Code
  2020-12-01  7:08 ` John Perry
  2020-12-01 11:37   ` Max Reznik
@ 2020-12-01 11:37   ` Jeffrey R. Carter
  2020-12-01 12:17   ` Stephen Leake
  2 siblings, 0 replies; 36+ messages in thread
From: Jeffrey R. Carter @ 2020-12-01 11:37 UTC (permalink / raw)


On 12/1/20 8:08 AM, John Perry wrote:
> Well, the first day wasn't too bad. It took me an hour, mainly because I'm not as familiar with Ada as I'd like. Once I re-learned file input & remembered the declare clause, it was quick.
> 
> I'll follow Jeremy Grosser's example and post my solutions to GitHub, too.
> 
>     https://github.com/johnperry-math/AoC2020.git

Very simple. Took about 20 mins. Doesn't seem worth posting.

-- 
Jeff Carter
"Gentlemen, you can't fight in here. This is the War Room!"
Dr. Strangelove
30

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

* Re: Advent of Code
  2020-12-01  7:08 ` John Perry
  2020-12-01 11:37   ` Max Reznik
  2020-12-01 11:37   ` Jeffrey R. Carter
@ 2020-12-01 12:17   ` Stephen Leake
  2 siblings, 0 replies; 36+ messages in thread
From: Stephen Leake @ 2020-12-01 12:17 UTC (permalink / raw)


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

> Well, the first day wasn't too bad. 

Me too; https://github.com/stephe-ada-guru/Advent_of_Code


-- 
-- Stephe

Written from unceded ancestral homelands of the Huichiun, an Ohlone
people,for which I pay Shuumi Land Tax

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

* Re: Advent of Code
  2020-11-28  3:12 Advent of Code John Perry
                   ` (3 preceding siblings ...)
  2020-12-01  7:08 ` John Perry
@ 2020-12-01 18:33 ` Per Sandberg
  2020-12-01 19:45   ` Simon Beàn
  2020-12-01 20:37 ` R R
  2020-12-02 20:51 ` gautier...@hotmail.com
  6 siblings, 1 reply; 36+ messages in thread
From: Per Sandberg @ 2020-12-01 18:33 UTC (permalink / raw)


Just for play
	https://github.com/persan/advent-of-code-2020.git

/P

On 28/11/2020 04:12, John Perry wrote:
> Does anyone know about Advent of Code, and has anyone ever participated for Ada? It's typically a sequence of programming puzzles posed as an Advent calendar: one for each new day.
> 
>     https://adventofcode.com/2020/about
> 
> Older examples are here:
> 
>     https://adventofcode.com/2020/events
> 
> I had thought of it, but I don't have too much time. Some languages maintain their own mini-communities and leaderboards, and it might be a way to raise Ada's profile (or even SPARK'S?).
> 
> john perry
> 

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

* Re: Advent of Code
  2020-12-01 18:33 ` Per Sandberg
@ 2020-12-01 19:45   ` Simon Beàn
  2020-12-01 20:10     ` John Perry
  0 siblings, 1 reply; 36+ messages in thread
From: Simon Beàn @ 2020-12-01 19:45 UTC (permalink / raw)


Me too I want to play!

Here is mine :
https://github.com/smionean/AdventOfCode

I hope to find time to complete this year.

Simon B.

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

* Re: Advent of Code
  2020-12-01 19:45   ` Simon Beàn
@ 2020-12-01 20:10     ` John Perry
  2020-12-02  0:12       ` Stephen Leake
  0 siblings, 1 reply; 36+ messages in thread
From: John Perry @ 2020-12-01 20:10 UTC (permalink / raw)


Given the interest in participation, is there also interest in a private leaderboard for participants using Ada?

I could go either way. On the one hand, it could motivate participation! But the leaderboard seems to operate on a "faster is better" proposition, and I while I finished this one relatively quickly (given my lack of experience), a much better program emerged after reading comments on my code (thanks Maxim and Emmanuel!) and after reading a forum for a different language, where I discovered that my code had a bug.

Also negative: I don't think there's any way to guarantee that someone used Ada. You just add yourself to the leaderboard using a code.

john perry

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

* Re: Advent of Code
  2020-11-28  3:12 Advent of Code John Perry
                   ` (4 preceding siblings ...)
  2020-12-01 18:33 ` Per Sandberg
@ 2020-12-01 20:37 ` R R
  2020-12-02 12:35   ` Jeffrey R. Carter
  2020-12-02 20:51 ` gautier...@hotmail.com
  6 siblings, 1 reply; 36+ messages in thread
From: R R @ 2020-12-01 20:37 UTC (permalink / raw)


I also created my github repository for the first entry:

https://github.com/RREE/AOC_2020

Rolf

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

* Re: Advent of Code
  2020-12-01 20:10     ` John Perry
@ 2020-12-02  0:12       ` Stephen Leake
  0 siblings, 0 replies; 36+ messages in thread
From: Stephen Leake @ 2020-12-02  0:12 UTC (permalink / raw)


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

> I could go either way. On the one hand, it could motivate
> participation! But the leaderboard seems to operate on a "faster is
> better" proposition, and I while I finished this one relatively
> quickly (given my lack of experience), a much better program emerged
> after reading comments on my code (thanks Maxim and Emmanuel!) and
> after reading a forum for a different language, where I discovered
> that my code had a bug.

And some of us don't want to get up at midnight (in whatever time zone).

I think posting here is enough.
-- 
-- Stephe

Written from unceded ancestral homelands of the Huichiun, an Ohlone
people,for which I pay Shuumi Land Tax

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

* Re: Advent of Code
  2020-12-01 20:37 ` R R
@ 2020-12-02 12:35   ` Jeffrey R. Carter
  2020-12-02 16:09     ` John Perry
  0 siblings, 1 reply; 36+ messages in thread
From: Jeffrey R. Carter @ 2020-12-02 12:35 UTC (permalink / raw)


Did day 2. Again quite simple and about 20 minutes.

-- 
Jeff Carter
"What's special about Agile is that it's a mix of the
best and the worst."
Bertrand Meyer
148

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

* Re: Advent of Code
  2020-12-02 12:35   ` Jeffrey R. Carter
@ 2020-12-02 16:09     ` John Perry
  2020-12-02 16:57       ` gautier...@hotmail.com
  0 siblings, 1 reply; 36+ messages in thread
From: John Perry @ 2020-12-02 16:09 UTC (permalink / raw)


On Wednesday, December 2, 2020 at 6:35:47 AM UTC-6, Jeffrey R. Carter wrote:
> Did day 2. Again quite simple and about 20 minutes. 

Today's was simpler to solve than yesterday's, but I put an "exit" in the wrong part of a loop, so I got the wrong count on part one. Debugging that meant I spent as much time today as the day before.

My impression is that they grow harder as time goes on.

john perry

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

* Re: Advent of Code
  2020-12-02 16:09     ` John Perry
@ 2020-12-02 16:57       ` gautier...@hotmail.com
  2020-12-02 18:01         ` John Perry
  0 siblings, 1 reply; 36+ messages in thread
From: gautier...@hotmail.com @ 2020-12-02 16:57 UTC (permalink / raw)


On Wednesday, December 2, 2020 at 5:09:17 PM UTC+1, john:

> Today's was simpler to solve than yesterday's, but I put an "exit" in the wrong part of a loop, so I got the wrong count on part one. Debugging that meant I spent as much time today as the day before. 

Difficulty of those problems has certainly lots of subjectivity. I found yesterday's so easy that I did it in a spreadsheet (a "no code" solution ;-) )...

G.

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

* Re: Advent of Code
  2020-12-02 16:57       ` gautier...@hotmail.com
@ 2020-12-02 18:01         ` John Perry
  0 siblings, 0 replies; 36+ messages in thread
From: John Perry @ 2020-12-02 18:01 UTC (permalink / raw)


> Difficulty of those problems has certainly lots of subjectivity. I found yesterday's so easy that I did it in a spreadsheet (a "no code" solution ;-) )...

I wish I'd thought of that.

I likely could have solved both problems much more quickly in one of the languages I work with routinely, which sadly enough are not Ada. With Python I might even have finished it in a handful of minutes. But doing it in Ada makes it interesting, and so far it's been more pleasant than I expected. :-)

john perry

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

* Re: Advent of Code
  2020-11-28  3:12 Advent of Code John Perry
                   ` (5 preceding siblings ...)
  2020-12-01 20:37 ` R R
@ 2020-12-02 20:51 ` gautier...@hotmail.com
  2020-12-02 21:29   ` Max Reznik
  2020-12-02 22:59   ` Stephen Leake
  6 siblings, 2 replies; 36+ messages in thread
From: gautier...@hotmail.com @ 2020-12-02 20:51 UTC (permalink / raw)


Thanks John for the reminder about the Advent of Code. It's lots of fun!

Just before starting with today's puzzle, I had the idea of programming the solution with HAC (and the LEA editor). The quick edition-compilation-run cycle of HAC is an advantage for this contest. However, today, I was not quick enough to get points. Perhaps another day?

Links to my solutions are at the end of the following post:
https://gautiersblog.blogspot.com/2020/12/advent-of-code-2020-with-hac-and-lea.html

G.

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

* Re: Advent of Code
  2020-12-02 20:51 ` gautier...@hotmail.com
@ 2020-12-02 21:29   ` Max Reznik
  2020-12-02 23:04     ` Stephen Leake
  2020-12-02 22:59   ` Stephen Leake
  1 sibling, 1 reply; 36+ messages in thread
From: Max Reznik @ 2020-12-02 21:29 UTC (permalink / raw)


I gathered list of GitHub repository from this topic on a page, if someone wants to see all of them in one place.

https://github.com/reznikmm/ada-howto/tree/advent-2020

I also provided mine Ada solutions as Jupyter Notebooks. You can read them in Markdown or launch in the browser with "launch | binder" button.

Have a fun :)

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

* Re: Advent of Code
  2020-12-02 20:51 ` gautier...@hotmail.com
  2020-12-02 21:29   ` Max Reznik
@ 2020-12-02 22:59   ` Stephen Leake
  2020-12-14 17:43     ` Gautier Write-Only Address
  1 sibling, 1 reply; 36+ messages in thread
From: Stephen Leake @ 2020-12-02 22:59 UTC (permalink / raw)


"gautier...@hotmail.com" <gautier_niouzes@hotmail.com> writes:

> Just before starting with today's puzzle, I had the idea of
> programming the solution with HAC (and the LEA editor). The quick
> edition-compilation-run cycle of HAC is an advantage for this contest.

On these small files, can you really tell the difference in speed
between GNAT and HAC? or (insert other favorite editor, mine is Emacs)
and LEA? for me, everything is instantaneous.

-- 
-- Stephe

Written from unceded ancestral homelands of the Huichiun, an Ohlone
people,for which I pay Shuumi Land Tax

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

* Re: Advent of Code
  2020-12-02 21:29   ` Max Reznik
@ 2020-12-02 23:04     ` Stephen Leake
  2020-12-03 14:52       ` Wendel Wang
  0 siblings, 1 reply; 36+ messages in thread
From: Stephen Leake @ 2020-12-02 23:04 UTC (permalink / raw)


Max Reznik <reznik@adacore.com> writes:

> I gathered list of GitHub repository from this topic on a page, if
> someone wants to see all of them in one place.
>
> https://github.com/reznikmm/ada-howto/tree/advent-2020

That's useful, but searching on Github for "Advent of Code Ada" returns
22 hits, so there are more.

--
-- Stephe

Written from unceded ancestral homelands of the Huichiun, an Ohlone
people,for which I pay Shuumi Land Tax
(https://sogoreate-landtrust.com/shuumi-land-tax) as an inadequate token
of reparation.

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

* Re: Advent of Code
  2020-12-02 23:04     ` Stephen Leake
@ 2020-12-03 14:52       ` Wendel Wang
  2020-12-03 17:20         ` Björn Lundin
  0 siblings, 1 reply; 36+ messages in thread
From: Wendel Wang @ 2020-12-03 14:52 UTC (permalink / raw)


Hi.

Here is result so far.I am just learning Ada, so any comments welcome.

https://gitlab.com/MarcusE1W/prog/-/tree/master/ada/aoc

I was wondering for example if there is a way to read the data from day 2 as a record data structure? You can read it item by item, but is there a way to do it as a record?

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

* Re: Advent of Code
  2020-12-03 14:52       ` Wendel Wang
@ 2020-12-03 17:20         ` Björn Lundin
  2020-12-03 17:36           ` John Perry
  2020-12-03 18:50           ` gautier...@hotmail.com
  0 siblings, 2 replies; 36+ messages in thread
From: Björn Lundin @ 2020-12-03 17:20 UTC (permalink / raw)


Den 2020-12-03 kl. 15:52, skrev Wendel Wang:
> Hi.
> 
> Here is result so far.I am just learning Ada, so any comments welcome.
> 
> https://gitlab.com/MarcusE1W/prog/-/tree/master/ada/aoc
> 
> I was wondering for example if there is a way to read the data from day 2 as a record data structure? You can read it item by item, but is there a way to do it as a record?
> 

I guess you can use Ada.Direct_io.
I did not look at the inputfile, but I guess i has the same format as 
the frontpage. You need to define a record that can fit the data.

Here's an old course
<https://perso.telecom-paristech.fr/pautet/Ada95/chap24.htm>

and its example

<https://perso.telecom-paristech.fr/pautet/Ada95/e_c24_p3.ada>



-- 
Björn

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

* Re: Advent of Code
  2020-12-03 17:20         ` Björn Lundin
@ 2020-12-03 17:36           ` John Perry
  2020-12-03 18:25             ` Wendel Wang
  2020-12-03 18:38             ` Jeffrey R. Carter
  2020-12-03 18:50           ` gautier...@hotmail.com
  1 sibling, 2 replies; 36+ messages in thread
From: John Perry @ 2020-12-03 17:36 UTC (permalink / raw)


On Thursday, December 3, 2020 at 11:20:42 AM UTC-6, björn lundin wrote:
> Den 2020-12-03 kl. 15:52, skrev Wendel Wang: 
> > I was wondering for example if there is a way to read the data from day 2 as a record data structure? You can read it item by item, but is there a way to do it as a record? 
> >
> I guess you can use Ada.Direct_io. ...
> and its example 
> 
> <https://perso.telecom-paristech.fr/pautet/Ada95/e_c24_p3.ada> 

That's wonderful! I wish I'd known of that.

john perry

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

* Re: Advent of Code
  2020-12-03 17:36           ` John Perry
@ 2020-12-03 18:25             ` Wendel Wang
  2020-12-03 18:38             ` Jeffrey R. Carter
  1 sibling, 0 replies; 36+ messages in thread
From: Wendel Wang @ 2020-12-03 18:25 UTC (permalink / raw)


Yes, I am stilll exploring. I tried it with Stream_IO, but so far no luck. The tricky bit is that the structure is not fixed in length, on ly fixed in the data types. The String at the end has variable  lenght and I have not found out yet how to handle that... 

I tried bounded (and unbounded) Strings, but I am not quite there yet

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

* Re: Advent of Code
  2020-12-03 17:36           ` John Perry
  2020-12-03 18:25             ` Wendel Wang
@ 2020-12-03 18:38             ` Jeffrey R. Carter
  1 sibling, 0 replies; 36+ messages in thread
From: Jeffrey R. Carter @ 2020-12-03 18:38 UTC (permalink / raw)


On 12/3/20 6:36 PM, John Perry wrote:
> 
> That's wonderful! I wish I'd known of that.

I've said it before: if you're going to use Ada, you need to be familiar with 
the standard libraries in Annex A

http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-A.html

-- 
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] 36+ messages in thread

* Re: Advent of Code
  2020-12-03 17:20         ` Björn Lundin
  2020-12-03 17:36           ` John Perry
@ 2020-12-03 18:50           ` gautier...@hotmail.com
  2020-12-03 19:47             ` Björn Lundin
  1 sibling, 1 reply; 36+ messages in thread
From: gautier...@hotmail.com @ 2020-12-03 18:50 UTC (permalink / raw)


The data for Day 2 is a text file, and all you need for reading it is Text_IO (and its children or subpackages).

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

* Re: Advent of Code
  2020-12-03 18:50           ` gautier...@hotmail.com
@ 2020-12-03 19:47             ` Björn Lundin
  2020-12-08 20:44               ` Max Reznik
  0 siblings, 1 reply; 36+ messages in thread
From: Björn Lundin @ 2020-12-03 19:47 UTC (permalink / raw)


Den 2020-12-03 kl. 19:50, skrev gautier...@hotmail.com:
> The data for Day 2 is a text file, and all you need for reading it is Text_IO (and its children or subpackages).
> 

Indeed, but there was a specific question to use a record to pick it up.
I think I would have used gnat.awk myself.
I tend to use it nowadays for most of my text file handling.


-- 
Björn

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

* Re: Advent of Code
  2020-12-03 19:47             ` Björn Lundin
@ 2020-12-08 20:44               ` Max Reznik
  2020-12-08 21:06                 ` John Perry
  0 siblings, 1 reply; 36+ messages in thread
From: Max Reznik @ 2020-12-08 20:44 UTC (permalink / raw)


Day 8 task is nice, I like it :)

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

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

* Re: Advent of Code
  2020-12-08 20:44               ` Max Reznik
@ 2020-12-08 21:06                 ` John Perry
  2020-12-13 18:26                   ` Maxim Reznik
  0 siblings, 1 reply; 36+ messages in thread
From: John Perry @ 2020-12-08 21:06 UTC (permalink / raw)


On Tuesday, December 8, 2020 at 2:44:59 PM UTC-6, Max Reznik wrote:
> Day 8 task is nice, I like it :) 
> 
> https://github.com/reznikmm/ada-howto/blob/advent-2020/md/08/08.md

I feel great when I see that my solution is very similar to yours. I didn't know there was an Enumeration_IO though. I'll try that now myself.

I like the Jupyter notebooks, too. I'll have to look into that more.

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

* Re: Advent of Code
  2020-12-08 21:06                 ` John Perry
@ 2020-12-13 18:26                   ` Maxim Reznik
  2020-12-13 21:36                     ` John Perry
  0 siblings, 1 reply; 36+ messages in thread
From: Maxim Reznik @ 2020-12-13 18:26 UTC (permalink / raw)


Day 13 Part II was hard to me :( And result works only on GCC 11, where we will have 128 bits integers support at last.

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

-- 
Max

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

* Re: Advent of Code
  2020-12-13 18:26                   ` Maxim Reznik
@ 2020-12-13 21:36                     ` John Perry
  0 siblings, 0 replies; 36+ messages in thread
From: John Perry @ 2020-12-13 21:36 UTC (permalink / raw)


On Sunday, December 13, 2020 at 12:26:37 PM UTC-6, Maxim Reznik wrote:
> Day 13 Part II was hard to me :( And result works only on GCC 11, where we will have 128 bits integers support at last. 
> 
> https://github.com/reznikmm/ada-howto/blob/advent-2020/md/13/13.md 

I got around that using Ada.Numerics.Big_Numbers.Big_Integers. GNAT reports version 20200429-84.

(At first I used System.Bignum because I couldn't figure out how to make Big_Integers work, but somehow I cracked the package naming system... ;-) )

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

* Re: Advent of Code
  2020-12-02 22:59   ` Stephen Leake
@ 2020-12-14 17:43     ` Gautier Write-Only Address
  0 siblings, 0 replies; 36+ messages in thread
From: Gautier Write-Only Address @ 2020-12-14 17:43 UTC (permalink / raw)


On Wednesday, December 2, 2020 at 11:59:23 PM UTC+1, Stephen Leake wrote:
> On these small files, can you really tell the difference in speed 
> between GNAT and HAC? or (insert other favorite editor, mine is Emacs) 
> and LEA? for me, everything is instantaneous.

From GNAT Studio I get a range of 1.5 sec (an i5 PC @2.9 GHz) to 9 sec (a lightweight laptop)
for building aoc_2020_12.adb (almost a benchmark for easy puzzles ;-) ).
On the same source, I run hac -v2 aoc_2020_12.adb:
Compilation finished in  0.000335500 seconds.
Part 1: Manhattan distance of the ship to (0,0): 1631  (1631.0)
Part 2: Manhattan distance of the ship to (0,0): 58606  (58606.0)
VM interpreter done after  0.008894500 seconds.

So, for this kind of puzzle, it makes a difference (correct solution to part 1 was sent at 00:11:01).
But agreed, it's quite rare.
Especially on today's puzzle, I didn't even consider using HAC...

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

* Advent of Code
@ 2020-12-14 19:51 Stephen Leake
  2020-12-14 21:56 ` John Perry
  0 siblings, 1 reply; 36+ messages in thread
From: Stephen Leake @ 2020-12-14 19:51 UTC (permalink / raw)


I won't be doing any more Advent of Code puzzles; I'd rather spend the
time working on incremental parse in Emacs ada-mode.

-- 
-- Stephe

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

* Re: Advent of Code
  2020-12-14 19:51 Stephen Leake
@ 2020-12-14 21:56 ` John Perry
  2020-12-16 22:05   ` Maxim Reznik
  0 siblings, 1 reply; 36+ messages in thread
From: John Perry @ 2020-12-14 21:56 UTC (permalink / raw)


On Monday, December 14, 2020 at 1:51:28 PM UTC-6, Stephen Leake wrote:
> I won't be doing any more Advent of Code puzzles; I'd rather spend the 
> time working on incremental parse in Emacs ada-mode. 

What follows is a long way of saying "Thank you." :-)

I spend about 2 hours on each puzzle, which probably doesn't speak well of my programming prowess (I've programmed for decades, so I can't really say it's because I'm learning Ada). Somehow I enjoy it enough to come back day after day.

The puzzles themselves are usually easy (to me), and most of the ones with a non-trivial solution can probably be solved trivially, with one exception. At least the mathematics has gotten a little more sophisticated; I used the Chinese Remainder Theorem recently, which I got a kick out of implementing in Ada as a one-line function (not including a support function to compute a modular inverse). I noticed that Maxim used Fermat's Little Theorem.

I sometimes roll my eyes at the puzzles, but the one thing I've really enjoyed so far is how each new puzzle has nudge me to learn a different Ada feature with each new puzzle. I'd spend a lot less time on it if I allowed myself to use a computer algebra system, but the point is to learn Ada, and the really nice surprise has been how people have helped out, some of them even commenting directly on GitHub.

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

* Re: Advent of Code
  2020-12-14 21:56 ` John Perry
@ 2020-12-16 22:05   ` Maxim Reznik
  0 siblings, 0 replies; 36+ messages in thread
From: Maxim Reznik @ 2020-12-16 22:05 UTC (permalink / raw)


If you will solve day 16, try to define a dedicated type for ticket field index (or description rule index).
That way compiler will catch you if you accidentally intermix field index with rule index.
This could be a good illustration how strong type system helps you write correct code and why you need more than just one int type at all.

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

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

end of thread, other threads:[~2020-12-16 22:05 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-28  3:12 Advent of Code John Perry
2020-11-28 18:40 ` Stephen Leake
2020-11-29  3:36 ` Jeremy Grosser
2020-11-29 14:03 ` Bojan Petrovic
2020-12-01  7:08 ` John Perry
2020-12-01 11:37   ` Max Reznik
2020-12-01 11:37   ` Jeffrey R. Carter
2020-12-01 12:17   ` Stephen Leake
2020-12-01 18:33 ` Per Sandberg
2020-12-01 19:45   ` Simon Beàn
2020-12-01 20:10     ` John Perry
2020-12-02  0:12       ` Stephen Leake
2020-12-01 20:37 ` R R
2020-12-02 12:35   ` Jeffrey R. Carter
2020-12-02 16:09     ` John Perry
2020-12-02 16:57       ` gautier...@hotmail.com
2020-12-02 18:01         ` John Perry
2020-12-02 20:51 ` gautier...@hotmail.com
2020-12-02 21:29   ` Max Reznik
2020-12-02 23:04     ` Stephen Leake
2020-12-03 14:52       ` Wendel Wang
2020-12-03 17:20         ` Björn Lundin
2020-12-03 17:36           ` John Perry
2020-12-03 18:25             ` Wendel Wang
2020-12-03 18:38             ` Jeffrey R. Carter
2020-12-03 18:50           ` gautier...@hotmail.com
2020-12-03 19:47             ` Björn Lundin
2020-12-08 20:44               ` Max Reznik
2020-12-08 21:06                 ` John Perry
2020-12-13 18:26                   ` Maxim Reznik
2020-12-13 21:36                     ` John Perry
2020-12-02 22:59   ` Stephen Leake
2020-12-14 17:43     ` Gautier Write-Only Address
  -- strict thread matches above, loose matches on Subject: below --
2020-12-14 19:51 Stephen Leake
2020-12-14 21:56 ` John Perry
2020-12-16 22:05   ` Maxim Reznik

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