This Python project analyzes Quake 3 Arena game log files, generating reports on matches and player statistics.
src/: Contains the main source code.quake_log_parser.py: Functions to process the log file and extract relevant information.report_generator.py: Main script that utilizes the functions fromquake_log_parser.pyto generate the reports.
tests/: Contains unit tests to ensure the code's correctness.games.log: Quake 3 Arena log file to be analyzed. Place this file in the project's root directory.README.md: This file, containing information about the project.
1. Prerequisites
- Python 3.x: Make sure you have Python 3 installed on your machine.
2. Normal Execution
-
Navigate to the
srcdirectory in your terminal:cd /path/to/quake_log_analyzer/src -
Execute the
report_generator.pyscript:python3 report_generator.py
The reports will be displayed in your terminal.
3. Execution via Docker Container
-
Build the Docker image:
docker build -t quake-log-analyzer . -
Run the container:
docker run quake-log-analyzer
The reports will be displayed in your terminal.
-
Navigate to the
testsdirectory in your terminal:cd /path/to/quake_log_analyzer/tests -
Execute the test script:
python3 test_quake_log_parser.py
The test results will be displayed in your terminal, indicating if the tests passed or failed.
-
quake_log_parser.pyparse_log_file(log_file_path): Reads the log file, extracts information about each match (total kills, players, kills per player, and optionally kills by means of death), and organizes them into a dictionary.generate_player_ranking(games): Calculates the player ranking based on the total number of kills across all matches.
-
report_generator.py- Imports the functions from
quake_log_parser.py. - Constructs the full path to the
games.logfile. - Uses
parse_log_fileto get the match data. - Uses
generate_player_rankingto get the player ranking. - Prints the match reports and player ranking to the terminal.
- Imports the functions from
-
test_quake_log_parser.py- Contains unit tests for the functions in
quake_log_parser.py, ensuring their correct functionality.
- Contains unit tests for the functions in
- Make sure the
games.logfile is in the project's root directory. - The
test_games.logfile, used for testing, should be located in thetestsdirectory. - Adapt the paths in the scripts if your project structure is different.