This is the official template for creating bots for Trash Panda Royal game. Use this template to start building your own bot!
For each turn, your bot will receive this data structure in req.body
:
{
gameState: string, // The game board as a string with '\n' line breaks
player: { // Your player information
health: number, // Your current health
position: {
x: number, // Your X position (0-7)
y: number // Your Y position (0-7)
}
},
enemy: { // Enemy information
health: number, // Enemy current health
position: {
x: number, // Enemy X position (0-7)
y: number // Enemy Y position (0-7)
}
}
}
U = Facing Up
D = Facing Down
L = Facing Left
R = Facing Right
. = Empty space
# = Wall
The gameState
string represents an 8x8 game board with each row separated by newline characters (\n
).
The string structure:
- Contains 8 rows of 8 characters each
- Each row is separated by
\n
- Total length: 71 characters (63 for the board + 7 newlines)
- Access a position:
gameState.split('\n')[y][x]
- Total board size: 8x8 tiles
- Middle of the board (rows 3 and 4) contain walls
Example board:
.......D
........
........
######## // Middle walls are always here
######## // Middle walls are always here
........
........
D.......
Your bot should return one of these numbers:
0 = Move Forward
1 = Turn Right
2 = Turn Left
3 = Shoot
- Install dependencies:
npm install express cors body-parser
- Run your server:
node server.js
- Create a tunnel (choose one):
# Cloudflare
npm install -g cloudflared
cloudflared tunnel --url http://localhost:6969
# OR Localtunnel
npm install -g localtunnel
lt --port 6969
# OR Ngrok
ngrok http 6969
PS: localhost need you to verify the tunnel. GO to the link you made and follow the instructions
- Add your tunnel URL to Trash Panda Royal to start playing!
The template includes:
- Basic Express server setup
- CORS enabled
- JSON body parsing
- Request/Response structure
- Example random move generation
Just modify the move
logic in the POST route to implement your strategy!