The objective of this project is to develop an object-oriented simulation of the boarding process for a flight. This simulation implements a robust class hierarchy to model the complex interactions between passengers, seats, and aircraft layout. The project aims to visualize the boarding process and optimize it for efficiency using OOP principles.
-
Passenger Management:
- Creation and management of passenger instances, including their baggage status and seat assignments.
- Simulation of passengers boarding the aircraft and taking their seats.
- Implementation of passenger behaviors through encapsulated methods.
-
Aircraft Layout:
- Generation of aircraft seating layouts with single or double aisles.
- Management of seat assignments and tracking of available seats.
- Flexible layout generation based on aircraft configuration.
-
Boarding Simulation:
- Visualization of the boarding process, including passengers moving through the aisles and taking their seats.
- Optimization of boarding order to reduce boarding time.
- Event-driven simulation using object interactions.
- Programming Language:
- Python 3.x
- Object-Oriented Programming (OOP) paradigm
- Design Patterns:
- Factory Pattern for aircraft and seat creation
- Observer Pattern for passenger state changes
- Strategy Pattern for boarding algorithms
- Core Classes:
Aircraft
: Manages aircraft configuration and layoutFlight
: Handles flight-specific operations and boarding processPassenger
: Represents individual passengers and their behaviorsSeat
: Defines seat properties and states
- Libraries:
emoji
: For visual representation of the boarding processuuid
: For unique passenger identificationcopy
: For deep copying of objectsrandom
: For simulation randomization
📦FlightSimulation
┣ 📂src
┃ ┣ 📂models
┃ ┃ ┣ 🐍aircraft.py
┃ ┃ ┣ 🐍flight.py
┃ ┃ ┣ 🐍passenger.py
┃ ┃ ┗ 🐍seat.py
┃ ┣ 📂utils
┃ ┃ ┣ 🐍display.py
┃ ┃ ┗🐍run.py
┃ ┗🐍main.py
┣ 📜README.md
┣ 📜LICENSE
┗ 📜requirements.txt
The project implements a clean object-oriented architecture with the following key principles:
- Encapsulation: All classes use private attributes with public property decorators
- Inheritance: Extensible class hierarchy for different aircraft types
- Polymorphism: Flexible boarding strategies through common interfaces
- Abstraction: Clear separation of concerns between classes
Before you start, ensure you have the following installed:
- Python 3.x to run the simulation
- pip to install required libraries
To get started, clone the repository to your local machine:
git clone https://github.com/MrPaquiteau/flight-boarding-simulation.git
cd flight-boarding-simulation
pip install -r requirements.txt
Execute the main.py script to start the boarding simulation:
python main.py
The simulation provides an object-oriented approach to modeling aircraft boarding:
# Create an aircraft instance
aircraft = Aircraft(rows=20, columns=8)
# Initialize a flight
flight = Flight(aircraft)
# Launch the simulation
flight.boarding_simulation()
If you would like to contribute to this project, please fork the repository and submit a pull request with your changes.
This project is licensed under the MIT License - see the LICENSE file for details.