Entries are now closed. Any new entries or edits will not be counted in the final run.
Join the chat!
Challenge
Try to fill the canvas with as much paint as possible. Be careful of other bots that may paint over your hard work though!
Note: In this challenge description, paint means to change the colour of the square on the grid and unpainted means that the square on the grid has the colour 0 and is not attributed to any of the bots.
Input
Your function will be given four arguments: yourself, the grid, the position of all bots on the grid and game information.
Myself
This is a 1D array which denotes your colour and position on the grid: [id, xpos, ypos]
.
The top left corner of the grid is the position (0, 0)
. The position (1,0)
is to the right of that and the position (0,1)
is below
Your id is an integer which is synonymous with your colour (see below to find out how your id affects how you paint the grid). Your ID is unique to your bot.
Grid
This is a 2D array which contains integers which tell you what colour each cell is. If the number of a grid cell is 0
, that means that the cell is unpainted. If the number of grid cell is an integer x
, this means that the cell has been painted by the bot with the ID x
.
To get the colour of the grid at position (x, y)
, use the array like so: grid[x][y]
.
Bots
This is an array which contains information about the position of the bots. Each element of the bots array is an array which describes each bot and looks like: [id, xpos, ypos]
, where id
is the ID of the bot, xpos
is the x position of the bot and ypos
is the y position of the bot.
This array includes your own bot's position and id. Eliminated bots will not be included in this array.
Game Information
This is an array containing information about the current game and looks like: [roundNum, maxRounds]
where roundNum
is the number of the current round (1-indexed) and maxRounds
is the number of rounds in the current game.
Output
The output should be a string returned by your function. This is the movement command.
The movement command determines your next move. The available commands are:
up
down
left
right
wait
Whenever you move, you paint the square you move to. (see below for more information)
Where wait
means you do not move. (but you paint the square that you stay on)
If you try to move outside of the grid, your command will be ignored and you will stay in the same place.
Painting the grid
Whenever you move to a square, you paint it, but there are rules which determine what the colour of that square will be.
If the square is unpainted (0), then you simply paint it the same colour as your own ID. However, if the square has been painted previously (non-zero) then the resulting colour of the square will be found according to the following JavaScript code:
[botColour, 0, floorColour][Math.abs(botColour - floorColour)%3]
This formula is made so as to allow a bot to move over its own colour without repainting it.
Elimination
If, after round 5, you have one or fewer squares painted (the number of squares on the grid which are the same colour as you) then you will be eliminated. This means that you will no longer be in the game and will automatically lose.
Rules
- Your code must a function of the type
function(myself, grid, bots, gameInfo) {
// Code here
return move;
}
- The grid will be a square of side length \$\text{Number of competing bots} \times 3\$
- To prevent specific bots from being targeting, the bots' IDs will be randomised.
- When two bots occupy the same space, the colour of that space will be made unpainted.
- Movement is turn-based i.e. during a round, all bots are supplied with identical
grid
,bots
andgameInfo
arguments
- You may create a maximum of three bots
- Bots may work together but must not communicate with each other and will not know each others IDs. The wins will be awarded individually rather than as a team.
- You must not create a bot which intentionally targets a single, pre-chosen bot. You may, however, target the tactics of a general class of bots.
- Your bot may store data in
window.localStorage
. Each bot must use their own data object. If a bot is found to be reading another bot's data (accidentally or on purpose) it will be disqualified until the issue is resolved. - If your bot uses random numbers, please use
Math.random()
Controller
The controller can be found here:
https://gist.github.com/beta-decay/10f026b15c3babd63c004db1f937eb14
Or you can run it here: https://beta-decay.github.io/art_attack
Note: I would advise that you do any testing offline (download the controller from the gist) as the webpage is subject to change at any moment.
When all of the bots have been added, I will run the 10,000 games with the stripped down controller with no graphical interface. You can run it here: https://beta-decay.github.io/art_attack/fast
Winning
The player who has filled the most of the canvas wins the game (a game is 2000 rounds). In the event of a draw, all drawn players win.
The player which wins the most out of 10,000 games wins the challenge.
The 10,000 games is estimated to be run next Monday (2018-08-27 at 23:00 UTC+1).
[botColour, 0, floorColour][Math.abs(botColour - floorColour)%3]
into English, please? \$\endgroup\$[botColour, 0, floorColour][Math.abs(botColour - floorColour)%3]
formula, whether or not does a bot get lucky & get to paint over big competitors (or gets painted over). Also take in account the trolls/hunters which can single-handedly destroy a bot of their choosing. Either way, it'll average out on the 10000 games. \$\endgroup\$