# BrainF***edBotsForBattling - A Brainf*** Tournament

All bots at the battle arena suddenly got brainfucked and no one can explain why. But who cares as long as they are still able to fight - although Brainfuck is the only language they understand anymore.

It's been a while since the last submission so I'll finally annouce the winner of BrainFuckedBotsForBattling: Congratulations to LymiaAluysia for winning with NyurokiMagicalFantasy!

## Scoreboard

|       Owner        |          Bot            Score |
|--------------------|-------------------------------|
| LymiaAluysia       | NyurokiMagicalFantasy -  600  |
| Sylwester          | LethalLokeV2.1        -  585  |
| weston             | MickeyV4              -  584  |
| Sp3000             | YandereBot            -  538  |
| Comintern          | CounterPunch          -  512  |
| Sylwester          | BurlyBalderV3         -  507  |
| LymiaAluysia       | NestDarwin            -  493  |
| IstvanChung        | Bigger                -  493  |
| Manu               | DecoyMaster           -  489  |
| archaephyrryx      | Wut                   -  478  |
| DLosc              | LightfootPlodder      -  475  |
| archaephyrryx      | 99BottlesOfBats       -  461  |
| Sylwester          | TerribleThorV2        -  458  |
| MikaLammi          | WallE2.0              -  443  |
| Mikescher          | MultiVAC              -  441  |
| archaephyrryx      | Twitcher              -  439  |
| Timtech            | MetalDetector         -  438  |
| AndoDaan           | BeatYouMate           -  433  |
| csarchon           | TheWallmaster         -  427  |
| Sparr              | SeeSawRush            -  412  |
| archaephyrryx      | Stitcher              -  406  |
| PhiNotPi           | RandomOscillator      -  403  |
| ccarton            | AnybodyThere          -  398  |
| Comintern          | 2BotsOneCup           -  392  |
| kaine              | SternBot              -  387  |
| PhiNotPi           | EvoBot2               -  385  |
| PhiNotPi           | EvoBot1               -  381  |
| Brilliand          | TimedAttack           -  373  |
| Sylwester          | ReluctantRanV2        -  373  |
| AndoDaan           | PrimesAndWonders      -  359  |
| Nax                | TruthBot              -  357  |
| DLosc              | Plodder               -  356  |
| weston             | FastTrapClearBot      -  345  |
| MikaLammi          | PolarBearMkII         -  340  |
| Sp3000             | ParanoidBot           -  336  |
| Moop               | Alternator            -  319  |
| TestBot            | FastClearBot          -  302  |
| icedvariables      | PyBot                 -  293  |
| TestBot            | DecoyBot              -  293  |
| kaine              | BestOffense           -  291  |
| Geobits            | Backtracker           -  289  |
| bornSwift          | ScribeBot             -  280  |
| IngoBuerk          | Geronimo              -  268  |
| flawr              | CropCircleBot         -  239  |
| plannapus          | CleanUpOnAisleSix     -  233  |
| frederick          | ConBot                -  230  |
| frederick          | 128Bot                -  222  |
| AndoDaan           | EndTitled             -  219  |
| PhiNotPi           | CloakingDeviceBot     -  215  |
| AndoDaan           | GetOffMate            -  206  |
| DLosc              | ScaredyBot            -  205  |
| isaacg             | CleverAndDetermined   -  202  |
| PhiNotPi           | CantTouchThis         -  202  |
| Moop               | StubbornBot           -  174  |
| Cruncher           | StallBot              -  168  |
| IngoBuerk          | Gambler               -  157  |
| BetaDecay          | RussianRoulette       -  129  |
| flawr              | DoNothingBot          -  123  |
| SebastianLamerichs | Dumbot                -  115  |
| mmphilips          | PacifistBot           -  112  |
| SeanD              | DontUnderstand        -  92   |
| proudHaskeller     | PatientBot            -  83   |
| frederick          | Dumberbot             -  70   |
| flawr              | MetaJSRandomBot       -  68   |
| Darkgamma          | TheRetard             -  61   |
| BetaDecay          | Roomba                -  61   |
| BetaDecay          | PrussianRoulette      -  31   |
| frederick          | Dumbestbot            -  0    |


Final Scores from 09.10.2014

EDIT6: Discarded logs due to extreme size and runtime. You can generate them yourself by uncommenting the lines in RunThisTournament.py.

EDIT5: Implemented Abbreviation handling into the controller, no huge runtimes anymore. This has the side effect that numbers and parentheses are not treated as comments anymore. You can still use them if you want to provide an annotated version, but it would be very helpful if there would be also an uncommented version of your code, so I don't need to remove the comments manually. Thanks!

EDIT4: Changed the title, because the tournament got removed from the hot network questions. Thanks to @Geobits for pointing this out!

EDIT3: Removed comments in bf programs, due to an unexpected result, should be fixed now. If anyone has a problem with removing his comments, please report.

EDIT2: Since it caused an arcane runtime on my quite slow computer, I reduced the timeout limit from 100000 cycles to 10000 cycles. Not that anyone has turned the resultof a running game beyond this point anyway.

EDIT1: Fixed a bug in the convert script causing the interpreter to not ignore numbers in commented programs.

## Description

This is a Brainfuck tournament inspired by BF Joust. Two bots (Brainfuck programs) are fighting each other in an arena which is represented by a memory tape. Each cell can hold values from -127 up to 128 and wrap at their limits (so 128 + 1 = -127).

Valid instructions are similiar to regular Brainfuck, which means:

