Skip to content

LToronto/generals-bot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

generals.io Murderbot

This is a bot for bot.generals.io.

How to run:

  • In the ./src/ directory, create a config.js file with the following structure:
export default {
  GAME_ID: '{theNameOfTheGameToJoin}',
  BOT_NAME_1: '[Bot]botName',
  BOT_USER_ID_1: '{userIdFromLocalStorageFromIncognitoWindow}',
  BOT_VARIANT_1: 'MurderBot',
  BOT_NAME_2: '[Bot]botName',
  BOT_USER_ID_2: '{userIdFromLocalStorageFromIncognitoWindow}',
  BOT_VARIANT_2: 'EnigmaBot',
  // Set up multiple usernames/IDs so you can open a second tab and go to
  // /play/2, /play/3, etc. and have multiple bots join a game and play each other.
  ...
}

NOTE: Do not commit the file, or anyone could use your bot's identity

  • Open bot.generals.io/games/{GAME_ID}, and set desired game settings.
  • Run npm install and npm start.
  • Open localhost:3000/play/{botIdNumber}, and the corresponding bot will join the game.
  • Click the force_start option in the bot UI and the lobby UI to start the game.
To-Do List:
  • On turn 50, consolidate all newly-generated troops and either attack, expand, explore, or defend
  • Fuzzy recursive logic for army consolidation
    • Identify location of target
    • Only use the top x% armies
    • Identify the path the goes through the most other armies
    • If you have grabbed x% of desired armies, bail out early and execute
Stages of Development Replays:
Pieces of data to consider tracking
let dataToTrack = {
  foreignPolicy /* mode */: 'CREEP|TURTLE|EXPLORE|EXPAND|DEFEND|CONSOLIDATE|GATHER|MURDER|DECOY|ATTACK|GAMBIT',
	itemsOfInterest: {
		availableCities: [
			{
				color: 'NEUTRAL',
				location: undefined,
				totalArmies: undefined,
			}
		],
		easiestTarget: {},
		biggestThreat: {},
		enemies: [
			{
				color: undefined,
				disposition: 'NEUTRAL|AGGRESSIVE|INVADING|SUICIDAL',
				generalLocation: undefined,
				generalStrength: undefined,
				knowsMyGeneralLocation: false,
				totalFriendlyArmiesKilled: undefined,
				totalArmies: undefined,
				totalLand: undefined,
			}
		],
		pointsOfAttack: [

		]
	}
}

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.7%
  • HTML 0.3%