Welcome to Code Bots 2!
You've learned your lesson since the last Code Bots. You've tried to figure out more ways to fit more actions in less lines, and now you finally have it. You're going to make an event-driven Code Bot.
Your bot must consist of 24 lines. Each line follows one of the two formats:
Your bot also have enough storage to store 5 integers named
E. An integer can store values from 0 to 23.
Each turn, you will execute line
C, unless one of the conditions is true. If so, then
C will then contain the line number of the conditional that is true, and then that line will be executed. At the end of each turn,
C will be incremented.
There are the available conditions:
Startis true only on the first turn. You must have this in your code exactly once
BotAt(N)is true if there is a bot at the location defined by N
Equals(A,B)is true if A equals B. They can be different types, if so, they will not be equal.
Modified(A)is true if
Awas copied to during the last turn.
Amust be a variable name, a line, or a condition
Any(C1,C2,...)is true if any of the conditions are true
None(C1,C2,...)is true if none of the conditions are true
All(C1,C2,...)is true if all of the conditions are true
Not(C)is true if C is false.
Cmust be a condition.
Variables can be in one of the following formats. The first 9 are numerical, and can be be used for whenever N is used in this page.
- A number from 0 to 23
Thiswill return the line number it is currently on
Add(N1,N2,...)will return the sum of all values
Sub(N1,N2)will return N1 minus N2
Mult(N1,N2,...)will return the product of all values
Div(N1,N2)will return N1 divided by N2
Mod(N1,N2)will return N1 mod N2
OVar(N)will accept a variable name, and will return the opponent's variable
Line(N)will return the Nth line in your code
Type(N)will return the Nth line type in your code (the types are the names of the actions)
Cond(N)will return condition on the Nth line
CondType(N)will return the condition type on the Nth line (the types are the names of the conditions)
OLine(N)will return the Nth line in your opponent's code
OType(N)will return the Nth line type in your opponent's code
OCond(N)will return the condition on the Nth line
OCondType(N)will return the condition type on the Nth line
B are for your personal use,
C is used to determine which line to execute in your code, and
D is used as a direction. Each value of
D refer to a different square and direction pair.
E produces a random value each time.
E will be initialized to a random value, otherwise
The direction used will be
[North,East,South,West][D%4]. Your opponent is the bot in the immediate square in that direction.
There are 4 actions available to you:
Movewill move you 1 square forward in the
Dth direction. If there is a bot there, you will not move.
Copy(A,B)will copy the variable
Bcannot be a numerical value, except for a variable name.
Bcannot be of different types. Copying a line does not copy the condition.
Flagdoes nothing. The bot with the most flags in your code will get a point. The bot with the most points wins.
If(C,L1,L2)will perform the line on
Cis true, else performs
Cis a condition, and
L2must be lines.
The Big Picture
50 copies of every bot will be placed in the world. Your goal is to get your flag into as many bots as possible. For each bot that has more of your flag type than any other flag type, you get a point.
The bots will be placed as follows:
B...B...B...B... ..B...B...B...B. B...B...B...B...
There will be 10 games run, and points will be averaged across all of the games, determining who the winner is.
If multiple conditions apply, then the one that most immedately follows
Start will be executed
The bots will be closely packed but you will not start neighboring another bot. (It techincally will be the same format as the last CodeBots)
As this challenge was not posted in the sandbox (to give nobody an advantage), I reserve the right to change small details for fairness, or additional capabilities. Also, if there is a bug in the CodeBots runner, I will change it, even if a bot depended on that bug for its success. I am trying to be as fair as possible.
If statements will not be executed
If your bot is shorter than 24 lines, the remaining lines will be filled with
Remember when copying to your own
C is incremented at the end of your turn.
The CodeBots interpreter can be found here. It includes a .jar file for easy execution. Simply add your bot to the bots folder
- 893.9 Borg
- 1.3 LazyLioness
- 0.9 Defender
- 0.5 Flagger
- 0.4 CliqueBot
- 0.4 Insidious
- 0.3 Attacker
- 0.3 Gard
- 0.3 SingleTarget
- 0.2 FreezeBot
- 0.2 Sentinel
- 0.2 Driveby
- 0.0 AntiInsidious
- 0.0 MoveBot
- 0.0 CliqueBorg
- 0.0 Calculator
- 0.0 TestBot
- 0.0 Imitator
Lines of code are now rotated when you view your opponent's code. That means, your opponent's line 1 may be line 14 (or whatever line). A bot will have a fixed offset which will offset his lines by
X amount when viewed by an opponent. The opponent's
C variable will also be offset by the same
X will not change within the same game, but it will change from game to game.