aboutsummaryrefslogtreecommitdiff
path: root/planetwars-cli/assets
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-07-21 19:19:40 +0200
committerIlion Beyst <ilion.beyst@gmail.com>2022-07-21 19:19:40 +0200
commitc6293d8e328bb96c368921fe922092d4f27f0bc9 (patch)
tree1c374345ba911b79167ae70a654dd0618efa9446 /planetwars-cli/assets
parent31f8271db6735a1c7abea4d93bb3b8d7a3ce4628 (diff)
downloadplanetwars.dev-c6293d8e328bb96c368921fe922092d4f27f0bc9.tar.xz
planetwars.dev-c6293d8e328bb96c368921fe922092d4f27f0bc9.zip
delete old planetwars-cli code
Diffstat (limited to 'planetwars-cli/assets')
-rw-r--r--planetwars-cli/assets/hex.json43
-rw-r--r--planetwars-cli/assets/pw_workspace.toml6
-rw-r--r--planetwars-cli/assets/simplebot/botconfig.toml2
-rw-r--r--planetwars-cli/assets/simplebot/simplebot.py33
4 files changed, 0 insertions, 84 deletions
diff --git a/planetwars-cli/assets/hex.json b/planetwars-cli/assets/hex.json
deleted file mode 100644
index 5ef4f31..0000000
--- a/planetwars-cli/assets/hex.json
+++ /dev/null
@@ -1,43 +0,0 @@
-{
- "planets": [
- {
- "name": "protos",
- "x": -6,
- "y": 0,
- "owner": 1,
- "ship_count": 6
- },
- {
- "name": "duteros",
- "x": -3,
- "y": 5,
- "ship_count": 6
- },
- {
- "name": "tritos",
- "x": 3,
- "y": 5,
- "ship_count": 6
- },
- {
- "name": "tetartos",
- "x": 6,
- "y": 0,
- "owner": 2,
- "ship_count": 6
- },
- {
- "name": "pemptos",
- "x": 3,
- "y": -5,
- "ship_count": 6
- },
- {
- "name": "extos",
- "x": -3,
- "y": -5,
- "ship_count": 6
- }
- ]
-}
-
diff --git a/planetwars-cli/assets/pw_workspace.toml b/planetwars-cli/assets/pw_workspace.toml
deleted file mode 100644
index d82840f..0000000
--- a/planetwars-cli/assets/pw_workspace.toml
+++ /dev/null
@@ -1,6 +0,0 @@
-[paths]
-maps_dir = "maps"
-matches_dir = "matches"
-
-[bots.simplebot]
-path = "bots/simplebot"
diff --git a/planetwars-cli/assets/simplebot/botconfig.toml b/planetwars-cli/assets/simplebot/botconfig.toml
deleted file mode 100644
index b3a4163..0000000
--- a/planetwars-cli/assets/simplebot/botconfig.toml
+++ /dev/null
@@ -1,2 +0,0 @@
-name = "simplebot"
-run_command = "python3 simplebot.py" \ No newline at end of file
diff --git a/planetwars-cli/assets/simplebot/simplebot.py b/planetwars-cli/assets/simplebot/simplebot.py
deleted file mode 100644
index b2a6b8f..0000000
--- a/planetwars-cli/assets/simplebot/simplebot.py
+++ /dev/null
@@ -1,33 +0,0 @@
-import sys, json
-
-def move(command):
- """ print a command record to stdout """
- moves = []
- if command is not None:
- moves.append(command)
-
- print(json.dumps({ 'moves': moves }))
- # flush the buffer, so that the gameserver can receive the json-encoded line.
- sys.stdout.flush()
-
-
-for line in sys.stdin:
- state = json.loads(line)
- # you are always player 1.
- my_planets = [p for p in state['planets'] if p['owner'] == 1]
- other_planets = [p for p in state['planets'] if p['owner'] != 1]
-
- if not my_planets or not other_planets:
- # we don't own any planets, so we can't make any moves.
- move(None)
- else:
- # find my planet that has the most ships
- planet = max(my_planets, key=lambda p: p['ship_count'])
- # find enemy planet that has the least ships
- destination = min(other_planets, key=lambda p: p['ship_count'])
- # attack!
- move({
- 'origin': planet['name'],
- 'destination': destination['name'],
- 'ship_count': planet['ship_count'] - 1
- })