feat: Initial commit of Clutch-IQ project

This commit is contained in:
xunyulin230420
2026-02-05 23:26:03 +08:00
commit a355239861
66 changed files with 12922 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
import requests
import json
import time
url = "http://localhost:5000/predict"
# Test Case 1: CT Advantage (3v1, high health)
payload_ct_win = {
"game_time": 60.0,
"players": [
{"team_num": 3, "is_alive": True, "health": 100},
{"team_num": 3, "is_alive": True, "health": 100},
{"team_num": 3, "is_alive": True, "health": 90},
{"team_num": 2, "is_alive": True, "health": 50}
]
}
# Test Case 2: T Advantage (1v3)
payload_t_win = {
"game_time": 45.0,
"players": [
{"team_num": 3, "is_alive": True, "health": 10},
{"team_num": 2, "is_alive": True, "health": 100},
{"team_num": 2, "is_alive": True, "health": 100},
{"team_num": 2, "is_alive": True, "health": 100}
]
}
def test_payload(name, payload):
print(f"\n--- Testing {name} ---")
try:
response = requests.post(url, json=payload, timeout=2)
print("Status Code:", response.status_code)
if response.status_code == 200:
print("Response:", json.dumps(response.json(), indent=2))
else:
print("Error:", response.text)
except Exception as e:
print(f"Request failed: {e}")
if __name__ == "__main__":
# Wait a bit to ensure server is ready if run immediately after start
time.sleep(1)
test_payload("CT Advantage Scenario", payload_ct_win)
test_payload("T Advantage Scenario", payload_t_win)