A keyboard-controlled bot for the BotWar game that collects points in a randomly generated maze.
- The bot must collect normal points (1 pt) and mega points (20 pts)
- The maze and points are randomly generated
- The bot collects points automatically when moving over them
- The bot moves only when you press arrow keys on your keyboard
GET /action: Returns the current bot actionPOST /action: Receives move command and updates bot stateGET /: Serves the keyboard controller interface
bot-war-api/
├── back/
│ ├── server.js # Main bot server
│ └── server.test.js # Tests for the bot
├── front/
│ └── index.html # Keyboard controller interface
├── .github/
│ └── workflows/
│ └── deploy.yml # GitHub Actions deployment
├── Dockerfile # Docker configuration
├── package.json # Node.js dependencies
└── README.md # This file
-
Install dependencies:
npm install
-
Run the bot locally:
npm start
-
Run tests:
npm test
Build and run with Docker:
docker build -t botwar-bot .
docker run -p 3000:3000 botwar-botThe bot is automatically deployed to Railway when you push to the main branch.
To deploy manually:
- Get a Railway token from https://railway.app/account/tokens
- Add it as a GitHub secret named
RAILWAY_TOKEN - Push to main branch
This is a keyboard-controlled bot that:
- Moves only when you press arrow keys
- Always tries to collect points
- Has a simple web interface for control
- Stores the current move state
- Open the controller: Visit your bot's URL (e.g.,
https://your-bot.railway.app) - Use arrow keys or click buttons to control movement
- The bot will move in the direction you choose
- Action is automatically set to "COLLECT" to gather points
- ↑ (Arrow Up): Move UP
- ↓ (Arrow Down): Move DOWN
- ← (Arrow Left): Move LEFT
- → (Arrow Right): Move RIGHT
- Spacebar: STAY in place