Skip to content

Commit 997e9e2

Browse files
committed
Initial import
0 parents  commit 997e9e2

9 files changed

+324
-0
lines changed

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/alire/
2+
/config/
3+
/tmp/
4+
/**/.vscode/
5+
/**/bin/
6+
/**/obj/
7+
/**/shared/
8+
.gitmodules
9+
project_euler/usr/

Alice_Adventures.png

19.8 KB
Loading

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Francesc Rocher
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<!--
2+
[![Alire](https://img.shields.io/endpoint?url=https://alire.ada.dev/badges/alice.json)](https://alire.ada.dev/crates/alice.html)
3+
[![Alire CI/CD](https://img.shields.io/endpoint?url=https://alire-crate-ci.ada.dev/badges/alice.json)](https://alire-crate-ci.ada.dev/crates/alice.html)
4+
[![GitHub release](https://img.shields.io/github/release/rocher/alice.svg)](https://github.com/rocher/alice/releases/latest)
5+
[![License](https://img.shields.io/github/license/rocher/alice.svg?color=blue)](https://github.com/rocher/alice/blob/master/LICENSE)
6+
-->
7+
8+
<img src="Alice_Adventures.png" width="250" />
9+
10+
# Alice
11+
12+
> **Alice** : *Adventures for Learning and Inspiring Coding Excellence*
13+
14+
## Presentation
15+
16+
Alice is an open source Ada programming language framework designed to help
17+
programmers implement and explore different solutions to problems from
18+
various sources, including Project Euler, Codingame and Advent of Code
19+
(currently, Alice only support for Project Euler). With Alice, you can flex
20+
your coding muscles and work on problems that challenge your creativity,
21+
logic, and problem-solving skills.
22+
23+
At the heart of Alice is a commitment to coding excellence, and Ada and SPARK
24+
are the perfect languages to bring this vision to life. As a high-level
25+
programming language designed for safety, reliability, and efficiency, Ada
26+
provides a powerful and flexible toolset for programmers to create robust and
27+
scalable software solutions. With Ada, you can write clean, concise, and
28+
elegant code that is easy to read and maintain, helping to ensure that your
29+
programs are error-free and performant. So whether you're a seasoned Ada
30+
programmer or new to the language, Alice is the perfect platform to hone your
31+
skills and push your limits.
32+
33+
> ### See [Alice wiki](https://github.com/rocher/Alice/wiki) for more information.
34+
35+
## Collaboration
36+
37+
With Alice, you can collaborate in a variety of ways.
38+
39+
### Participate
40+
41+
* Implement new solutions to challenging problems: there are +800 problems
42+
in Project Euler!
43+
44+
* Improve existing algorithms or implement new ones.
45+
46+
* Use parallelism to explore the search space using multiple tasks.
47+
48+
* Share and export common functionality as new elements in the [Euler
49+
Tools](https://github.com/rocher/euler_tools) library.
50+
51+
* Create awesome visualizations to problem solutions with a simple
52+
interface.
53+
54+
* Explore algorithm behavior of problem solutions by adding new
55+
parameters.
56+
57+
### Develop
58+
59+
* Develop new graphical interfaces using your preferred GUI library: GTK,
60+
SDL, SFML or LVGL, to mention some of them.
61+
62+
* Refactor and improve the Alice framework itself to inspire new concepts
63+
towards coding excellence.
64+
65+
* Start the development and integration of other problem sources. take a
66+
look at what's planned for [Codigame](codingame/TODO.md) and [Advent of
67+
Code](advent_of_code/TODO.md).
68+
69+
* Integrate new sources of problems or challenges, learning sites or
70+
references. For example, would make sense to have Rosetta Code somehow
71+
integrated in Alice?
72+
73+
## Status
74+
75+
Alice is still in the early stages of development, and things are likely to
76+
change as we continue to refine and improve the framework. While Alice is
77+
still a work in progress, it is already starting to take shape as tool for
78+
exploring the challenges of the aforementioned problem sources.
79+
80+
---
81+
## License
82+
MIT (c) 2023 Francesc Rocher

alice.gpr

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
-------------------------------------------------------------------------------
2+
--
3+
-- ALICE - Adventures for Learning and Inspiring Coding Excellence
4+
-- Copyright (c) 2023 Francesc Rocher <francesc.rocher@gmail.com>
5+
-- SPDX-License-Identifier: MIT
6+
--
7+
-------------------------------------------------------------------------------
8+
9+
with "config/alice_config.gpr";
10+
project Alice is
11+
12+
for Source_Dirs use ("src/**", "config/");
13+
for Object_Dir use "obj/" & Alice_Config.Build_Profile;
14+
for Create_Missing_Dirs use "True";
15+
for Exec_Dir use "bin";
16+
for Main use ("alice.adb");
17+
18+
package Compiler is
19+
for Default_Switches ("Ada") use Alice_Config.Ada_Compiler_Switches;
20+
end Compiler;
21+
22+
package Binder is
23+
for Switches ("Ada") use ("-Es"); -- Symbolic traceback
24+
end Binder;
25+
26+
package Install is
27+
for Artifacts (".") use ("share");
28+
end Install;
29+
30+
end Alice;

alire.toml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name = "alice"
2+
description = "Adventures for Learning and Inspiring Coding Excellence"
3+
version = "0.1.0-dev"
4+
website = "https://github.com/rocher/Alice/wiki"
5+
licenses = "MIT"
6+
tags = [
7+
"alice",
8+
"adventures",
9+
"learning",
10+
"mathematics",
11+
"problems",
12+
"challenges",
13+
]
14+
15+
authors = ["Francesc Rocher"]
16+
maintainers = ["Francesc Rocher <francesc.rocher@gmail.com>"]
17+
maintainers-logins = ["rocher"]
18+
19+
[build-switches]
20+
"*".ada_version = ["-gnat2022", "-gnatX"]
21+
22+
[[depends-on]]
23+
clic = "~0.2.1"
24+
[[depends-on]]
25+
simple_logging = "^1.2.0"

src/alice.adb

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
-------------------------------------------------------------------------------
2+
--
3+
-- ALICE - Adventures for Learning and Inspiring Coding Excellence
4+
-- Copyright (c) 2023 Francesc Rocher <francesc.rocher@gmail.com>
5+
-- SPDX-License-Identifier: MIT
6+
--
7+
-------------------------------------------------------------------------------
8+
9+
with Alice_Command;
10+
11+
procedure Alice is
12+
begin
13+
14+
Alice_Command.Execute;
15+
16+
end Alice;

src/alice_command.adb

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
-------------------------------------------------------------------------------
2+
--
3+
-- ALICE - Adventures for Learning and Inspiring Coding Excellence
4+
-- Copyright (c) 2023 Francesc Rocher <francesc.rocher@gmail.com>
5+
-- SPDX-License-Identifier: MIT
6+
--
7+
-------------------------------------------------------------------------------
8+
9+
with Alice_Config;
10+
11+
with CLIC.Subcommand.Instance;
12+
with CLIC.TTY;
13+
with GNAT.OS_Lib;
14+
with Simple_Logging;
15+
16+
with Text_IO;
17+
18+
package body Alice_Command is
19+
20+
package Log renames Simple_Logging;
21+
22+
use all type Alice_Config.Build_Profile_Kind;
23+
24+
type Global_Switches_Type (Profile : Alice_Config.Build_Profile_Kind) is
25+
record
26+
Help : aliased Boolean := False;
27+
Color : aliased Boolean := True;
28+
TTY : aliased Boolean := True;
29+
Verbose : aliased Boolean := True;
30+
Detail : aliased Boolean := False;
31+
Debug : aliased Boolean := False;
32+
end record;
33+
34+
Global_Switch : Global_Switches_Type (Alice_Config.Build_Profile);
35+
36+
procedure Set_Global_Switches
37+
(Config : in out CLIC.Subcommand.Switches_Configuration);
38+
39+
--!pp OFF
40+
package Command is new CLIC.Subcommand.Instance
41+
(Main_Command_Name => Alice_Config.Crate_Name,
42+
Version =>
43+
(if Alice_Config.Build_Profile /= Alice_Config.release then
44+
Alice_Config.Crate_Version & " (" &
45+
Alice_Config.Build_Profile'Image & ")"
46+
else Alice_Config.Crate_Version),
47+
Set_Global_Switches => Set_Global_Switches,
48+
Put => Text_IO.Put,
49+
Put_Line => Text_IO.Put_Line,
50+
Put_Error => Text_IO.Put_Line,
51+
Error_Exit => GNAT.OS_Lib.OS_Exit,
52+
TTY_Chapter => CLIC.TTY.Info,
53+
TTY_Description => CLIC.TTY.Description,
54+
TTY_Version => CLIC.TTY.Version,
55+
TTY_Underline => CLIC.TTY.Underline,
56+
TTY_Emph => CLIC.TTY.Emph);
57+
--!pp ON
58+
59+
-------------------------
60+
-- Set_Global_Switches --
61+
-------------------------
62+
63+
procedure Set_Global_Switches
64+
(Config : in out CLIC.Subcommand.Switches_Configuration)
65+
is
66+
use CLIC.Subcommand;
67+
begin
68+
--!pp OFF
69+
Define_Switch (Config,
70+
Global_Switch.Help'Access,
71+
"-h", "--help",
72+
"Display command help");
73+
Define_Switch (Config,
74+
Global_Switch.Color'Access,
75+
Long_Switch => "--no-color",
76+
Help => "Disable color",
77+
Value => False);
78+
Define_Switch (Config,
79+
Global_Switch.TTY'Access,
80+
Long_Switch => "--no-tty",
81+
Help => "Disable control characters",
82+
Value => False);
83+
Define_Switch (Config,
84+
Global_Switch.Verbose'Access,
85+
"-v", "--verbose",
86+
Help => "Show command activity");
87+
88+
pragma Warnings (Off);
89+
if Global_Switch.Profile = Alice_Config.development then
90+
Define_Switch (Config,
91+
Global_Switch.Debug'Access,
92+
"-g", "--debug",
93+
Help => "Show debug information");
94+
end if;
95+
pragma Warnings (On);
96+
--!pp ON
97+
98+
end Set_Global_Switches;
99+
100+
-------------
101+
-- Execute --
102+
-------------
103+
104+
procedure Execute is
105+
begin
106+
Command.Parse_Global_Switches;
107+
108+
if Global_Switch.Debug then
109+
Log.Level := Log.Debug;
110+
Log.Debug ("Global_Switch" & Global_Switch'Image);
111+
end if;
112+
113+
if not Global_Switch.TTY then
114+
CLIC.TTY.Force_Disable_TTY;
115+
Log.Debug ("Disable TTY");
116+
end if;
117+
118+
if Global_Switch.Color and then Global_Switch.TTY then
119+
CLIC.TTY.Enable_Color (Force => False);
120+
Log.Debug ("Enable Color");
121+
end if;
122+
123+
Log.Debug ("Command.Execute begin");
124+
Command.Execute;
125+
Log.Debug ("Command.Execute end");
126+
end Execute;
127+
128+
end Alice_Command;

src/alice_command.ads

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-------------------------------------------------------------------------------
2+
--
3+
-- ALICE - Adventures for Learning and Inspiring Coding Excellence
4+
-- Copyright (c) 2023 Francesc Rocher <francesc.rocher@gmail.com>
5+
-- SPDX-License-Identifier: MIT
6+
--
7+
-------------------------------------------------------------------------------
8+
9+
package Alice_Command is
10+
11+
procedure Execute;
12+
13+
end Alice_Command;

0 commit comments

Comments
 (0)