60
19
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).
1@Mast You have no control over the colour of the paint: whenever you move to a square, that square is painted – Beta Decay – 2018-08-20T13:04:13.197
1@user202729
When two bots occupy the same space, the colour of that space will be made unpainted.
– Beta Decay – 2018-08-20T13:52:41.8137Could you translate
[botColour, 0, floorColour][Math.abs(botColour - floorColour)%3]
into English, please? – Fund Monica's Lawsuit – 2018-08-21T00:04:09.8008@NicHartley Bots that have ids that are a multiple of 3 apart can cover each other's paint directly. Bots that are 1 more than a multiple of 3 apart can erase each other's paint, but it takes another round to repaint. Bots that are 2 more than a multiple of 3 apart can't affect each other's paint at all. – None – 2018-08-21T01:02:34.100
What happens if the code throws some errors, or tries to go outside of the grid (invalid move)? Is it going to be eliminated? Can you clarify? – kenorb – 2018-08-21T01:30:06.843
@kenorb: "If you try to move outside of the grid, your command will be ignored and you will stay in the same place." The first question is a good one, though. – Ramillies – 2018-08-21T07:42:33.573
2@kenorb If your code errors, the game will stop and I will tell you to fix the error – Beta Decay – 2018-08-21T09:43:53.360
@BetaDecay I'm fascinated by the lack of consistency of the results. Perhaps the results oscillate wildly based on initial position? – Don Thousand – 2018-08-21T16:13:14.823
4@RushabhMehta I'd assume it's much more to do with the
[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. – dzaima – 2018-08-21T16:17:52.9431This looks awesome. Is it intentional that the total area of the grid increases with the square of the number of players? With a fixed 2000 rounds per game I'd expect that to lead to less meeting of bots the larger the grid gets. – trichoplax – 2018-08-21T21:35:29.010
2@trichoplax I never thought about it in terms of the area... That makes a lot of sense – Beta Decay – 2018-08-21T22:13:02.577
1Is the inital starting position random? If I move to a painted square and it gets unpainted in the process, can I paint it the next turn with a wait move? – raznagul – 2018-08-22T12:41:39.663
1>
@BetaDecay I was originally introduced to scaling the area rather than the side length by Survival Game - Create Your Wolf
– trichoplax – 2018-08-23T07:00:10.7401Sometimes the controller chooses really light colors that are hard to tell apart from the background, or gives 2 bots the same color. – 12Me21 – 2018-08-23T15:39:45.817
Note that it has been found that for this game, at least in dzaima's controller, Firefox seems significantly faster than Chrome. – tomsmeding – 2018-08-25T18:07:14.107
9Are there any news on the progress of the tournament? – Hein Wessels – 2018-08-31T11:13:53.823
2I'm checking this place every day. Why is there no update? – NoOorZ24 – 2018-09-04T06:04:25.370
1@NoOorZ24 probably because it would take something like 48 days to run 10,000 games single threaded on a reasonably good computer (assuming 7 minutes per game). – SamYonnou – 2018-09-04T20:12:00.143
1https://beta-decay.github.io/art_attack link is dead, please update the post. – kenorb – 2018-09-06T20:54:53.733
2@BetaDecay Please post an update here and run the tournament, or let someone else run it if you are unable to. – Renzeee – 2018-09-10T08:36:16.107
3
I'm hosting it now if anyone wants to try it. https://cypressf.com/art-attack/ https://github.com/cypressf/art-attack/
– Cypress Frankenfeld – 2018-09-25T23:25:55.080