def calculateMove():
global x
global y
global z
currentHeight = mc.getHeight(x, y) - 1
forwardHeight = mc.getHeight(x + 1, z)
rightHeight = mc.getHeight(x, z + 1)
backHeight = mc.getHeight(x - 1, z)
leftHeight = mc.getHeight(x, z - 1)
if forwardHeight - currentHeight < 3:
x += 1
elif rightHeight - currentHeight < 3:
z += 1
elif leftHeight - currentHeight < 3:
z -= 1
elif backHeight - currentHeight < 3:
x -= 1