Advertisement
Guest User

SpaceWar2000

a guest
Apr 24th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.17 KB | None | 0 0
  1. # SPACE WAR 2000
  2.  
  3. ![](SpaceWar2000.png)
  4.  
  5. v0.1 4/24/2019
  6.  
  7. (Image: planets colored by owner, planet ids in yellow, population(growth rate) label, fleets colored by owner, population(turnes left) label, cyan planet destination.)
  8.  
  9. SpaceWar2000 is a simultaneous turn-based a 2-Player space battle for AI bots. The battlefield is a 2D collection of **planets**, each with a **population** of ships and a **growth rate**. Each planet is owned by **Player 1** or **Player 2** or **Unowned**. Players use populations of planets they control to launch **fleets** to attack other planets. The goal is to eliminate the opposing player or to have the highest population when the turn limit for the game is reached, which is currently 200 turns.
  10.  
  11. ## Bot interface
  12. A bot is a windows executable that reads standard input and writes to standard output. The commands are
  13.  
  14. | Command | Meaning |
  15. |----------------------|---------|
  16. | START enemyName seed | enemyName is a string, seed is an integer for seeding your rand |
  17. | STATE stateData | stateData is the state of the world, detailed below |
  18. | RESULT result | result is Win,Loss,Tie at the end of a game |
  19. | QUIT | Bot program should exit |
  20.  
  21. The bot, after receiving the state, must return a list of fleets to launch. This format is below.
  22.  
  23. ### State data
  24. The state is sent to the bot as one long string. Windows limits are (I think) 8192 chars, so all commands must be shorter than this (which is easy to do).
  25.  
  26. The state is a whitespace separated list of tokens, with the following formats:
  27.  
  28. | Item | tokens | Notes |
  29. | -- | -- | -- |
  30. | Planet | P x y owner ships growth | owner is 0 for unowned, 1 for your bot, 2 for enemy |
  31. | Fleet | F owner ships source dest turnsRemaining | turnsRemaining is how long till fleet lands |
  32. | End of items | E | the final token to mark end |
  33.  
  34. All values other than x and y are integers. x and y are doubles.
  35. owner is the id of the item owner: 0 = unowned, 1 = Player 1 (your bot), 2 = Player 2 = the enemy.
  36. source and dest are planet ids, 0+, ordered by the order in the state. These do not change during a game. turnsRemaining is how long till the fleet lands. This is computed as the distance between planets as a double, then rounded up, when the fleet is launched. It decrements one per turn.
  37.  
  38. ### Bot response
  39.  
  40. After receiving state data, the bot must return a single string with the list of fleets it wishes to launch. This has the format **`LAUNCH fleets E`** where fleets is a list of fleet launch commands, each of form TODO
  41.  
  42. Each turn the player can send fleets from any planet the player owns to any other planet as long enough ships are on the source planet. Multiple fleets can be sent from the same planet, if the total does not exceed the number on the planet. Multiple fleets can be sent to a destination planet.
  43.  
  44. Invalid orders lose immediately.
  45.  
  46. Bots have 5 seconds to reply, otherwise they forfeit.
  47.  
  48. ## Gameplay
  49. Each turn the game engine does the following four steps:
  50. 1. **Send state**. Each bot is sent the state via the interface as detailed above.
  51.  
  52. 2. **Receive orders**. The reply from each bot is gathered.
  53.  
  54. 3. **Update state**. This is is done in three steps: **departure** (fleets leave planets), **advancement** (fleets move closer, and planet growth rate adds to planet population), and **arrival** (battle resolution).
  55.  
  56. Arrival: Destination planets are handled one at a time. Any fleets reaching 0 turns left land, and all fleets and planet population merge or do battle. The owner with the most has the second most subtracted and becomes the owner of the planet. The third most is simply killed. If no one is left, the planet stays with the owner before the arrival.
  57.  
  58. 4. **Endgame**
  59. The game is over when:
  60. 1. Turn limit is reached. The winner is the one with the most ships (total on planets and in fleets).
  61. 2. One player has no planets or fleets, and the other does. The other player wins.
  62. 3. Both players have no planets or fleets. Then it’s a draw.
  63. 4. A bot sends an invalid request causes an immediate loss.
  64. 5. A bot runs over the time allowed.
  65.  
  66. END OF FILE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement