Fruitbots, a JS bot challenge

Fruitbots challenge

I sometimes like to join bot challenges to improve my programming skills and logic reasoning.

Last week I discovered Fruitbots, a JavaScript bot challenge created by the Scribd staff. Like every good challenge of its type, it features simple rules and a clear bot API. It can also be scripted in 4 languages: Python, Lua, Ruby and JavaScript.

The Fruitbots world is a board with different kind of fruits lying around. The goal is to collect more fruits than the opponent bot, of many types as possible.

I developed some simple-sample JavaScript bots. The Look a Lot bot, for instance, has a simple strategy:

  • If on a useful fruit, eat it!
  • Else, go to the best direction, looking at:
    • nearer and rarer fruits
    • bonus for disputed fruits, if nearer than the opponent
    • avoid previous position, out of the border moves and to PASS

The bot was good enough to get into the Top 50. If you’re curious, the Look a Lot JavaScript code is here!

2024 Update

After years of low activity, unfortunately the Fruitbots website is now officially down. Some bots implementations, like mine, are still hosted on GitHub, but the bot arena is gone. Time kills!

2 thoughts on “Fruitbots, a JS bot challenge

Leave a Reply

Your email address will not be published. Required fields are marked *