Generals.io is a multiplayer web game where the goal is to protect your general and capture the enemy generals.
This is a collection of various automated clients (bots) for playing Generals.io.
Project available on GitHub.
- Install Dependencies:
pip install -r requirements.txt
- Edit
bot_*.py
: At bottom set bot name and game type in bot_base.GeneralsBot(...)
- Blob Bot:
python bot_blob.py
- Path Bot:
python bot_path_collect.py
- bot_blob.py
- Run largest army to nearest priority target
- Move Border Armies Outward
- bot_path_collect.py
- Primary Path Routine: Run path from largest city to primary target
- Continue running after reaching primary target
- Collect Troops Routine (Run largest army toward nearest path tile)
- Move Border Armies Outward
- Proximity Targeting
- Primary Path Routine: Run path from largest city to primary target
- samples/nearest.py: Run largest army to nearest priority target
- Bot Base
- find_largest_tile(ofType, notInPath, includeGeneral): Returns largest tile ofType, notInPath, optionally includeGeneral
- find_city(ofType, notOfType, findLargest, includeGeneral): Finds largest/smallest city ofType (or notOfType), optionally includeGenerals
- find_closest_in_path(source_tile, path): Returns dest_tile in path nearest to source_tile
- find_closest_target(source): Returns closest tile to target given a source
- Do not target unreachable tiles
- find_primary_target(target): Returns primary tile to target, optionally given an previous unobtained target to consider
- Do not target unreachable tiles
- find_path(source, dest): Finds optimal path from source to dest
- Improve Pathfinding
- Correctly collect max chains and run shortest paths
- Improve Pathfinding
- path_forward_moves(path): Returns (from_tile, to_tile) to move next given the current state of a path.
- toward_dest_moves(source, dest): Returns DIRECTIONS array with first directions toward dest
- away_king_moves(source): Returns DIRECTIONS array with first directions away from general
- moves_random(): Returns DIRECTION array shuffled
- distance(source, dest): Returns Manhattan distance between source and dest
- place_move(source, dest, moveHalf=False): Place move from source to dest
- Only permit 1 move/turn
- validPosition(x,y): Returns boolean if x,y is valid tile in grid
- Client
- Join Game
- Receive Map Updates
- Maintain Map of tiles, with memory (remembers previously visited tiles).
- Make Moves
- Send/Receive Chat
- Viewer
- View Grid (Color tiles w/ army count, circles for cities/generals)
- Uniquely identify generals
- View Leaderboard (Sorted, colored boxes w/ player name, army count, and # tiles)
- Add player ratings estimated # cities
- View Grid (Color tiles w/ army count, circles for cities/generals)
@harrischristiansen HarrisChristiansen.com (harris@harrischristiansen.com)