Flight Simulator Code Interpreter
Flight plan project is to control a FlightGear flight simulator using a code source file written in a unique code syntax. The interpreter, developed in C++, analyzes and executes the code, communicating with the FlightGear simulator, And thus he controls his flight.
The source code is written in an unfamiliar language, similar to Python, you can have fun and try to build different programs and algorithms in this language, see an example of a program that calculates the Fibonacci number
Outline
- C++.
- MultiThreads.
- TCP protocol.
- Telnet protocol.
- Design patterns: Command pattren, Singleton pattren.
- Object-Oriented Programming (OOP) principles.
- SOLID principles.
Ensure the following dependencies are installed:
- github
- gcc compiler at least version 8
- Cmake
- Free ports for communication
- Tokenization: The code is tokenized to prepare for analysis.
- Parsing: An analysis is performed, and a Binary Expression Tree is generated.
- Environment Definition: A definition file for simulator environment variables is created.
- Code Execution: The program runs the code, performing operations on the simulator, accessing the OS, connecting to a TCP server, running the simulator in a separate process, and managing TELNET communication for data storage.
- Device Settings: Adjustments for simulator plane devices are supported.
- Data Storage: Data received from the simulator is stored in a database.
- Clone the repository.
git clone https://github.com/dudi-w/flight-simulator-interpreter.git
- Download and install
FlightGear
simulator.sudo apt-get update && apt-get install -y flightgear
- Ensure the availability of the necessary ports (5400, 5402).
lsof -i :5402 -i :5400
- setup the simulator
sudo cp flight-simulator-interpreter/generic_json_format.xml /usr/share/games/flightgear/Protocol/generic_json_format.xml
- Compile the files.
cd flight-simulator-interpreter mkdir build cd build cmake .. make -j4
- run the process
# ./main <code_file> [<output_file>] ./main ../flight_instructions.txt /dev/null
We welcome contributions! If you would like to contribute to the project, follow these steps:
- Fork the repository
- Create a new branch
- Make your changes
- Submit a pull request
Special thanks to the members of the development team:
git clone https://github.com/dudi-w/flight-simulator-interpreter.git
cd flight-simulator-interpreter
docker build -t flight_simulator_code_interpreter .
xhost +local:docker
docker run --rm -it --env DISPLAY=$DISPLAY --env QT_X11_NO_MITSHM=1 --volume /tmp/.X11-unix:/tmp/.X11-unix --privileged -p 5400:5400 -p 5402:5402 -p 8080:8080 flight_simulator_code_interpreter flight_instructions.txt