refactor(server): tighten flag thresholds, add movement log
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.
This commit is contained in:
@@ -215,16 +215,16 @@ def plan_next_actions(req):
|
||||
if p["hasFlag"]:
|
||||
dest,temp = myMap.closest_in_range(p["posX"],p["posY"],my_targets)
|
||||
f,lentime = myMap.closest_in_range(p["posX"],p["posY"],regard_list)
|
||||
if (f is not None) and (lentime<=5):
|
||||
if f is not None and lentime<6:
|
||||
dest = (f[0],f[1])
|
||||
elif p["name"] in player_to_flag_assign:
|
||||
dest = player_to_flag_assign[p["name"]]
|
||||
f,lentime = myMap.closest_in_range(p["posX"],p["posY"],regard_list)
|
||||
if f is not None and lentime<=10:
|
||||
if f is not None and lentime<12:
|
||||
dest = (f[0],f[1])
|
||||
else :
|
||||
f,lentime = myMap.closest_in_range(p["posX"],p["posY"],pretend_list)
|
||||
if f is not None and lentime<8:
|
||||
if f is not None and lentime<6:
|
||||
dest = (f[0],f[1])
|
||||
else:
|
||||
f,temp = myMap.closest_in_range(p["posX"],p["posY"],regard_list)
|
||||
@@ -240,6 +240,7 @@ def plan_next_actions(req):
|
||||
dest = (f[0],f[1])
|
||||
else:
|
||||
continue
|
||||
print(f"Player {p['name']} at ({p['posX']},{p['posY']}) moving towards ({dest[0]},{dest[1]})")
|
||||
player_moves[p["name"]] = myMap.guideance(p["posX"],p["posY"],dest[0],dest[1])
|
||||
return player_moves
|
||||
|
||||
|
||||
Reference in New Issue
Block a user