Yes, I said in the commit message that 4 checks related to input validation are not provable. This is intended. This is equivalent to hiding those under SPARK_Mode=>Off.
[analogrelay][2][Ada] aoc2022/day_02.adb at 9407a12e3bb2c1ed2c3804029bc5c6932409dafd ยท analogrelay/aoc2022 ยท GitHub
[dkm][2][Ada] adventofcode/main.adb at d35db01976dcb091b75031e2966ee0141a81574b ยท dkm/adventofcode ยท GitHub
Forgot to post it here!
[AJ-Ianozi][1][Ada]adventofcode/day1.adb at 9683a101a7532e2deaf632354091dae421287dce ยท AJ-Ianozi/adventofcode ยท GitHub
[AJ-Ianozi][2][Ada]adventofcode/day2.adb at 9683a101a7532e2deaf632354091dae421287dce ยท AJ-Ianozi/adventofcode ยท GitHub
[JeremyGrosser][3][Ada][advent/day3_2.adb at 42725c2a5c5446b055a5ca88d5237c3f487f7901 ยท JeremyGrosser/advent ยท GitHub]
[Zertovitch][3][Ada]hac/aoc_2022_03.adb at 0046d0f89d2a0959ae8e15eae333715b910d5baa ยท zertovitch/hac ยท GitHub
[cantanima][3][Ada]Day 3, with part 2 done 3 different ways
(Iโm not saying any of them is particularly good, but I was quite please once I got the 3rd one working)
[William-Franck][3][Ada]Release Day-03 ยท captain-haddock17/Advent_of_Code_2022 ยท GitHub
I made also a more light and compact solution (borrought from some top Python developer)
-
puzzle_03
(181 SLoC) :: Ada centric solution -
puzzle_03_light
(100 SLoC) :: using moreCharacter
andString
to map Priority values
If you want to get a value from a String without cheating I recommend basalt/basalt-strings_generic.ads at 765f1f6eac704ecda05d74e8308f740f620a73f8 ยท Componolit/basalt ยท GitHub
[rocher][3][Ada]
Part 1:
pragma Ada_2022;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Characters.Handling; use Ada.Characters.Handling;
procedure Day03_P1 is
function Priority (C : Character) return Natural is
(if Is_Lower (C) then 1 + Character'Pos (C) - Character'Pos ('a')
else 27 + Character'Pos (C) - Character'Pos ('A'));
ฮฃ_Priorities : Natural := 0;
Input : File_Type;
begin
Open (Input, In_File, "input.txt");
loop
declare
Line : String := Get_Line (Input);
Half : Natural := Line'Last / 2;
Found : Boolean := False;
begin
for I in 1 .. Half loop
for J in Half + 1 .. Line'Last loop
if Line (I) = Line (J) then
Found := True;
ฮฃ_Priorities := @ + Priority (Line (I));
exit;
end if;
end loop;
exit when Found;
end loop;
end;
exit when End_Of_File (Input);
end loop;
Close (Input);
Put_Line ("Answer:" & ฮฃ_Priorities'Image);
end Day03_P1;
Part 2:
pragma Ada_2022;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Characters.Handling; use Ada.Characters.Handling;
procedure Day03_P2 is
function Priority (C : Character) return Natural is
(if Is_Lower (C) then 1 + Character'Pos (C) - Character'Pos ('a')
else 27 + Character'Pos (C) - Character'Pos ('A'));
ฮฃ_Priorities : Natural := 0;
Input : File_Type;
begin
Open (Input, In_File, "input.txt");
loop
declare
Rucksack_1 : String := Get_Line (Input);
Rucksack_2 : String := Get_Line (Input);
Rucksack_3 : String := Get_Line (Input);
Found : Boolean := False;
begin
for A of Rucksack_1 loop
for B of Rucksack_2 loop
if A = B then
for C of Rucksack_3 loop
if A = C then
Found := True;
ฮฃ_Priorities := @ + Priority (A);
exit;
end if;
end loop;
end if;
exit when Found;
end loop;
exit when Found;
end loop;
end;
exit when End_Of_File (Input);
end loop;
Close (Input);
Put_Line ("Answer:" & ฮฃ_Priorities'Image);
end Day03_P2;
[rommudoh][3][Ada] aoc2022-Ada/day03.adb at main - aoc2022-Ada - Codeberg.org
[RREE][1][Ada] AoC/2022/01 at main ยท RREE/AoC ยท GitHub
[RREE][2][Ada] AoC/2022/02 at main ยท RREE/AoC ยท GitHub
[RREE][3][Ada] AoC/2022/03 at main ยท RREE/AoC ยท GitHub
[fsherratt][1][Ada]GitHub - fsherratt/Advent_Of_Code_2022
[fsherratt][2][Ada]GitHub - fsherratt/Advent_Of_Code_2022
I canโt seem to edit my previous post, soโฆ
[wutka][3][SPARK]advent-of-code-2022-spark/day3.adb at d736d089db9bc6715ebdbe0ed9a42f4e3b97f951 ยท wutka/advent-of-code-2022-spark ยท GitHub
[wutka][4][SPARK]advent-of-code-2022-spark/day4.adb at 63339b0317d60f79c66b993e943fad3e853ae758 ยท wutka/advent-of-code-2022-spark ยท GitHub
[anuj-seth][1][Ada]Day 1
[analogrelay][3][Ada] aoc2022/day_03.adb at 78e2597f54da38447680517dc9f156ef0ac31c15 ยท analogrelay/aoc2022 ยท GitHub
[analogrelay][4][Ada]
aoc2022/day_04.adb at 6d304a58b83911d8b6cf812e6886a626c5a0378d ยท analogrelay/aoc2022 ยท GitHub
[Jeff Carter][1][Ada]AoA_22/day01_1.adb at ea96729e22e5574ba59dddf79117732e15263150 ยท jrcarter/AoA_22 ยท GitHub
[smionean][3][Ada]AdventOfCode/day03.adb at e6771b9fafca42bca66859e054de1d6b5e936740 ยท smionean/AdventOfCode ยท GitHub
Day 3 coming along nicely!
[Neoxas][3][SPARK]GitHub - Neoxas/aoc_2022_ada: AOC 2022 solutions written in SPARK ADA!
Another day another elf problem!
[AJ-Ianozi][3][Ada]adventofcode/day3.adb at 36631ec28b90171803935debe34ee742efbde5c1 ยท AJ-Ianozi/adventofcode ยท GitHub