Description Usage Arguments Value
Runs the delivery man game. In this game, deliveries are randomly placed on a city grid. You must pick up and deliver the deliveries as fast as possible under changing traffic conditions. Your score is the time it takes for you to complete this task. To play manually pass manualDM as the carReady function and enter the number pad direction numbers to make moves.
1 2 | runDeliveryMan(carReady = manualDM, dim = 10, turns = 2000, doPlot = T,
pause = 0.1, del = 5)
|
carReady |
Your function that takes three arguments: (1) a list of two matrices giving the traffice conditions. The first matrix is named 'hroads' and gives a matrix of traffice conditions on the horizontal roads. The second matrix is named 'vroads' and gives a matrix of traffic conditional on the vertical roads. (2) a list providing information about your car. This list includes the x and y coordinates of the car with names 'x' and 'y', the package the car is carrying, with name 'load' (this is 0 if no package is being carried), a list called 'mem' that you can use to store information you want to remember from turn to turn, and a field called nextMove where you will write what you want the car to do. Moves are specified as on the number-pad (2 down, 4 left, 6 right, 8 up, 5 stay still). (3) A matrix containing information about the packages. This contains five columns and a row for each package. The first two columns give x and y coordinates about where the package should be picked up from. The next two columns give x and y coordinates about where the package should be delivered to. The final column specifies the package status (0 is not picked up, 1 is picked up but not delivered, 2 is delivered). Your function should return the car object with the nextMove specified. |
dim |
The dimension of the board. You will be scored on a board of dimension 10. |
turns |
The number of turns the game should go for if deliveries are not made. Ignore this except for noting that the default is 2000 so if you have not made deliveries after 2000 turns you fail. |
doPlot |
Specifies if you want the game state to be plotted each turn. |
pause |
The pause period between moves. Ignore this. |
del |
The number of deliveries. You will be scored on a board with 5 deliveries. |
A string describing the outcome of the game.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.