sheesh, is this really the 4th? For all you oldcomers, the core challenge is the same, but we are using Java instead of a custom language. Here are the past three CodeBot challenges, in case you are interested.
The goal of CodeBots is to make your bot as viral as possible. Each bot carries a Flag, and you need to make sure that your Flag is everywhere.
API
Bots will follow a standardized "protocol", and bots progress through the following steps synchronously:
IPAddress selectMessageRecipient()
allows a bot to choose who he wants to send a "friendly" message to.Message sendMessage()
allows a bot to choose the contents of the message he will send out.processMessage(IPAddress, Message)
is called for each message a bot receives.FunctionType selectFunctionToBlock()
blocks a function from being overwritten for the current turn. See step 7.IPAddress selectAttackTarget()
allows a bot to choose who he wants to DDOS. A DDOS attack is successful if the bot is targeted by 3 bots at the same time. If an attack is successful, then each of the attackers can perform step 6 and 7.readData(ReadonlyBot)
allows a bot to read data stored on the vulnerable bot.FunctionType selectFunctionToReplace()
is the crux of this challenge. You are allowed to select 1 function (of the 8 listed here) to copy over from your bot to their bot. Then, your function will be called instead of theirs. If multiple bots select the same function, a random one will be successful.String getFlag()
is called at the end of the game, and should return a string unique to your submission. Your function should always return the same string. The submission with the most flags at the end of the game wins.
Storage
You have 3 forms of storage, an AddressBook, a Log, and a Variables. These forms of storage are local to the bot your function is running on (so if your function gets copied, the contents of each of these objects will be different). All of these objects can be manually modified or cleared. To obtain these objects, you have a getter in your class (e.g. getLog()
).
The AddressBook stores a list of IPAddress, each with a AddressType, which allows you to classify the different types of addresses. AddressBook will always contain at least 1 address (if it is cleared, a random one will be added). Clearing your AddressBook to obtain multiple IPAddresses is not allowed.
The Log stores a list of all actions taken, as well as data about the action. It also includes a history of all successful attacks (though you don't know which functions they overwrote)
The Variables object allows you to store string variables attached to a string name. On game start, Variables will contain a single variable, ID
, which contains a randomly generated ID that is unique to your bot type.
You also have other access functions:
int getTurnNumber()
returns an integer with the current turnbool functionsMatch(ReadonlyBot, FunctionType)
tests to see if the ReadonlyBot's function matches yoursIPAddress personalAddress()
returns your IPAddress
How to implement
- You can obtain the code from Github
- Add your bot to the
\bots
folder, and then add a reference to your bot incontroller\CodeBotFactory.java
- Your bot must extend
codebots.bot.CodeBot
orcodebots.bots.DefaultCodeBot
- You need Java 8 if you want to run the controller.
- You can run the code (assuming you are in the
/src
folder) usingjavac codebots\*.java
to compile, thenjava codebots.Main
to run. - You may not have any non-constant member variables in your class
- Reflection is not allowed.
- Forms of communication between bots (of the same or different types) outside of the methods listed above is not allowed.
- Dumb and/or Suicidal bots are allowed, but all bots should be functionally different than existing entries.
- If you want randomness in your bot, use
getRandom()
- Please try to keep your code efficient. I've spent a good deal of time profiling and making the controller fast.
Scores
105.2501 Expelliarmus!
104.5803 I'm Helping!
104.2746 Who Am I?
103.8529 Dumb Bot
103.2028 Replacer
102.7045 Chaos
102.4046 Hermit Bot
102.2849 Swarmer
100.5598 Random bot loves you
99.966 Trust in Trust!
99.0185 codebots.bots.DefaultCodeBot
91.2942 codebots.bots.MarkedBot
91.1423 Just your friendly neighborhood mail delivering robot.
89.4645 null