+ : Increment cell at your pointer's location by 1
- : Decrement cell at your pointer's location by 1
> : Move your memory pointer by 1 cell towards the enemy flag
< : Move your memory pointer by 1 cell away from the enemy flag
[ : Jump behind the matching ']'-bracket if the cell at your pointer's location equals 0
] : Jump behind the matching '['-bracket if the cell at your pointer's location is not 0
. : Do nothing


The arena has a size of 10 to 30 cells which is pseudorandomly chosen each battle. At both ends is a 'flag' located which has an initial value of 128, while all other cells are zeroed. Your bot's goal is to zero the enemy's flag for 2 consecutive cycles before he zeroes your own flag.

Each bot starts at his own flag, which is cell [0] from his own perspective. The opponent is located on the other side of the tape.

[ 128 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 128 ]
^                                             ^
my bot                                       other bot


Both bots execute their action simultaneously, this is considered one cycle. The game ends after 10000 cycles or as soon as one of the winning conditions is reached. If one of the programs reaches its end, it simply stops doing anthing until the end of the game, but can still win.

## Winning conditions

Your bot wins under one of the following conditions:

• Your enemy's flag is zeroed before yours
• Your enemy moves his pointer out of the tape (executes > on your flag or < on his own)
• Your flag's value is more far away from 0 than the value of your opponent's flag after 10000 cycles

## Rules

Your post should contain a name for your bot and its code.

