Some Ada source-code proposals for the puzzles of the © Advent of Code, year 2021 contest prepared by Eric Wastl 😎
MON | TUE | WED | THU | FRI | SAT | SUN |
---|---|---|---|---|---|---|
- | - | 01 | 02 | 03 | 04 | 05 |
06 | 07 | 08 | 09 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | - |
Note: There are still other GitHub repositories (20+) with Ada code proposals.
Aiming as a show-case of some best(?) Ada 2012/202x coding practices.
- Readability
- Modular & Object Oriented software design
- Only using the libraries defined by the language, and shipped with any Ada compiler
- Use multi-tasking design when appropriate
- Execution time (performance) is not a first class goal (back to 1. & 2.)
Other seasoned or just plain beginner developer have published their Ada code on github (or elsewhere...)
I used the forthcoming Ada 202x syntax and language-libraries, essentially:
@
as a shorthand syntax, as inSum := @ + 1;
- Pretty Printer: GNAT pretty-printer
- Compiler: GNAT CE 2021 with
-gnat2022
activated- GNAT from GCC 10 should also be OK (not tested)
- Build: GNAT gprbuild
- Package-Library manager: Alire
Alire (alr
) needs to be initialized through a first alr build
command. This completes ~/.config/alire/config.toml
file.
To select the working Ada 2022 (WIP) compiler:
alr toolchain --select
- and select
gnat_external=2021.0.0 [Detected at /opt/gnat-ce-2021/bin/gnat]
- and select
One may use plain gprbuild
.
git clone https://github.com/AdaForge/Advent_of_Code_2021.git
cd Advent_of_Code_2021/puzzle_08
gprbuild
bin/puzzle_08 data/Puzzle_08.txt
Just plain open-source: CC0 Universal Public Domain dedication's Free Cultural Work