text stringlengths 0 234 |
|---|
Max_Lines := Values (1); |
elsif Values (3) > Max_Lines then |
Max_Lines := Values (3); |
end if; |
if Values (2) > Max_Columns then |
Max_Columns := Values (2); |
elsif Values (4) > Max_Columns then |
Max_Columns := Values (4); |
end if; |
Segments.Append (( |
Start_Line => (Line => Values (1), Column => Values (2)), |
End_Line => (Line => Values (3), Column => Values (4)) |
)); |
Function Definition: procedure Main is |
Function Body: use Ada.Execution_Time, |
Ada.Real_Time, |
Ada.Text_IO; |
use Utils; |
subtype Adjacent_Index is Integer range -1 .. 1; |
type Adjacent_Location is record |
Line : Adjacent_Index; |
Column : Adjacent_Index; |
end record; |
Max_Steps : constant := 100; |
type Adjacent is (Top, Top_Right, Right, Bottom_Right, Bottom, Bottom_Left, Left, Top_Left); |
type Adjacent_Array is array (Adjacent) of Adjacent_Location; |
type Octopuses_Energy_Level_Array is array (1 .. 10, 1 .. 10) of Integer; |
Adjacents : constant Adjacent_Array := (Top => (-1, 0), |
Top_Right => (-1, 1), |
Right => (0, 1), |
Bottom_Right => (1, 1), |
Bottom => (1, 0), |
Bottom_Left => (1, -1), |
Left => (0, -1), |
Top_Left => (-1, -1)); |
File : File_Type; |
Start_Time, End_Time : CPU_Time; |
Execution_Duration : Time_Span; |
Octopuses_Energy_Level : Octopuses_Energy_Level_Array; |
File_Is_Empty : Boolean := True; |
Result : Natural := Natural'First; |
begin |
Get_File (File); |
-- Get all values |
declare |
Current_Line, |
Current_Column : Positive := Positive'First; |
begin |
while not End_Of_File (File) loop |
declare |
Str : constant String := Get_Line (File); |
Last : Positive; |
begin |
for Char of Str loop |
Ada.Integer_Text_IO.Get (Char & "", Octopuses_Energy_Level (Current_Line, Current_Column), Last); |
Current_Column := Current_Column + 1; |
File_Is_Empty := False; |
end loop; |
Function Definition: procedure Main is |
Function Body: use Ada.Execution_Time, |
Ada.Real_Time, |
Ada.Text_IO; |
use Utils; |
subtype Adjacent_Index is Integer range -1 .. 1; |
type Adjacent_Location is record |
Line : Adjacent_Index; |
Column : Adjacent_Index; |
end record; |
type Adjacent is (Top, Top_Right, Right, Bottom_Right, Bottom, Bottom_Left, Left, Top_Left); |
type Adjacent_Array is array (Adjacent) of Adjacent_Location; |
type Octopuses_Energy_Level_Array is array (1 .. 10, 1 .. 10) of Integer; |
Adjacents : constant Adjacent_Array := (Top => (-1, 0), |
Top_Right => (-1, 1), |
Right => (0, 1), |
Bottom_Right => (1, 1), |
Bottom => (1, 0), |
Bottom_Left => (1, -1), |
Left => (0, -1), |
Top_Left => (-1, -1)); |
File : File_Type; |
Start_Time, End_Time : CPU_Time; |
Execution_Duration : Time_Span; |
Octopuses_Energy_Level : Octopuses_Energy_Level_Array; |
File_Is_Empty : Boolean := True; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.