Skip to content

Commit 51ebf76

Browse files
feat: add Vector Rumble bot
1 parent 7f010e3 commit 51ebf76

5 files changed

Lines changed: 52 additions & 1 deletion

File tree

bots/python/Vector/Vector.cmd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@echo off
2+
python "%~dp0src\Vector.py" %*

bots/python/Vector/Vector.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "Vector",
3+
"version": "1.0.0",
4+
"authors": ["Tank Royale Rumble maintainers"],
5+
"description": "A small source-only bot that circles the arena while tracking opponents.",
6+
"platform": "Python",
7+
"programmingLang": "Python 3",
8+
"gameTypes": ["1v1", "melee", "twinduel"],
9+
"license": "Apache-2.0"
10+
}

bots/python/Vector/Vector.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env sh
2+
set -eu
3+
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
4+
if [ -n "${RUMBLE_PYTHON:-}" ]; then
5+
exec "$RUMBLE_PYTHON" "$SCRIPT_DIR/src/Vector.py" "$@"
6+
fi
7+
if command -v python3 >/dev/null 2>&1; then
8+
exec python3 "$SCRIPT_DIR/src/Vector.py" "$@"
9+
fi
10+
exec python "$SCRIPT_DIR/src/Vector.py" "$@"

bots/python/Vector/src/Vector.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""A compact Rumble catalog bot used for the first live ranked 1v1 proof."""
2+
3+
import os
4+
5+
6+
if os.environ.get("RUMBLE_SMOKE") == "1":
7+
print("RUMBLE_SMOKE_READY Vector")
8+
raise SystemExit(0)
9+
10+
from robocode_tank_royale.bot_api.bot import Bot
11+
12+
13+
class Vector(Bot):
14+
"""Sweeps the radar while travelling in a wide arc."""
15+
16+
def run(self) -> None:
17+
self.turn_radar_right(360)
18+
while self.running:
19+
self.set_turn_right(30)
20+
self.forward(10_000)
21+
22+
23+
def main() -> None:
24+
Vector().start()
25+
26+
27+
if __name__ == "__main__":
28+
main()

tests/test_validate_bot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ def test_version_increase_supersedes_the_previous_catalog_entry(self) -> None:
101101
config_path.write_text(json.dumps(config), encoding="utf-8")
102102
self.assertEqual(0, self.run_validator("--generate").returncode)
103103
catalog = json.loads((self.root / "bots" / "index.json").read_text(encoding="utf-8"))
104-
self.assertEqual(["superseded", "active"], [entry["status"] for entry in catalog["bots"]])
104+
orbit = [entry for entry in catalog["bots"] if entry["name"] == "Orbit"]
105+
self.assertEqual(["superseded", "active"], [entry["status"] for entry in orbit])
105106

106107
def test_new_bot_from_another_owner_ignores_unchanged_catalog_entries(self) -> None:
107108
self.assertEqual(0, self.run_validator("--generate").returncode)

0 commit comments

Comments
 (0)