# Delivery Robots and Destroyer Drones

Program your robots to deliver packages in a warehouse infested with destroyer drones. Avoid the drones and get your packages to the right place as fast as you can.

## Delivery Robots

• There are packages labeled a-z in a warehouse.
• Packages must be delivered to a matching chute A-Z.
• A robot cannot move to a square that contains a wall or another robot.
• A robot passing over a package will pick it up if it is not holding a package.
• A robot landing on a chute will drop their package if the package label matches the chute.

## Destroyer Drones

• If there is a clear line of sight to robots (NSEW), the drone will move toward the closest visible robot.
• If in a dead end or blocked by another drone, the drone will reverse direction.
• If at an intersection, a drone will choose a random direction (but not backtrack).
• Otherwise, a drone will move on its current heading.
• If a robot is ever in one of the four adjacent squares next to a destroyer drone, that robot is destroyed and disappears. If the robot had a package, it is dropped, replacing any package or chute already there.
• Drones pass over packages.

## Warehouse Arena

#################################################
#B             #             #   #      ff      #
############ ##### ######### # # # # ########## #
##### ###          efg*     ## # # #         C# #
#         # ## ############        ############ #
# ###### ## ##         ########## #####         #
#  de  # ## ## ################## ##### ## # ## #
###### # ##    ##      #      ###   ### ## # ## #
#      # ######## ########### ######### ## #  # #
# ######          #    A    #           ## ## # #
# ## ###### #### ## ####### ########### # aeb # #
# ##G       ###  ##    #    ##          ####### #
# ## ###### ### ### ####### ## ########         #
# ######### ### ###      *  ## #        #########
#  cfe   ## ### ####### ###### ########      ## #
######## ## ###     ### ######          ####    #
######## ## ### ### ### ############### ####### #
#               ### ### # # # # # #D# # #   #
# ###### ##########                     ##### # #
# ###### #### ##### ### ############### ###  ## #
#  #          ##    ###    ##gba        ###     #
# ## ### #### ## ## ### ############### ### #####
# ## ### # *        ### #                       #
# ###### ############## ############### ####### #
#            ########## ##      E  ##         # #
############ ###abc     ## ### ### ## ####### # #
#            ##### ####### ###     ##         # #
# # ######## ##### ####### ### ###### ######### #
# F #                           #     # ccc     #
#################################################


#: wall, \$: delivery robot, *: destroyer drone, a-z: package, A-Z: delivery chute

## Game Flow

Your program will be called with an arena file argument and MAXTURN integer. The program should follow the logic flow below.

read in arena
for turn in 1..MAXTURN
for each robot
optionally move robot to one of four adjacent squares
if chute here and has matching package
remove package from robot
if all packages delivered
end game
if next to drone
delete robot
reduce score
if package here and robot has no package
remove package from square
for each drone
move drone
if next to any robots
kill those robots
drop packages onto map
if no robots left
end game


## Scoring

• The test arena with MAXTURN=5000 will be used for scoring.
• You score 500 points for each package delivered.
• You lose 900 points for each robot destroyed.
• The game ends if all robots are destroyed or MAXTURN turns elapse.
• If you deliver all packages, you gain a bonus point for each turn you had remaining.

Your total score will be the sum of the scores of 3 consecutive games.

Your program must not assume this test arena. An arena my be up to 200x200 squares and contain thousands of packages, chutes, robots, and droids. If I suspect any submission to be tailored towards this specific arena, I reserve the right to replace it by a new arena. Standard loopholes are prohibited as usual.

• Whoa, a challenge of yours that doesn't contain an image. ;) I'm not sure it even matters, but did you check that it's even possible to deliver all 26 packages in 5000 turns with perfect movement ignoring drones? And I think in general it's a bit better for these challenges to provide a controller program, which takes care of stuff like the drones and valid implementation of the game rules, and let people only implement a program that returns the movement directions. That way you wouldn't have to check every single submission that the game is implemented correctly. Jan 10 '15 at 15:52
• I though I would branch out into non-image challenges, just to see if I could do them ;). I calculated an estimate for perfect deliveries and added a contingency factor - should be possible to complete. I did consider a controller, but I ended up with a program flow specification. The PPCG community is pretty good about following the rules. I hope some programmers try it out and have fun. Jan 10 '15 at 16:06
• "The PPCG community is pretty good about following the rules." The PPCG community use to be known for its rule-lawyering, and while it's been moving away from that (fortunately), there are still some people around who like to find and exploit loopholes. (Just as a heads-up.) Jan 10 '15 at 16:24
• The thing that bothers me in this challenge is that I have to write the algorithm for both bots and drones. Pretty sure I will be partial a bit. Also, it takes out the fun of writing the code for just the bots because the drones are pretty much rule bounded and there is no fun in writing them. This would be best served as a KOTH with a common arena for multiple bots trying to get the package at target in the least amount of moves without getting burned. Jan 10 '15 at 21:00
• That is just the kind of challenge I like, but I agree with Martin about the lack of controller. There are just too many details that would differ from one implementation to another, even trying to follow the specs in good faith.
– user16991
Jan 14 '15 at 15:47