Halite Home

CloudBots! Compete on-demand against some of my bots


#1

Download: https://dl.dropboxusercontent.com/u/57961/CloudBots.zip

How to use

If you want to run one of your bots against one of the bots in the cloud, you just need to disable the timeout (the -t option) and add the bot file of your choice to the competition.

Every request costs me a tiny tiny fraction of money (see AWS Lambda Pricing) so please be reasonable and don't run thousands of games. That being said, I'd need to play over 20,000 games in a month to cost more than like $10.00 so go nuts. I'll update if things get out of hand.

Each move requires a network request so bots will only be as fast as your latency to AWS US-East-1. Each request on the server usually takes less than 1s unless it needs to warm up (which can take about 10s). Many requests should take less than 100ms.

Installing

This requires you to have Node 7.x installed.

npm install

Running a bot

Make sure you're connected to the internet. Add node AliceBot.js or node BridgetBot.js to your list of bots.

Example:

./halite -t -d "35 35" "your bot here" "node AliceBot.js"

Bots

Alice

Stronger than Bridget. Might rank close to the top of Gold?

Bridget

In the OverkillBot lineage. Would maybe be Gold level?

Cathy

Was recently in the top 5 bots. Achieved rank 1.

Future

I'll probably add some more bots over time. Let me know if it would be helpful to add weaker bots.

How does it work?

I have included some JavaScript files that hit the appropriate endpoints for each of these bots.

const request = require('request');

const Networking = require('./networking');

const network = new Networking('AliceBot');

let moves = [];

network.on('map', (gameMap, id) => {
    request({
        url: 'https://k0zitn07h5.execute-api.us-east-1.amazonaws.com/prod/bots/bridget',
        method: 'POST',
        json: true,
        body: {
            id,
            gameMap,
            previousMoves: moves,
        }
    }, (error, response, body) => {
        moves = body.moves;
        network.sendMoves(moves);
    });
});

The 2 bots currently available are at:

They expect a POST request with a JSON body of the format:

{
  // my player id
  "id": 2,
  // the game map for this frame
  "gameMap": {
    "width": 20,
    "height": 20,
    // contents is a 2d array of sites
    "contents": [
      [
        {
          "owner": 0,
          "strength": 51,
          "production": 3
        },
        // ....
      ]
    ]
  },
  // the moves from the previous turn
  // at the start of the game it should be an empty array
  "previousMoves": []
}

And will respond with a list of moves:

{
  "moves": [
    {
      "loc": {
        "x": 10,
        "y": 14
      },
      "dir": 2
    }
  ]
}

Example:

// request.json is a file with the input body
curl -X POST -d @request.json 'https://k0zitn07h5.execute-api.us-east-1.amazonaws.com/prod/bots/alice'

Challenge other bots
#2

This is amazing.


#3

ok, so I was trying your bots as a relative node noob. The first error I got was about use_strict, so I found I could run node --use_strict AliceBot.js. I then had to install the module request. I am now getting Unexpected token { with the error below, any hints or ideas?

--- Init ---
/home/stuart/Downloads/aws_bots/networking.js:4
--- Bot used 220 milliseconds ---


--- Frame #1 ---
const { GameMap } = require('./hlt.js');
--- Bot used 0 milliseconds ---
ERRORED!
Response received (if any):
const { GameMap } = require('./hlt.js');
--- Bot was killed. Below is the rest of its output (if any): ---
^

SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object. (/home/stuart/Downloads/aws_bots/AliceBot.js:3:20)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)

--- End bot output ---


#4

ok, so apparently ubuntu was using node version 4.2.6 and the latest is 7.2.1 Once I upgraded to the latest node it is working fine without the --using_strict. I used the instructions below.

sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo ln -sf /usr/local/n/versions/node/7.2.1/bin/node /usr/bin/node

from the link below, where he also tells you how to undo it


#5

Cool stuff! Works absolutely fine for me.


#6

HOLY CRAP, THIS IS AWESOME.

Fantastic work.


#7

I added another bot: CathyBot.

It's based on the bot I recently had on the leaderboard that was briefly ranked #1. The CloudBots.zip file has been updated or you can just change the url to https://k0zitn07h5.execute-api.us-east-1.amazonaws.com/prod/bots/cathy.


#8

The month of December cost me all of $0.05 and I was nowhere near exceeding the AWS Lambda free tier :thumbsup:


#9

Are you going to post your bots to github after the competition i over?


#10

Yes, definitely.


#11

Awesome, thanks!