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:
Condition:Action
or
Action
Your bot also have enough storage to store 5 integers named A
through 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:
Start
is true only on the first turn. You must have this in your code exactly onceBotAt(N)
is true if there is a bot at the location defined by NEquals(A,B)
is true if A equals B. They can be different types, if so, they will not be equal.Modified(A)
is true ifA
was copied to during the last turn.A
must be a variable name, a line, or a conditionAny(C1,C2,...)
is true if any of the conditions are trueNone(C1,C2,...)
is true if none of the conditions are trueAll(C1,C2,...)
is true if all of the conditions are trueNot(C)
is true if C is false.C
must 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
,B
,C
,D
,E
- A number from 0 to 23
This
will return the line number it is currently onAdd(N1,N2,...)
will return the sum of all valuesSub(N1,N2)
will return N1 minus N2Mult(N1,N2,...)
will return the product of all valuesDiv(N1,N2)
will return N1 divided by N2Mod(N1,N2)
will return N1 mod N2OVar(N)
will accept a variable name, and will return the opponent's variableLine(N)
will return the Nth line in your codeType(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 lineCondType(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 codeOType(N)
will return the Nth line type in your opponent's codeOCond(N)
will return the condition on the Nth lineOCondType(N)
will return the condition type on the Nth line
A
and 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. D
and E
will be initialized to a random value, otherwise 0
.
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:
Move
will move you 1 square forward in theD
th direction. If there is a bot there, you will not move.Copy(A,B)
will copy the variableA
toB
.B
cannot be a numerical value, except for a variable name.A
andB
cannot be of different types. Copying a line does not copy the condition.Flag
does 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 onL1
ifC
is true, else performsL2
.C
is a condition, andL1
andL2
must 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.
Side Notes
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.
Recursive If
statements will not be executed
If your bot is shorter than 24 lines, the remaining lines will be filled with Flag
Remember when copying to your own C
, that 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
Scores
- 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
UPDATE
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
amount. X
will not change within the same game, but it will change from game to game.