Status: Coursework project for Tel Aviv University's Advanced Programming course. Not maintained — provided as-is for reference.
A tank battle simulation framework supporting 2 players with modular architecture. The system uses shared libraries for algorithms and game managers, enabling dynamic strategy loading and comparison. Player assignment follows modulo 2 logic (odd players = Basic/Defensive, even players = Offensive).
Key Features:
- 2-player tank battles
- Dynamic algorithm loading via shared libraries
- Web-based UI for game configuration and execution
- Real-time visualization with step-by-step replay
📁 c-Game_Board/
├── 📁 Algorithm/ # Player algorithm implementations (shared library)
├── 📁 GameManager/ # Game logic and management (shared library)
├── 📁 Simulator/ # Main simulation engine and entry point
├── 📁 UserCommon/ # Shared utilities and game objects
│ ├── 📁 objects/ # Game entities (Tank, Shell, etc.)
│ ├── 📁 utils/ # Utility classes (Point, Direction, etc.)
│ └── 📁 bonus/ # Bonus features
│ ├── 📁 ui_server/ # Web-based UI server
│ └── 📁 visualization/ # Game visualization system
└── 📁 common/ # Interface definitions and contracts
The project uses modular shared libraries (.so files) for algorithms and game management, enabling dynamic loading of different player strategies and game rules.
- Basic Mode: Single game between two algorithms using one game manager
- Comparative Mode: Test two algorithms across multiple game managers
- Competition Mode: Tournament between algorithms across multiple maps
Specifies board layout:
- First five lines (header):
- Map name/description (string)
- MaxSteps =
- NumShells =
- Rows =
- Cols =
- Subsequent lines: board content (
#: Wall (2 hits),1/2: Player tanks,@: Mine,: Empty). - In order to start the game the file must include all header lines.
2-Player Battle:
Complex Battle Arena
MaxSteps = 1000
NumShells = 15
Rows = 15
Cols = 15
# #@
# 2
# #
## #
1 @ @#@ #
@ @ 2
# @
1@ @
@@@ @# @ #
@ @#@
@ # #
@ # #
1 @@# @#
#
# 2
The game generates output files in the same directory as the input file:
- output_<input_file>.txt - Complete game log with player moves and final results
- output_<input_file>_visualization.html - Interactive game replay (if visualization enabled)
- input_errors.txt - Error handling log (if input errors occur)
The project supports multiple build configurations using CMake options:
# Standard build (basic functionality only)
mkdir build && cd build
cmake ..
make
# Full build with all features enabled
cmake -DENABLE_TESTING=ON -DENABLE_VISUALIZATION=ON -DENABLE_UI=ON ..
makeAvailable Build Options:
DENABLE_TESTING=ON: Builds unit tests using Google Test frameworkDENABLE_VISUALIZATION=ON: Enables HTML visualization generationDENABLE_UI=ON: Builds the web-based UI server
The simulator supports three execution modes, each with specific command-line arguments and output formats:
Single game between two algorithms using one game manager.
Command:
../Simulator/simulator_318835816_211314471 -basic \
game_map=<input_file.txt> \
game_manager=<path_to_game_manager.so> \
algorithm1=<path_to_first_algorithm.so> \
algorithm2=<path_to_second_algorithm.so> \
[-verbose]Example:
../Simulator/simulator_318835816_211314471 -basic game_map=../UserCommon/bonus/ui_server/examples/game_maps/input_a.txt game_manager=../UserCommon/bonus/ui_server/examples/game_managers/RealGameManager_318835816_211314471.so algorithm1=../UserCommon/bonus/ui_server/examples/algorithms/TestAlgorithm_098765432_123456789.so algorithm2=../UserCommon/bonus/ui_server/examples/algorithms/RealAlgorithm_318835816_211314471.soOutput: Game results printed to console, full game log if verbose flag is set.
Compare multiple game managers with the same algorithms on a single map.
Command:
../Simulator/simulator_318835816_211314471 -comparative \
game_map=<input_file.txt> \
game_managers_folder=<path_to_gm_folder> \
algorithm1=<algorithm1.so> \
algorithm2=<algorithm2.so> \
[num_threads=<num>] [-verbose]Example:
../Simulator/simulator_318835816_211314471 -comparative game_map=../UserCommon/bonus/ui_server/examples/game_maps/input_a.txt game_managers_folder=../UserCommon/bonus/ui_server/examples/game_managers algorithm1=../UserCommon/bonus/ui_server/examples/algorithms/TestAlgorithm_098765432_123456789.so algorithm2=../UserCommon/bonus/ui_server/examples/algorithms/RealAlgorithm_318835816_211314471.so num_threads=4Output: comparative_results_<timestamp>.txt in the game managers folder, containing:
- Input parameters (map, algorithms)
- Results grouped by identical outcomes
- Final game state for each result group
Tournament between multiple algorithms across multiple maps.
Command:
../Simulator/simulator_318835816_211314471 -competition \
game_maps_folder=<maps_folder> \
game_manager=<game_manager.so> \
algorithms_folder=<algorithms_folder> \
[num_threads=<num>] [-verbose]Example:
../Simulator/simulator_318835816_211314471 -competition game_maps_folder=../UserCommon/bonus/ui_server/examples/game_maps game_manager=../UserCommon/bonus/ui_server/examples/game_managers/RealGameManager_318835816_211314471.so algorithms_folder=../UserCommon/bonus/ui_server/examples/algorithms num_threads=4Output: competition_<timestamp>.txt in the algorithms folder, containing:
- Tournament configuration
- Final leaderboard sorted by score (3 pts/win, 1 pt/tie, 0 pts/loss)
# Start web server
./tank_simulator_ui
# Open browser to http://localhost:8080
# Configure and run any mode through the web interfaceThe project includes several advanced features beyond the basic requirements. For complete technical details, see bonus.txt.
A complete browser-based interface for game configuration, execution, and monitoring.
Features:
- Multi-Mode Support: Basic, Comparative, and Competition game modes
- Real-Time Execution: Live console output streaming and process monitoring
- Interactive Configuration: Dynamic forms with file path validation
- Professional Results Display: Parsed results with leaderboards and visualizations
- RESTful API: Backend provides endpoints for simulation control and result retrieval
Usage:
# Build with UI enabled
cmake -DENABLE_UI=ON ..
make tank_simulator_ui
# Start the web server
./tank_simulator_ui
# Open browser to: http://localhost:8080Architecture:
- Backend: C++ HTTP server using cpp-httplib
- Frontend: Modern HTML5/CSS3/JavaScript with responsive design
- Process Management: Real-time command execution with output capture
HTML-based game visualization with step-by-step replay capabilities.
Features:
- Step-by-Step Replay: Interactive controls for game progression
- 2-Player Display: Visual identifiers for both players
- Rich Game State: Tank positions, directions, shells, mines, walls, and health status
- Player Statistics: Remaining ammunition and active/destroyed tank status
- Action Descriptions: Detailed explanations of each player's chosen actions
Compilation Requirements:
# Build with visualization enabled
cmake -DENABLE_VISUALIZATION=ON ..
makeUsage:
# Command-line usage (requires -verbose flag for visualization generation)
# Game manager should be compiled with -DENABLE_VISUALIZATION=ON
../Simulator/simulator_318835816_211314471 -basic \
game_map=<input_file.txt> \
game_manager=<game_manager.so> \
algorithm1=<algorithm1.so> \
algorithm2=<algorithm2.so> \
-verbose
# Open the generated visualization file in browser
# File: output_<input_file>_visualization.htmlImportant Notes:
- Verbose Mode Required: Visualization is only generated when the
-verboseflag is used or verbose mode is enabled in the web UI - Compilation Dependency: Visualization features require
DENABLE_VISUALIZATION=ONduring build
Unit testing using Google Test with extensive coverage:
- Component Tests: GameBoard, Tank, Shell, Algorithms, Collision mechanics
- Edge Case Testing: Board wrapping, collision detection, game rules validation
- Mock Objects: Isolated testing of algorithmic behavior
- Test Fixtures: Complex scenario testing with reproducible conditions
Usage:
# Build with testing enabled
cmake -DENABLE_TESTING=ON ..
make
# Run all tests (from build directory)
./tests/usercommon_tests # UserCommon library tests
./tests/algorithm_tests # Algorithm implementation tests
./tests/GameManager_tests # Game manager tests
./tests/Simulator_tests # Simulator engine tests