88
48
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
- e.g.
- 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.
5Original, I like it. I'm just afraid that this won't allow for enough strategical depth, but that might be just me. – ɐɔıʇǝɥʇuʎs – 2014-08-22T17:54:01.347
11
This would be even more fun with Befunge.
– IchBinKeinBaum – 2014-08-22T18:09:26.9601I am not getting what the [91m] notation is in the output – Moop – 2014-08-22T20:07:05.063
1Is there a set date when the contest ends and the scoreboard is fixed? – Ingo Bürk – 2014-08-22T21:05:19.760
1I'm really tempted to just let a evolutionary algorithm have a crack at this... Might do so tomorrow, when I have a little more time on my hands. – ɐɔıʇǝɥʇuʎs – 2014-08-22T22:32:37.183
@Moop these are ANSI escape sequences for a colored output, i'll remove them / make them optional as soon as possible – Cipher – 2014-08-23T10:31:55.027
@IngoBürk I didn't want to set a fixed date since I wasn't sure about how well the tournament will progress, but I'll think about it ^^ – Cipher – 2014-08-23T10:32:31.487
1Is the
,
afterat least 10
part of the code or a comment? – FUZxxl – 2014-08-23T11:13:53.0136
I found a BF Jousting webpage which can run and visualize jousting matches.
– PhiNotPi – 2014-08-23T11:33:49.877@FUZxxl In this BF variant,
,
is no command. See the command list at the top of the question. – tomsmeding – 2014-08-23T11:57:27.940@Cipher No date is fine, you can keep updating the scoreboard. It'd make sense to just end it someday so you don't have to do that for all eternity. :) – Ingo Bürk – 2014-08-23T11:58:57.973
You write " Your bot's goal is to zero the enemy's flag for 2 consecutive cycles before he zeroes your own flag." So that means I can't clear [-] and move forward, because I'll always fall off the end? – AndoDaan – 2014-08-23T13:00:20.717
1@AndoDaan Since
[
and]
are commands too, you will not leave the tape if you use[-]>
. Because in the second cycle of which the flag is zero, you actually check if it is zero and the>
will execute in the next cycle. – Cipher – 2014-08-23T16:23:10.790When are you gonna make a first scoreboard? Plenty of submissions already, might be worth it :) – Ingo Bürk – 2014-08-23T17:48:09.350
why doesn't the log show what happens after one of the bots gets off the board? by the spec, the match continues although the bot doesn't do anything. – proud haskeller – 2014-08-23T19:19:49.083
also, i think you should add a tie scenario, if both bots end with flags of 128. right now this is unfair as some bots fight mainly on the right side and some mainly on the left side. – proud haskeller – 2014-08-23T19:35:43.317
@proudhaskeller if one bot leaves the tape it will appear on the other side of the tape, since it is based upon a wrapping implementation of the interpreter. nevertheless the main program will see this and finish the match, but you're right it's not clear visible. there already is a tie scenario in form of a draw after 10000 cycles. – Cipher – 2014-08-23T20:20:54.627
Using abbrivation syntax slows the turnament down. I have a feeling you expand the outer parens before the inner. eg.
((+)*10)*10
does(+)*10(+)*10..
in first iteration rather than(++++++++++)*10
. – Sylwester – 2014-08-23T20:30:25.780@Cipher Well, the specification says that a bot that got out of screen would stop running, but not stop the match. How long will it take to be fixed? – proud haskeller – 2014-08-23T20:58:58.373
About abbreviation syntax, it seems that the code doesn't allow (...)100000, and shortens it to some other number. Is there any way to bypass it? Will it be fixed? If there is a problem with performance, it should be possible to not expand the code and treat (...) as a language construct. Or maybe just add a way to write "do this until the game ends", as this is what i'm trying to achieve. – proud haskeller – 2014-08-23T21:02:45.507
@proudhaskeller The rules for winning clearly state that leaving the tape will result in the loss of the match, not that the bot just stops running. – Ingo Bürk – 2014-08-23T21:06:21.430
@IngoBürk Oh i misread the part that said that if the program ends the bot still can win. But i still don't see the part where he clearly states the rules. – proud haskeller – 2014-08-23T21:11:43.623
@proudhaskeller "Winning conditions", second bullet point states that a bot wins if the enemy moves out of bounds. – Ingo Bürk – 2014-08-23T21:13:12.983
The abbreviation syntax gets converted to regular Brainfuck right now, but I will get the interpreter to understand it on monday or tuesday. Because of this I had to shorten some numbers like 100000 to smaller ones, but they still produce code with over 10000 cycles length. – Cipher – 2014-08-24T11:34:39.693
@Cipher You could just seach
m/\(([^\(\)]+?)\)\*(\d+)/
(I'm no pythoner so this is perl regex) and do those first and repeat as long as you get hits. It will do the inner parens first preventing the job growing in size and complexity. BTW when is deadline for the next round? – Sylwester – 2014-08-24T15:49:31.743Are we allowed to modify our bots between rounds? – DLosc – 2014-08-24T23:34:20.083
@DLosc yep, but please mark yout post with an 'EDIT' or something like that ^^ – Cipher – 2014-08-25T06:44:36.070
@Sylwester thanks for your hint, maybe I'll get it to work until the next round, which will be today, 4pm UTC+2 – Cipher – 2014-08-25T06:50:29.223
I have an interesting strategy I want to try that requires unmatched [. – Joshua – 2014-08-25T15:44:06.990
How would you implement: "while not 0: add 1, subtract 2, add 3, subtract 4 ...." is it impossible since we can't really save memory? – Cruncher – 2014-08-25T16:25:25.447
4Thanks for hosting this KOTH, Cipher. Must be a lot of work with so many submissions. – AndoDaan – 2014-08-25T17:05:07.597
1
FYI: Unfortunately, this question has been removed from the Hot Network Question list due to the title. If you want it to show up there again, you may want to edit it.
– Geobits – 2014-08-25T18:09:19.437@Cruncher You do manual unroll
[+[--[+++[----[+++++ ... ]]]]
There is a penalty of 1 step for each step when the loop closes. A normal BF program you would use temp cells[<<+[->+>+<<]>[-<+>]>[<<+[->+>-<<]>[-<+>]>]]
but this is more expensive in Bf joust than unrolling loops. Remember it's only 256 states! – Sylwester – 2014-08-25T18:28:10.860@Cruncher Thats why Unrolling works even better. Make a loop that is 10000 chars long (except
]
s) in the pattern I presented. – Sylwester – 2014-08-25T18:40:19.1201Anyone else think of Core Wars? – Quaxton Hale – 2014-08-26T06:36:59.373
Why is range [-127..128] and not [-128..127] as standard twos compliment would dictate? – weston – 2014-08-27T07:34:24.633
Doesn't make any difference I guess, you can display the range as [0..255], makes no difference to the bots. But if you are using an signed byte in an interpreter like I am, the starting value is -128. – weston – 2014-08-27T07:43:20.927
@weston that's something I adopted from BF Joust, but as you said, it's not making any difference – Cipher – 2014-08-28T07:03:46.073
1@weston Yes, the controller code is written for Python 2--the
print
statements break in Python 3, which uses theprint()
function instead. I searched the file for all instances ofprint
and added the parentheses. Also, at line 16 in the current version, you'll need to changemap(str, self.values)
tolist(map(str, self.values))
. Making those edits allowed me to run it in Python 3. – DLosc – 2014-08-28T22:36:53.3801
Power rankings in a CSV file on Pastebin for anyone who's interested. These rankings are for all 21 tape lengths so don't account for the randomness of the KOTH. Also gives a performance breakdown of bot vs. bot.
– Comintern – 2014-08-29T00:31:43.333I'm shocked that you actually put my two Dumbot variants in the battles! It was really amusing watching them completely fail. – frederick – 2014-08-29T10:27:22.773
Damn! I didn't catch there was a round today. Is there going to be another one this weekend? – Sylwester – 2014-08-29T18:26:44.147
@Sylwester next round will be probably on monday and after that one in a 4 or 5 days frequency, since I'm away from home during this time – Cipher – 2014-08-29T20:51:29.477
Anyone who knows python and thinks tournament is too slow, take a look at my issue perhaps have a go at implementing it https://github.com/redevined/brainfuck/issues/4
– weston – 2014-09-05T07:40:06.9601It'd be nice if you made a new repository without the logs directory in it, and found some other way to distribute the logs. The repository .git directory alone is 100MB, and the checkout is 4GB. This makes trying to patch/work on the main interpreter a pain. – Lymia Aluysia – 2014-09-06T10:21:53.083
I'll discard the logs from the repo and comment them inside the code, since it has become impossible for me to push them to git... – Cipher – 2014-09-07T18:43:26.493
I think BFJ should have counted consecutive
]
as one when the current cell is zero. It would have removed the need for a lot of the special syntax it currently has to support writing short code to avoid this penalty and code would be more BF (which is easier to read). – Sylwester – 2014-09-11T16:54:50.597Any comments on why LethalLoke wasn't updated this round? – Sylwester – 2014-09-12T15:02:21.207
@Sylwester I've created the scoreboard on thursday morning but wasn't able to upload it until friday - but don't worry, it will be included in the next round – Cipher – 2014-09-13T10:38:44.417
1It's great that you're still running this. Thanks. – AndoDaan – 2014-09-22T13:32:15.823
3I'd rather say thanks to everyone for still participating ^^ – Cipher – 2014-09-22T14:10:32.420
Ahaha yeah thanks for all the hard work Cipher :) (I've been wanting to post more bots but I've been busy...) – Sp3000 – 2014-09-23T14:08:48.857