refactor(game): add Map.closest and improve flag assignment logic

- 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.
This commit is contained in:
2025-12-27 22:10:46 +08:00
parent 8ef3f65ce9
commit b038e5ac29
38 changed files with 28 additions and 255576 deletions
+7 -7
View File
@@ -1,16 +1,16 @@
{
"teams": [
{ "name": "L", "who": "user11-1"},
{ "name": "R", "who": "human"}
{ "name": "L", "who": "user0-1"},
{ "name": "R", "who": "user0-2"}
],
"setup": {
"numPlayers": 1,
"numFlags": 3,
"useRandomFlags": false
"numPlayers": 3,
"numFlags": 9,
"useRandomFlags": true
},
"servers": {
"user0-1": "ws://115.191.4.103:34568",
"user0-2": "ws://115.191.4.103:34569",
"user0-1": "ws://0.0.0.0:11451",
"user0-2": "ws://0.0.0.0:11452",
"user1-1": "ws://115.191.4.103:34571",
"user1-2": "ws://115.191.4.103:34572",
"user2-1": "ws://115.191.4.103:34574",