This repository contains all files used for the development of a Formal Methods laboratory exercise within the Computer Science degree program at the University of Bari “Aldo Moro”.
The Gate of Maat is a Finite State Machine (FSM) integrated with a Large Language Model (LLM) simulating a mythological entity — the Sphinx — whose purpose is to test the user’s worthiness through an interactive dialogue.
During the conversation, the user faces a sequence of conceptual trials designed to evaluate logic, intuition, and humility.
Each response contributes to an internal score; at the end of the dialogue, the Sphinx determines whether the user is worthy to cross the gate or should be rejected.
From a technical perspective, the project demonstrates the integration of:
- Formal Methods and FSMs, to model deterministic transitions and behaviors.
- Large Language Models (LLMs), to dynamically generate dialogue and evaluate user's responses.
- Clone the repository:
git clone https://github.com/Manuel-Cplusplus/The_Gate_of_Maat.git- Move into the project folder:
cd The_Gate_of_Maat- Copy the environment file:
cp .env.example .env-
Inside the .env file, insert your valid OpenAI API key to enable language model access.
-
Create a virtual environment
- Windows:
python -m venv myenv- Linux/MacOS:
python3 -m venv venv- Activate the virtual environment
- Windows:
myenv\Scripts\activate- Linux/MacOS:
source venv/bin/activate- Install dependencies:
pip install -r requirements.txtIf required, also install the custom FSM package:
pip install fsm-llmTo start the simulation:
python src/TheGateOfMaat.pyOnce launched, the system initiates an interactive session with the Sphinx. The user must respond to each trial, and the final outcome — Grace or Condemnation — will be revealed based on the accumulated score.
If you add new dependencies, update the requirements.txt file:
pip freeze > requirements.txtIn case of errors, you could try to install the the custom FSM package:
pip install fsm-llmAuthor: Manuel Carlucci
Year: 2025
Project: The Gate of Maat
This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license.
- Share — copy and redistribute the material in any medium or format
- Adapt — remix, transform, and build upon the material
- You must give appropriate credit
- You may not use the material for commercial purposes
- Any derivative works must be distributed under the same license