The Bot Challenge

Remove the boring bits of Minecraft with your own Python code.

Setting up your robot.

Connecting to the server

First, you need to connect to our Minecraft server to spawn your bot. In Minecraft go to the Multiplayer server screen and add a new server with one of these addresses. If you're in Europe use:

europe.botchallenge.net

If you're in Asia/Australia then use this server address:

au.botchallenge.net

Go ahead and join the multiplayer server near you.

When you're there (in the Minecraft world), type:

/spawnrobot

Then right-click anywhere and you should see your brand new Pumpkin minion appear! It's there waiting for your instructions.

Connect from Python

In IDLE (or python3 on the command line) open a Python interpreter shell. It should say something like this:

Python 3.4.0 (default, Apr 11 2014, 13:05:11) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

Type in the following:

>>> from botchallenge import *
>>> robot = Robot("username", "server.address.net")
>>> 

But instead of "username" and "server.address.net" you should put your own minecraft username, and the address of the server (same as the one you connected to in Minecraft).

Now you have a connection to your robot, you can send commands:

>>> robot.move(Dir.UP)
True
>>>

The robot should be 1 block higher than it was before (it might say False if there was something in the way).

Try this out with other directions, UP/DOWN, LEFT/RIGHT, FORWARD/BACKWARD and NORTH/SOUTH/EAST/WEST all work.

Your robot comes with an infinite supply of Dirt and Cobblestone, so try placing some blocks:

>>> robot.place(Dir.LEFT, BlockType.DIRT)
True
>>>

Try moving the robot up, and placing some more blocks.

You can find out what type of block is next to the robot:

>>> robot.get_block_type(Dir.LEFT)
DIRT
>>>

Then you can mine the blocks away again with the mine function:

>>> robot.mine(Dir.LEFT)
True
>>>

You can also find out what the robot has in its inventory and where it is.

>>> robot.get_inventory()
[(DIRT, 64), (COBBLESTONE, 64)]
>>> robot.get_location()
Location(X:53, Y:67, Z:245)
>>>

There's a bunch of other things that you can do, so take a look at the complete list of available robot functions.

And if you want more ideas, check the example scripts.

Writing a script

If you don't want to type the comands one by one, over and over, you can write a script and save it in a python file to run as many times as you want.

Here's an example, create a new file in IDLE and paste this (remember to change the username and server address!).

from botchallenge import *
robot = Robot("username", "server.address.net")

for i in range(10):
    robot.move(Dir.UP)
    robot.place(Dir.DOWN, BlockType.DIRT)
    robot.move(Dir.RIGHT)
    robot.place(Dir.DOWN, BlockType.DIRT)

If there's enough space nearby, your robot should be building you a some dirt stairs! You're all set to start writing your own bot scripts. For inspiration you should check out the example scripts for more ideas of what you can do.

In-game commands

While you're in Minecraft, it's sometimes convenient to move the Robot around a little bit. You can use in-game commands by typing / in the game to give commands.

For example:

/robot move up

You can use any of up, down, left, right, forward, backward, north, south, east or west for the direction. You can also tell the robot to 'turn' to face a direction or 'mine' the block in any direction. We chose a pumpkin to represent the bot so that you can see which direction is it's facing.

Of course running these commands one by one is even more tedious than mining by yourself, so you probably want to do most stuff in Python.