def calculate_action(client, ant) if ant.has_food and (ant.cell.home == client.id) # Drop food if we are at home DROP_FOOD elsif (ant.cell.food > 0) and !ant.has_food and (ant.cell.home != client.id) # Take food if there is food an we are not at home TAKE_FOOD else # Make a random move case rand(4) when 0..1 then GO when 2 then TURN_LEFT when 3 then TURN_RIGHT end end end