• You can use the following abbreviation syntax to make your code more readable:
• e.g. (+)*4 is the same as ++++, this is valid for any instruction except unmatched brackets in parentheses since the loop logic collides with the abbreviation logic. Please use [-[-[- instead of ([-)*3
• Every other character than +-><[]. is a comment and therefore ignored, except ()* for abbreviations

Bots which do not follow the rules will excluded from the tournament.

• Only basic Brainfuck is allowed, no other variants which supports procedures or arithmetic operations
• Your bot's source code should not contain unmatched brackets

You may inform yourself about basic strategies but do not use another one's code for your own bot.

## Scoring

A bot's score is determined by the number of wins against all other bots. An encounter between 2 bots consists of 10 matches with different memory tape lengths, which results in a maximum score of 10 points per encounter. A draw results in no points for this match.

## Control program

You can find the control program on github, along with the full logs from the battles. The leaderboard will be posted here once it is generated.

Feel free to clone the repository and try your bot against the others on your own. Use python Arena.py yourbot.bf otherbot.bf to run a match. You can modify the conditions with the command-line flags -m and -t. If your terminal does not support ANSI escape sequences, use the --no-color flag to disable colored output.

## Example bots

FastClearBot.bf

(>)*9       Since the tape length is at least 10, the first 9 cells can be easily ignored
([          Find a non-zero cell
+++         Increment at first, since it could be a decoy
[-]         Set the cell to zero
]>          Move on to the next cell
)*21        Repeat this 21 times


DecoyBot.bf

>(+)*10     Set up a large defense in front of your flag
>(-)*10     Set up another one with different polarity
(>+>-)*3    Create some small decoys
(>[-]       Move on and set the next cell to zero
.           Wait one round, in case it is the enemy's flag
)*21        Repeat this 21 times


The DecoyBot will win every match with a tape length greater than ten, since the FastClearBot can avoid the small decoys, but not the larger ones. The only situation in which the FastClearBot can win against DecoyBot, is when it is fast enough to reach the enemy's flag before his opponent has built up large decoys.

• Original, I like it. I'm just afraid that this won't allow for enough strategical depth, but that might be just me. – ɐɔıʇǝɥʇuʎs Aug 22 '14 at 17:54
• This would be even more fun with Befunge. – IchBinKeinBaum Aug 22 '14 at 18:09
• I found a BF Jousting webpage which can run and visualize jousting matches. – PhiNotPi Aug 23 '14 at 11:33
• Thanks for hosting this KOTH, Cipher. Must be a lot of work with so many submissions. – AndoDaan Aug 25 '14 at 17:05
• I'd rather say thanks to everyone for still participating ^^ – Cipher Sep 22 '14 at 14:10

# SeeSawRush

sets some early decoys, then does a decrement clear with protection against decoys down to -4 at every cell past 9

>>>>------          decoy neg6 at cell 4
<+++++              decoy pos5 at cell 3
<----               decoy neg4 at cell 2
<+++                decoy pos3 at cell 1
>>>>                get to cell 5
(----->+++++>)*2    neg5 pos5 neg5 pos5 decoys at cells 5,6,7,8
(                   start attacking at cell 9
[                   if current cell is nonzero
(+)*4               handle decoys down to neg4
[-]                 decrement to zero
]
)*21                21 times


# Plodder - EDITED

Instead of zeroing cells via loop, the plodder adds a large constant to each one. This is slow in general, but if the opponent has set up lots of traps, it doesn't make a bit of difference. Results are actually fairly good, especially for mid-range tape lengths.

(>----)*2                Set up traps for fast bots immediately
>(+)*7                   More traps
>(-)*17
>(+)*7
>(-)*7
>-
>(-.(+)*126(+.)*4>)*21   Starting with cell nine, stomp on each cell and plod on


# Terrible Thor v2

Terrible Thor is a mixed medium slow and fast Rush that uses a small amount of time putting some small decoys (24 steps) before he goes to clear common and enemy territory. He detects enemies and go into fast rush mode and uses BalderV1's original clearing method. It also just plodd the first non-zero cell to prevent traps when enemy isn't detected in case there is a trap. This was originally the first draft of Loke so you'll se a mix between Balder and Loke in this code.

>(+)*22
(>)*6 [([>[+[+[+[+[+[+[+[(-)*7-[-[-[-[-[-[-[(-)*116[-]]]]]]]]]]]]]]]]+]-)*2] (+)*22
<<-<<-<
[ (>)*6 ([>[+[+[+[+[+[+[+[(-)*7-[-[-[-[-[-[-[(-)*116[-]]]]]]]]]]]]]]]]+]-)*2 ] (-)*22 >
+[ (>)*5 ([>[+[+[+[+[+[+[+[(-)*7-[-[-[-[-[-[-[(-)*116[-]]]]]]]]]]]]]]]]+]-)*2 ] (+)*22 >
[ (>)*4 ([>[+[+[+[+[+[+[+[(-)*7-[-[-[-[-[-[-[(-)*116[-]]]]]]]]]]]]]]]]+]-)*2 ] (-)*22 >
+[ (>)*3 ([>[+[+[+[+[+[+[+[(-)*7-[-[-[-[-[-[-[(-)*116[-]]]]]]]]]]]]]]]]+]-)*2 ] (+)*22 >
[ (>)*2 ([>[+[+[+[+[+[+[+[(-)*7-[-[-[-[-[-[-[(-)*116[-]]]]]]]]]]]]]]]]+]-)*2 ] (-)*22 >>
([>
[
..(+)*119(+.)*17
([>[+[+[+[+[+[+[+[(-)*7-[-[-[-[-[-[-[(-)*116[-]]]]]]]]]]]]]]]]+]-)*2
](-)*6<<((-)*8>)*2
]-)*2


Trivia: Thor is the lightning god of Nordic Mythology.

# 128Bot

Not sure how good or bad this one is, but here:

>>(+)*128
<(+)*128
(>)*8
([-]>)*21


All I know is that this will be pointless upon sizes less than 12.

Also, as a response to Dumbot, here is "Dumberbot":

[-]


Then "Dumbestbot":

<


This is just about as dumb as it can get!

EDIT: I just came up with a really awesome one that I call "ConBot!"

# ConBot

>+[.]<(-)*10000


This one wins by tricking some opponents into moving off the tape, thus the con.

• I think your Dumb*bot variants are excluded by the loopholes convention, although the specs don't say so. And yes, those two were the first thing I thought of when reading the specs, too... – TheSpanishInquisition Aug 23 '14 at 23:58
• ConBot is pretty much the same as my Reluctant Rán and another using the same idea is CloackingDeviceBot but unlike our bots that reduces as strategy it fluctuates between -1, 0, and 1 all the time. – Sylwester Aug 29 '14 at 1:53
• @Sylwester This was actually not based off of the above listed bots. Also, this is very different in the fact that it waits at the cell directly next to its flag until someone activates the decoy. After that it goes back and starts decrementing its own flag. This will not work on size 10 or against a huge majority of the bots on size 30. Also, I like your creative names for your bots! – fvla Aug 29 '14 at 10:17
• Just to make sure. I wasn't indicating it was plagiarism, just that the same idea was used. Many bots have counter measures already so all three does better against the earlier versions that the current. Thanks :) I try to choose a Nordic God(dess) that is related to the strategy of the bots – Sylwester Aug 29 '14 at 12:06
• Shouldn't ConBot be >+[.]<(-)*10000? – Comintern Aug 29 '14 at 12:37

# Stubborn Bot

Move one spot over from the flag, and try to stubbornly prevent the other bot from zeroing the cell:

>([+]-)*1000


Annotated

 >            Move one spot
(
[+]        if non-zero increment
-          decrement if zero
)*1000       repeat until the game is over

• It's 100,000 cycles. Also I don't think this works at all, though I did play with similar ideas. – Ingo Bürk Aug 22 '14 at 21:09
• It takes a long time to compile if i did *100000. – Moop Aug 22 '14 at 21:10
• would it work better to [.] one spot in from of two defenses and then >[+]>[-]? This ensures that you know exactly where he is and counter whatever he does. – kaine Aug 22 '14 at 21:40

# "Random" Oscillator

This bot lays down a series of traps, and it tries to check to see if the enemy has lain similar traps.

 >->+>->+>+>->->+(>[+[-]])*21


I have attempted to make the traps have somewhat random polarities (-+-++--+) so that the opponent won't pick up on the pattern.

# Russian Roulette

I have no idea if this bot will work or not... Just have to wait and see!

(>->[(+)*10])*5(-)*10

(>         Move forward 1
-          Decrement by 1
>          Move forward 1
[(+)*10]   If cell is zero then go forward else increment by 10
)*5        Do the whole thing 5 times
(-)*10     Decrement by 10

• This bot seems to just run off the end of the tape every time. The problem is with [>(+)*10]. It will always repeat this loop over and over again since the cell will be non-zero after incrementing it. – PhiNotPi Aug 23 '14 at 11:31

## Clean up on aisle 6

(>)*5(-)*4>+[](>[+[-]])*27

(>)*5      Go to cell 5
(-)*4      Decrement by 4
>+         Go to cell 6 and increment by 1
[]         Wait for opponent to clear up cell 6
(>[+[-]])*27  Then go ahead and zero what's forward


Lose against rushers if the tape is too short and bots leaving negative decoys.

# GetOffMate

This is made with 2 central ideas. 1st: the average arena size will be 20, and 2nd: I haven't seen any decoys larger than 5 (if I'm interpreting things correctly) in others their submissions.

(>)*19([(+)*6[-]]>)*11


Annotated:

(>)*19            Like I said, the average arena size is 20 Still kinda stupid though
([(+)*6[-]]>)*21  If a decoy is 123 or bigger, it will increment it to 0 or beyond, and clear it. Known as an Offset clear.

• So, 50% of the time it just throws itself off board. Huh. – proud haskeller Aug 24 '14 at 23:14
• And actually, if there are no decoys larger than 5, you will only need 5 plusses – proud haskeller Aug 24 '14 at 23:17
• @proudhaskeller to your first comment, absolutely :( stupid bot (BeatYouMate is remedies this). To your 2nd comment, you're right. I've noticed now that people are adding decoys up to 12, so it's a moot point. I guess I could change it in BeatYouMate, but, oh well, roll the dice. – AndoDaan Aug 24 '14 at 23:23

I'm gonna do the most stupid thing imaginable:

The Retard

[+]


Since the rules clearly state: "Your bot's goal is to zero the enemy's flag for 2 consecutive cycles before he zeroes your own flag", this bot takes the liberty of zeroing his flag as soon as the game starts so that the enemy can't get to it first. Since the rules also state the victory condition: "Your enemy's flag is zeroed before yours", this means that the Retard cannot possibly win, but it can also sometimes not lose. Specifically, for it to not lose the enemy must take either an odd number of steps to get to it and start decrementing or for the enemy not to come to it at all; if the enemy takes an even amount of steps to get to it, he will zero the Retard's flag before the retard itself. Clear abuse of the rules but what can I say :)

• You missed one of the winning conditions: enemy moves the pointer out of tape. So this bot actually can win, and it certainly does win my WALL-E in size 10 arena. – Mika Lammi Aug 25 '14 at 10:06
• yeah... but since the rules also say 'do not use another one's code for your own bot' and your bot is a clone of frederick's Dumberbot, it's disqualified... sorry. – Cipher Aug 25 '14 at 10:08
• I didn't even consider it could win against anyone o: @Cipher, I didn't even notice, I just read the rules and had the idea. I've edited the bot to increment instead of decrementing, does that count? – Darkgamma Aug 25 '14 at 10:10
• yep, that's better :D – Cipher Aug 25 '14 at 10:24

# PrimesAndWonders

Utilizes a new strategy of offsetting its own flag. And offset its decoys with prime numbers and staggers them a bit more.

>>>>>-<<<<<--->------------(-)*5>++++++++++++++++(+)*7>>(+)*13+++++++++++++++++>------------------->+++++++++++++>----------------->++++++++++++++++++++++++++++++>([(+.)*16[-]]>[(-.)*16[-]]>[(+.+.+.+.)*4[-]]>)*7


# Fast Trap Clear Bot

(->)*9(+[-]>)*20


Lays down a set of it's own traps then proceeds to clear opponents traps. This works by adding one to remove -1 traps, if that hasn't worked it zeros out with [-].

It is extremely effective against Alternator, winning 16 lengths out of 21. Not tried against many others yet.

It's also fast so bots that lay larger decoys like DecoyBot don't have the time to place much of a wall.

I now realise is similar to FastClearBot example:

[          Find a non-zero cell
+++         Increment at first, since it could be a decoy
[-]         Set the cell to zero
]


But it does away with the outer loop, which means that for a cell that is already 0 it runs four instructions: +[-] compared to the FastClear's single [. When a cell isn't zero however it benefits by not having that extra comparison.

# TimedAttack

Hangs out at its own flag and spins its wheels for a while, then sets out for the opposing flag.

(-)*1024
(>+)*9
([-][-[++-]][+-]->)*21


This bot will leave its flag at its original value if the opponent doesn't mess with it. After that much time has passed, it can safely assume that the opponent isn't going for its flag, so it will take its time triple-checking that every possible enemy flag location is zeroed (and leaving decoys everywhere for the hell of it).

# 2BotsOneCup - Edited (3rd Bot?)

Named in honor of the comment @Won't made on the post about removing this from the hot questions list.

Unannotated:

>(+)*3>(-)*3>+([)*300(>(-)*12>(+)*12)*2>(([-([(-)*6[+.]])*5])*4->)*21
(]<(-)*30<(+)*30(>)*9((-)*16(<)*8(+)*32(>)*8)*8>((-)*16(<)*9(+)*34(>)*9)*8>
((-)*16(<)*10(+)*36(>)*10)*8>((-)*16(<)*11(+)*38(>)*11)*8>((-)*16(<)*12(+)*40(>)*12)*8>
((-)*16(<)*13(+)*42(>)*13)*8>((-)*16(<)*14(+)*44(>)*14)*8>((-)*16(<)*15(+)*46(>)*15)*8>
((-)*16(<)*16(+)*48(>)*16)*8>((-)*16(<)*17(+)*50(>)*17)*8>((-)*16(<)*18(+)*52(>)*18)*8>
((-)*16(<)*19(+)*54(>)*19)*8>((-)*16(<)*20(+)*56(>)*20)*8>((-)*16(<)*21(+)*58(>)*21)*8>
((-)*16(<)*22(+)*60(>)*22)*8>((-)*16(<)*23(+)*62(>)*23)*8>((-)*16(<)*24(+)*64(>)*24)*8>
((-)*16(<)*25(+)*66(>)*25)*8>((-)*16(<)*26(+)*68(>)*26)*8)*300


Annotated:

>(+)*3>(-)*3>                       Toss two quick decoys out for the faster bots
+                                   Set a trip wire
([)*300                             Unmatched brackets wait three hundred rounds for the
tripwire to be cleared

This section executes if three hundred rounds pass
(>(-)*12>(+)*12)*2>             Lay four more decoys in case another bot has a tripwire
(
([-([(-)*6[+.]])*5])*4      Rush using the clear code from CounterPunch
->                          Lay breadcrumbs just for the hell of it
)*21
(                                   This section executes if the tripwire is sprung
]   <(-)*30<(+)*30              Hop back and beef up the decoys
(>)*9
((-)*16(<)*8(+)*32(>)*8)*8>     Alternate between repairing the decoy and decrementing
((-)*16(<)*9(+)*34(>)*9)*8>     each cell to the end of the tape by one twenty eight
((-)*16(<)*10(+)*36(>)*10)*8>
((-)*16(<)*11(+)*38(>)*11)*8>
((-)*16(<)*12(+)*40(>)*12)*8>
((-)*16(<)*13(+)*42(>)*13)*8>
((-)*16(<)*14(+)*44(>)*14)*8>
((-)*16(<)*15(+)*46(>)*15)*8>
((-)*16(<)*16(+)*48(>)*16)*8>
((-)*16(<)*17(+)*50(>)*17)*8>
((-)*16(<)*18(+)*52(>)*18)*8>
((-)*16(<)*19(+)*54(>)*19)*8>
((-)*16(<)*20(+)*56(>)*20)*8>
((-)*16(<)*21(+)*58(>)*21)*8>
((-)*16(<)*22(+)*60(>)*22)*8>
((-)*16(<)*23(+)*62(>)*23)*8>
((-)*16(<)*24(+)*64(>)*24)*8>
((-)*16(<)*25(+)*66(>)*25)*8>
((-)*16(<)*26(+)*68(>)*26)*8
)*300


One triplock bot wasn't enough for this contest, so here's my locking entry. It isn't as clever by half, but easily makes up for it in speed.

EDIT: A couple things were clear about this bot from the last round - it lost a ton of points due to ties with other bots that were purely defensive. So... the new and improved version uses a tripwire timer. If the tripwire isn't set off in the first 300 rounds, it will build some token decoys for other tripwire bots and then make a rush attack. If the tripwire is sprung, it will methodically decrement each cell by 128 while at the same time repairing the first decoy it set up.

The main thing this bot gets hurt by is the round limit of 10,000 rounds. Some of the longer tapes can take it well over that to clear (in the 15,000 to 20,000 round range), so it is currently eating a lot of ties that it would ultimately win.

NOTE: The rule on unmatched brackets in parenthesis (such as ([)*300) has become somewhat ambiguous due to the comments here. The unannotated version above will run perfectly fine with the current version of the control program. For the more pedantic, there is a version that follows the letter of the rules available here with all of the brackets expanded out. It weighs in at over 170.5kb, and has 27,609 sets of parenthesis to expand (but all brackets are matched). Warning - on my machine this takes about 5 minutes to parse.

If you would like to try this bot on EgoJSout, there is an equivalent compliant version of the code here. This version uses the [{}] syntax, so it isn't compatible with the control program for the challenge.

• The problem with this ([)*n syntax is, that all of the opening brackets match with the same (])*n closing bracket. – Cipher Aug 28 '14 at 7:12
• So jumping from the fifth opening bracket due to a zeroed cell would not reach the fifth closing brackets (the bracket it actually should match) but the first closing bracket. So your bot will run fine but it will be slower than necessary. – Cipher Aug 28 '14 at 7:17
• The 10000 round limit really does hurt with locks :/ – Sp3000 Aug 28 '14 at 8:33
• @Cipher - Interestingly, that bracket behavior still gives exactly the intended result because the code after all the closing brackets is identical. For the purpose of this bot it doesn't matter which post-closing bracket code gets executed, only that it branches if any one of them are closed when the cell it is sitting on is zeroed. If it makes it through all 300 opening brackets, none of the code beyond the closing brackets is executed anyway - the clear sequence will always halt. – Comintern Aug 28 '14 at 12:31
• @Comintern you're right I just tested your expanded bot vs. the original version and they seem to behave exactly the same – Cipher Aug 28 '14 at 13:43

## BestOffense

is a good Defense

>-->+[+]<[-](>(-)*50)*10(>[+])*100


We will see how it actually does. In Loop 1 it moves right once and decrements by 128. It repeats this 20 times. In loop B if the cell is not 0, it increments until it is. It repeats this until i goes off the board. He isn't very smart but I wanted to get the game going.

update:

I've added a means to extend most battles into the first part for... fun? Mine still isn't intended to be serious and is not offensive at all. The sarcastic titles wrongness is reflected in the player's skill.

# ScaredyBot

Somewhat similar to StubbornBot, this neurotic little bot tries to barricade its flag and just avoid losing.

>+>(-)*8>(+)*7<<(+)*140>[]<[+]<[[+]+]

>+          Move right and start a positive buffer
>(-)*8      Move right and put up a negative buffer, slows bots that use decrement
>(+)*7      Move right and put up a positive buffer, slows bots that use increment
<<(+)*140   Move back to cell 1 and add a lot of numbers
>[]         Move to cell 2 and stay there until it is 0
<[+]        Agh! Someone's getting close! Move to the positive buffer and flood it with
increments
<[[+]+]     That didn't work! Protect the flag!


Does manage to get a draw against many opponents under many conditions. It even wins sometimes (usually when the opponent overshoots the tape).

Stall Bot

Hope your opponent makes a mistake. The first "-" sets the flag to 127. The flag is odd. If the opponent is changing the flag, then the value is either not changing (opposite my move), or it's moving by 2, which is even. The only way I can hit 0, is if they brings the score to -1 or 1, and let me move back to 0.

-[+-]


The problem is that the opponent will win at the end of the game because of a bigger flag.

• The only problem with this is that ] is a step and that kills your strategy. Similar strategy bots are Cloaking Device Bot and my Ràn – Sylwester Aug 25 '14 at 17:04
• Most people clear with [-] which is two commands per decrement, - and ]. – ccarton Aug 25 '14 at 17:06

# DecoyMaster

A bot that loves decoys. Sets 4 larger decoys backwards, then starts clearing the tape while leaving a trail of decoys. It can solve smaller decoys easily.

(>)*4(+)*10<(-)*10<(+)*30<(-)*30(>)*3(>+)*2(>-)*2(>[-[++[(+)*10[-]]]]+)*21


Explained:

(>)*4
(+)*10          Set some decoys backwards
<
(-)*10
<
(+)*30
<
(-)*30
(>)*3
(>+)*2          Small decoys while moving
(>-)*2
(>
[
-           Detect small decoys
[
++
[
(+)*10  Clear
[-]
]
]
]
+             Set decoy and move
)*21


# EndTitled - (last score 187, f***ing murder)

Sacrifices fine motor skills for aesthetics.

[[>>>>>>>+++++++<<<<<<<>------     --------        ---->>>+++++++++++++++    +++++++
++++++++++++++++++++++++>-----     --------     --------->>>+++++++++++++    +++++++
++++++++++++++++++++++>-------     --------   ------->>>+++++++++++++++++    +++++++
+++++++++++++++++>------------     ----->>>  +++++++++++++++++++++>[+++++   >-------
--+++++       >----- -++>---     ----+++  ++>----       -----[-]]>[++++[-]>-------
----+++              ++>----     ------- +++++[-]>-                ------- -++++++
---------[-]]>[++    +[-]>--     ------- -++[-]>                -----------+++
+-----------+++++   [-]>----     ---[-]] [+++++                ------------+
+++-------------+    [-]>--      ------- +++++[-]>-                --------[-]]>
[++[-]>----------    -++[-]>     ------- ----+++                ++[-]>---------++
[-]>---              ------[     -]]>[++ +++[-]>---                ------ -+++++[-]>
-------              ---+++++   +[-]>--  ---++++       +[-]>---------[-]]   [-]>[++>-
----------+            ++++[-]>-----------+++   ++[-]>---------+++++[-]>--[   -]]>[+++
[+]>-------             ---++++++--------     ---+++++[-]>---------++[-]>---    ------[
-]]>[++++++               -----------++         +++[-]>-------+++++[-]>----    -----++
+++[-]>---                 --[-]]>[+              ++++[-]>-++[-]>    -------   ----[-]]>

----+++++[-]>-               --------+++++        [-]>---------[-]]>+++++++++[   [-]>[-]>[-]]]


Goodluck to all.

# Roomba

Isn't very intelligent but tries its best at edge detection.

((>)*2((<)*2(+)*10)[>(-)*10])*100

• You're currently moving to the next cell, then decrementing by 10, repeat...so almost always this bot will just fall off the board. – Sp3000 Aug 26 '14 at 16:04
• I'm not sure but... do you know your first move is effectively suicide? – Cipher Aug 27 '14 at 14:06
• This bot doesn't work since you don't have multiplier of number after ((<)*2(+)*10) but [.... – Sylwester Aug 28 '14 at 18:49

# PyBot

This bot is actually written in Python using my PyBrainFuck module. Apart from that, it's not much different or better than most bots already posted here.

#!/usr/bin/env python

import pybrainfuck, random

bf = pybrainfuck.BrainFuck("pybot.bf")

# DEFEND

# To prevent against the likes of 'GetOffMate'
bf.sub(6)

alternate = False
for i in range(9):
bf.right()
if(alternate):
if(random.randint(0, 5)):
bf.sub() # set to 128
else:

alternate = not alternate

# ATTACK
for i in range(21):
bf.right()
bf.zeroCell()
# throw in a quick decoy here and there...
if(random.randint(0, 3)):

bf.end()


When run, it produces a output similar to:

------>>->>->>->>->>[-]++>[-]>[-]++>[-]>[-]+>[-]+>[-]+++>[-]+>[-]>[-]>[-]>[-]+++>[-]++>[-]+>[-]++>[-]>[-]+>[-]>[-]>[-]+>[-]++


Feel free to use the example above if you don't want to integrate the python script somehow into the arena system.

# ParanoidBot

ParanoidBot is paranoid. It wants to do a full tape clear, but thinks you could be attacking its base at any time. Hence every so often, it runs back home and checks the house - if it finds you, then it has a chance of successfully tying you to a chair while it continues clearing.

(Half serious submission - am curious as to how this will go. Typically loses to bots that hide in their base.)

>-
(
(>)*8
(+.)*108
(<)*8
+[
<+
((+)*128 (>)*9 (+.)*55 (<)*9)*5
((+)*128 (>)*10 (+.)*54 (<)*10)*5
((+)*128 (>)*11 (+.)*53 (<)*11)*5
((+)*128 (>)*12 (+.)*52 (<)*12)*5
((+)*128 (>)*13 (+.)*51 (<)*13)*6
((+)*128 (>)*14 (+.)*50 (<)*14)*6
((+)*128 (>)*15 (+.)*49 (<)*15)*6
((+)*128 (>)*16 (+.)*48 (<)*16)*6
((+)*128 (>)*17 (+.)*47 (<)*17)*6
((+)*128 (>)*18 (+.)*46 (<)*18)*6
((+)*128 (>)*19 (+.)*45 (<)*19)*6
((+)*128 (>)*20 (+.)*44 (<)*20)*6
((+)*128 (>)*21 (+.)*43 (<)*21)*6
((+)*128 (>)*22 (+.)*42 (<)*22)*7
((+)*128 (>)*23 (+.)*41 (<)*23)*7
((+)*128 (>)*24 (+.)*40 (<)*24)*7
((+)*128 (>)*25 (+.)*39 (<)*25)*7
((+)*128 (>)*26 (+.)*38 (<)*26)*7
((+)*128 (>)*27 (+.)*37 (<)*27)*7
((+)*128 (>)*28 (+.)*36 (<)*28)*8
((+)*128 (>)*29 (+.)*35 (<)*29)*8
]-
)*3
(
(>)*9
(+.)*106
(<)*9
+[
<+
((+)*128 (>)*9 (+.)*55 (<)*9)*5
((+)*128 (>)*10 (+.)*54 (<)*10)*5
((+)*128 (>)*11 (+.)*53 (<)*11)*5
((+)*128 (>)*12 (+.)*52 (<)*12)*5
((+)*128 (>)*13 (+.)*51 (<)*13)*6
((+)*128 (>)*14 (+.)*50 (<)*14)*6
((+)*128 (>)*15 (+.)*49 (<)*15)*6
((+)*128 (>)*16 (+.)*48 (<)*16)*6
((+)*128 (>)*17 (+.)*47 (<)*17)*6
((+)*128 (>)*18 (+.)*46 (<)*18)*6
((+)*128 (>)*19 (+.)*45 (<)*19)*6
((+)*128 (>)*20 (+.)*44 (<)*20)*6
((+)*128 (>)*21 (+.)*43 (<)*21)*6
((+)*128 (>)*22 (+.)*42 (<)*22)*7
((+)*128 (>)*23 (+.)*41 (<)*23)*7
((+)*128 (>)*24 (+.)*40 (<)*24)*7
((+)*128 (>)*25 (+.)*39 (<)*25)*7
((+)*128 (>)*26 (+.)*38 (<)*26)*7
((+)*128 (>)*27 (+.)*37 (<)*27)*7
((+)*128 (>)*28 (+.)*36 (<)*28)*8
((+)*128 (>)*29 (+.)*35 (<)*29)*8
]-
)*3

... etc


(full code here)

# ScribeBot

The scribe bot makes the tough choice: to take down the small decoys efficiently or the large ones? He assumes that a majority of the decoys he encounters are similar to the first. He tries to take down the first decoy using the swing method and if he fails, he leaves a note for himself. He then checks his note to see if he should continue to use this method.

---      Small offset
>
(-)*128  Large neg decoy
>
(-)*19   Small neg decoy
>
(+)*128  Large pos decoy
>
(+)*19   Small pos decoy
(>)*5    Move to 10th pos
([      Keep moving until we hit something

<[-]>    Incase we're at the 10th pos and 9th is not empty

Take down using swing method
(-[)*20  Remove 20 and jump if 0
(+)*20   Revert
(+[)*20  Add 20 and jump if 0
<+>      Take a note
[+]      Kill it
(])*20   End Conditional
(])*20   End Conditional

<[  if note exists, use brute force method
>>
(   While we haven't reached the end
[-]  Brute force kill
>    Next
[+]  Brute force kill
>    Next
)*10
]

>>  else continue using swing method
(   While we haven't reached the end
(-[)*20  Remove 20 and jump if 0
(+)*20   Revert
(+[)*20  Add 20 and jump if 0
[+]      Kill it
(])*20   End Conditional
(])*20   End Conditional
>       Next
)*20
]>)*20  Empty space, move next


## Non-annotated Version:

---> (-)*128>(-)*19> (+)*128>(+)*19(>)*5([<[-]>(-[)*20(+)*20(+[)*20<+>[+](])*20(])*20<[>>([-]>[+]>)*10]>>((-[)*20(+)*20(+[)*20[+](])*20(])*20>)*20]>)*20

• It would help if you posted your bot's code without comments as well. – AndoDaan Aug 28 '14 at 7:11
• Cipher's code has trouble with unmatched [ in parethenses - do you have a version with all the ([)*20, (])*20, etc. expanded? – Sp3000 Aug 30 '14 at 6:53
• Sorry Sp3000, the expanded version is too large for codegolf :[ – bornSwift Aug 31 '14 at 23:10

# MetalDetector

(-------->)*9
([+]>)*21

• Amazing. Simple, yet effective :) – Sylwester Sep 23 '14 at 9:49
• @Sylwester Yep, very effective. – Timtech Sep 23 '14 at 11:18

# Twitcher, Stitcher, Wut, and 99BottlesOfBats

I haven't coded in BF before, but with a language so minimalistic, the challenge isn't really in knowing all the operations, but knowing how to combine them. Thought that I would put my two cents in. I started out with seven untested bots based on no real strategy, and ended up with four tested bots employing various strategies. I will include them all in this one post, for the sake of convenience.

## Twitcher

Twitcher builds a pyramid of alternating polarity with the metaphorical capstone as a tripwire. Twitcher goes back and forth, incrementing all decoys in the pyramid, and returning to the top to test whether the tripwire has the same value as it had initially. If it does, Twitcher goes back to building the pyramid, and extends the tripwire as far as cell 9, at which point it builds the pyramid more and keeps checking. Once the tripwire has been sprung, Twitcher rushes back and builds all of the decoys by 20 in the correct polarity, then rushes ahead and begins to clear, by first incrementing all non-zero cells by positive 27 and then fast-clearing them in the negative direction.

(>)*4-<+<-<+>>
+(<-<+)*1(>)*3+[<<(-)*20<(+)*20(>)*8(>[(+)*27[-]])*10000]->+
(<-<+)*2(>)*4-[<<(+)*20<(-)*20<(+)*20(>)*8(>[(+)*27[-]])*10000]+>-
<+(<-<+)*2(>)*5+[<<(-)*20<(+)*20<(-)*20<(+)*20(>)*8(>[(+)*27[-]])*10000]->+
(<-<+)*3(>)*6-[<<(+)*20<(-)*20<(+)*20<(-)*20<(+)*20(>)*8(>[(+)*27[-]])*10000]+>-
<+(<-<+)*3(>)*7+[<<(-)*20<(+)*20<(-)*20<(+)*20<(-)*20<(+)*20(>)*8(>[(+)*27[-]])*10000]->+
((<-<+)*4(>)*8-[<<(+)*20<(-)*20<(+)*20<(-)*20<(+)*20<(-)*20<(+)*20(>)*8(>[(+)*27[-]])*10000]+)*10000


Twitcher is named for its 'twitchy' behavior as it builds its pyramid and checks its tripwire.

## Stitcher

Stitcher creates a quick series of size-one decoys of alternating polarity, then rushes ahead to the ninth square and begins clearing non-zero cells with a positive increment of 18 followed by a fast negative clear.

(>+>-)*2(>)*4(>[(+)*18[-]])*30


Stitcher is named for the pattern of +1/-1 decoys it leaves, similar in appearance to stitched thread. Also, it rhymes with Twitcher.

## Wut

Wut first places a -1 decoy at cell 1, followed by +2 decoys at 2, 3, and 4. It then returns to 1 and changes the -1 decoy to a -21 decoy, then rushes to cell 9 and clears with a positive increment of 18 followed by a fast negative clear.

>-(>++)*3(<)*3(-)*20(>)*7(>[(+)*18[-]])*30


Wut has no particular motivation for its name.

## 99BottlesOfBats

99BottlesOfBats creates a +--++--+ decoy pattern of height 1 before performing a two-stage clear, with a nested decrement of 9 followed by a positive clear, and then a nested increment of 9 followed by a negative clear, which it performs only on cells that were initially non-zero.

(>+>->->+)*2(>[[-[-[-[-[-[-[-[-[-[+]]]]]]]]]][+[+[+[+[+[+[+[+[+[-]]]]]]]]]]])*9999


99BottlesOfBats is named after the popular song (and programming challenge) "99 Bottles," combined with the term 'BattleBots' with a vowel swap. The 99 comes from the two 9-depth clears, and the 9999 loop at the end (which is mostly to fit with the theme).

# Performances

In tournaments excluding LethalLokev2.1 (which required more computation than other opponents), all of these bots achieved a score between 400 and 500, with the following relative ranking: 1. Wut 2. 99BottlesOfBats 3. Twitcher 4. Stitcher

According to the most recent tournament results and the results from the tournament I ran with additional bots I later abandoned, I estimate that all of these four bots will place in the top 25.

# MultiVAC

I wish it would also generate better versions of itself :(

Builds a big defensive wall, then attacks. Also tries to clear smaller decoys faster.

>                     # Build 9 big decoys
(-)*4>(+)*4>          # A few small ones
(>)*6

(<(-)*80<(+)*80)*3    # And more big ones
<(+)*76               # For Confusion :)
<(-)*76

<(-)*28               # Just for you, Wall E

(>)*10

(                     # Walk forwards and clear everything
([+                 # is it 0 ~ 14 ?
{
(-)*16
(-[               # Is it neg(14) ~ 0 ?
{
(-)*112         # Big decoy / flag clearen (128~16=113)
[+]
}
])%16
}
])%16
[-]                 # Counter DecoyBot ~_~
(+)*2               # Leave a small trail behind
>

([-                 # The same thing with reversed polarity
{
(+)*16
(+[
{
(+)*112
[-]
}
])%16
}
])%16
[+]
(-)*2
>

)*11


This is practically only a test program for my bfjoust online-toolset, but it performs not so bad when I tested it.

Here is the minified version for the control program:

>---->++++(>)*7(<(-)*80<(+)*80)*3<(+)*76<(-)*76<(-)*28(>)*10([+[+[+[+[+[+[+[+[+
[+[+[+[+[+[+[+(-)*17[-[-[-[-[-[-[-[-[-[-[-[-[-[-[-[(-)*112[+]]]]]]]]]]]]]]]]]]]]]]
]]]]]]]]]]][-]++>[-[-[-[-[-[-[-[-[-[-[-[-[-[-[-[-(+)*17[+[+[+[+[+[+[+[+[+[+[+[+
[+[+[+[(+)*112[-]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]][+]-->)*11

• Does your visualiser expand before running? I wanted to use it, but it doesn't seem to do so well on longer bots... – Sp3000 Aug 28 '14 at 13:10
• @Sp3000: yep it does expand, in hindsight not my best idea :). If I find time later perhaps I will change it to a more efficient approach. – Mikescher Aug 28 '14 at 13:27
• @Mikescher (a{x}b)%n syntax is not available since this is no original BF Joust. Would you mind posting the valid version here? – Cipher Aug 28 '14 at 13:49
• Okay I did, but now the code doesn't look as nice :( – Mikescher Aug 28 '14 at 16:02

# The Wallmaster

Partially based on other walling bots, working on the concept that it's faster to build a wall than to clear one. Therefore, it'll be much faster to build 9 walls than to break 'em all...

+             Flip the flag to mess with people
(>)*9
[+](+)*78     First wall
(
<[-](-)*78  Build those walls
<[+](+)*78  And build them tall
)*4
(>)*9
[+]
(
[+[+[+[+[+[-]]]]]]>  Test the waters with 5 then clear
[-[-[-[-[-[+]]]]]]>
)*10