- Add imports for server0 and server1 modules
- Modify start_game, plan_next_actions, and game_over to invoke both strategies
- Implement dynamic strategy selection based on player prison counts
- Add A* pathfinding with danger weights for attacking players, including safe/dangerous position calculations and opponent avoidance
- Update traditional pathfinding for defenders and flag carriers in enemy territory
- Include binary updates to .DS_Store files (likely system artifacts)
Previously, the code assumed dest was always a valid tuple, potentially causing errors if dest was None. Added a check to guide to current position when dest is None, ensuring safe fallback behavior.
- Modified plan_next_actions in server.py to remove selected positions from regard_list, preventing reuse in subsequent planning steps for better AI decision-making
- Added comprehensive unit tests in test_map.py for enemy_to_walls and choose_enemy functions to ensure correct behavior and distance calculations in the game map
- Remove unused `random` import and introduce `collections` for BFS queue.
- Decrease `GameMap` update interval from 1000 ms to 1 ms and lower `update_threshold` from 100 to 1 for near‑real‑time world state.
- Add thread‑safe lock, timestamp tracking, and rename `player_to_flag_assignments` to `player_to_flag_assign`.
- Introduce `my_side_is_left` flag to differentiate safe‑zone logic.
- Implement new `Map` class:
* Stores grid, edges, and safe‑zone status.
* Updates grid with walls, allies, enemies, and safe‑zone handling.
* Computes adjacency edges respecting obstacles.
* Provides `guideance` (BFS) to obtain the first movement direction towards a target.
- Overall refactor improves AI flag‑picking speed and decision accuracy.
Adjusted range checks for flag handling:
- Changed `lentime<=5` to `lentime<6`.
- Updated `lentime<=10` to `lentime<12`.
- Modified `lentime<8` to `lentime<6`.
These tweaks refine the decision logic for flag acquisition, ensuring more consistent behavior at boundary values.
Added a debug print statement to log each player's current position and target destination, aiding in troubleshooting movement decisions.
- Decrease `GameMap` update interval from 10 ms to 1 ms and lower `update_threshold` to 1 for more responsive state syncing.
- Remove unused `random` import.
- Adjust safe‑zone detection to offset player position based on team side.
- Restrict enemy marking to opponent side, preventing incorrect obstacle placement.
- Update edge generation logic to correctly handle safe‑zone and opponent cells.
- Add `closest` and `closest_in_range` helper methods that compute nearest positions while respecting team side boundaries.
- Introduce global `my_side_is_left` handling within `Map.update` for side‑dependent calculations.
These changes improve map accuracy, AI pathfinding, and overall game performance.
Extend the decision flow in `plan_next_actions` to consider the `pretend_list` when no suitable
target is found in `regard_list` within the 10‑unit time threshold. The new fallback selects a
destination from `pretend_list` if its travel time is under 8 units, improving target
selection robustness.
- Removed leftover debug `print` statement.
- Updated enemy marking to consider team side, preventing marking of opponents on the opposite side.
- Introduced `closest_in_range` method to find the nearest position while respecting map side boundaries.
- Integrated the new method into `plan_next_actions` to select destinations based on distance thresholds for flag carriers and assigned players.
- Added handling for `my_targets` via a dedicated `targets_list`.
- Reduce `show_gap_in_msec` from 10 ms to 1 ms and `update_threshold` from 10 to 1 for faster game state updates.
- Use `global my_side_is_left` in `Map.update` and adjust safe‑zone calculation with a one‑cell offset, fixing zone detection.
- Correct edge generation logic to properly handle safe and unsafe zones.
- Add tracking of enemy players without flags (`pretend_list`) and own flags (`protect_list`) to broaden target options.
- Implement fallback destination selection: prioritize enemy flags, then enemy players, then own flags.
- Clean up stray debug prints and minor formatting issues.
- Introduced `Map.closest` to encapsulate nearest‑position search and replaced duplicated distance loops in flag targeting.
- Updated flag assignment to consider enemy players carrying flags and to use the new helper for both ally and enemy flag selection.
- Cleaned up unused imports and renamed `mypolicy` to `mypolicy.py` for clarity.
- Adjusted frontend `game_config.json` to use new team identifiers, increase players to 3, raise flag count to 9, and enable random flag placement.
Introduce a new `CTF/backend/mypolicy` Python module that implements a comprehensive game policy for the capture‑the‑flag bot. The file defines a global world model, thread‑safe state handling, and a `Map` class that builds a grid representation of the game map, generates traversable edges, and provides BFS‑based `guideance` and `length` methods for pathfinding and distance calculation. This policy enables the bot to make informed movement decisions based on safe zones, walls, allies, and enemies. Additionally, macOS `.DS_Store` placeholder files were added to the repository.
- Reduce `GameMap` update interval from 1000 ms to 10 ms for more responsive gameplay.
- Introduce thread lock, update thresholds, and player‑to‑flag tracking variables for safer concurrent access.
- Add `my_side_is_left` flag to determine team orientation.
- Implement new `Map` class:
* Builds a grid representation of the world, marking walls, enemy flag carriers, and allies.
* Generates adjacency lists (`edge`) respecting safe‑zone rules.
* Provides `guideance` method that runs a BFS (unit‑weight Dijkstra) to compute the shortest path and returns the first movement direction via `world.get_direction`.
- Import `collections` for efficient deque usage.
- Include compiled `.pyc` for the new module.
These changes enable the policy to make quick, informed movement decisions based on real‑time map analysis.
Add a comprehensive Chinese README (README‑cn.md) that explains the Capture‑the‑Flag game rules, setup instructions, and participant tasks.
Introduce a new backend script (backend/mypolicy.py) providing a basic world model, start_game, and plan_next_actions functions with simple flag‑assignment logic, serving as a starter implementation for the CTF challenge. This documentation and starter code help participants understand and begin developing their own algorithms.
new file: CTF/.ipynb_checkpoints/fixed_map_example-checkpoint.png
new file: CTF/.ipynb_checkpoints/random_map_example-checkpoint.png
new file: CTF/CTF/README.md
new file: CTF/CTF/backend/example_init.json
new file: CTF/CTF/backend/example_plan_next_actions.json
new file: CTF/CTF/backend/lib/game_engine.py
new file: CTF/CTF/backend/main.ipynb
new file: CTF/CTF/backend/pick_closest_flag.py
new file: CTF/CTF/backend/pick_flag_ai.py
new file: CTF/CTF/backend/python_tutorial.ipynb
new file: CTF/CTF/backend/start.sh
new file: CTF/CTF/backend/test_lib.ipynb
new file: CTF/CTF/fixed_map_example.png
new file: CTF/CTF/frontend/assets/characters.png
new file: CTF/CTF/frontend/assets/characters_red_flag.png
new file: CTF/CTF/frontend/assets/characters_yellow_flag.png
new file: CTF/CTF/frontend/assets/red_flag_16_16.png
new file: CTF/CTF/frontend/assets/red_flag_32_32.png
new file: CTF/CTF/frontend/assets/tilemap.json
new file: CTF/CTF/frontend/assets/tilemap.tmx
new file: CTF/CTF/frontend/assets/tiles.png
new file: CTF/CTF/frontend/assets/yellow_flag_16_16.png
new file: CTF/CTF/frontend/assets/yellow_flag_32_32.png
new file: CTF/CTF/frontend/game_config.json
new file: CTF/CTF/frontend/index.html
new file: CTF/CTF/frontend/phaser.js
new file: CTF/CTF/frontend/project.config
new file: CTF/CTF/frontend/src/assets.js
new file: CTF/CTF/frontend/src/gameObjects/Flag.js
new file: CTF/CTF/frontend/src/gameObjects/Player.js
new file: CTF/CTF/frontend/src/main.js
new file: CTF/CTF/frontend/src/scenes/Boot.js
new file: CTF/CTF/frontend/src/scenes/Game.js
new file: CTF/CTF/frontend/src/scenes/GameOver.js
new file: CTF/CTF/frontend/src/scenes/Preloader.js
new file: CTF/CTF/frontend/start.sh
new file: CTF/CTF/random_map_example.png
new file: CTF/README.md
new file: CTF/backend/.ipynb_checkpoints/main-checkpoint.ipynb
new file: CTF/backend/.ipynb_checkpoints/pick_closest_flag-checkpoint.py
new file: CTF/backend/.ipynb_checkpoints/pick_flag_ai-checkpoint.py
new file: CTF/backend/.ipynb_checkpoints/python_tutorial-checkpoint.ipynb
new file: CTF/backend/.ipynb_checkpoints/start-checkpoint.sh
new file: CTF/backend/.ipynb_checkpoints/test_lib-checkpoint.ipynb
new file: CTF/backend/example_init.json
new file: CTF/backend/example_plan_next_actions.json
new file: CTF/backend/lib/__pycache__/game_engine.cpython-313.pyc
new file: CTF/backend/lib/game_engine.py
new file: CTF/backend/main.ipynb
new file: CTF/backend/pick_closest_flag.py
new file: CTF/backend/pick_flag_ai.py
new file: CTF/backend/python_tutorial.ipynb
new file: CTF/backend/start.sh
new file: CTF/backend/test_lib.ipynb
new file: CTF/fixed_map_example.png
new file: CTF/frontend/.ipynb_checkpoints/game_config-checkpoint.json
new file: CTF/frontend/assets/.ipynb_checkpoints/tilemap-checkpoint.json
new file: CTF/frontend/assets/characters.png
new file: CTF/frontend/assets/characters_red_flag.png
new file: CTF/frontend/assets/characters_yellow_flag.png
new file: CTF/frontend/assets/red_flag_16_16.png
new file: CTF/frontend/assets/red_flag_32_32.png
new file: CTF/frontend/assets/tilemap.json
new file: CTF/frontend/assets/tilemap.tmx
new file: CTF/frontend/assets/tiles.png
new file: CTF/frontend/assets/yellow_flag_16_16.png
new file: CTF/frontend/assets/yellow_flag_32_32.png
new file: CTF/frontend/game_config.json
new file: CTF/frontend/index.html
new file: CTF/frontend/phaser.js
new file: CTF/frontend/project.config
new file: CTF/frontend/src/assets.js
new file: CTF/frontend/src/gameObjects/Flag.js
new file: CTF/frontend/src/gameObjects/Player.js
new file: CTF/frontend/src/main.js
new file: CTF/frontend/src/scenes/Boot.js
new file: CTF/frontend/src/scenes/Game.js
new file: CTF/frontend/src/scenes/GameOver.js
new file: CTF/frontend/src/scenes/Preloader.js
new file: CTF/frontend/start.sh
new file: CTF/random_map_example.png