bool PickVoxel(integer Location)
Grab a voxel at the specified location and store it in the robot storage unit. You can pick a voxel in the 6 voxels which are directly adjacent. Some voxels can't be picked up by a robot (or the robot may need some extensions to get them). This function can only be used in Voxel_Step().
Location : The position of the voxel to grab in "position code" notation.
0 = { 0, 0, 1 } = Front of the robot.
1 = { 1, 0, 0 } = Right of the robot.
2 = { 0, 0, -1} = Back of the robot.
3 = {-1, 0, 0 } = Left of the robot.
4 = { 0, 1, 0 } = Above the robot.
5 = { 0,-1, 0 } = Under the robot.
A boolean number. It will be true if the function grabbed a voxel successfully or false otherwise.
Put the robot on a flat ground and let it grab materials for you.
// Listing #1: Simple Automatic Mining Machine
y <- 0;
xdir <-0;
function Voxel_Step()
{
switch (xdir)
{
case 0: PickVoxel(5);
Move(5);
y++;
if (y > 64) xdir = 1;
break;
case 1: Move(4);
y--;
if (y<1) xdir = 2;
break;
case 2: Move(0);
xdir = 0;
break;
}
}
PlaceVoxel()