Professional Documents
Culture Documents
COMS2003: Application and Analysis of Algorithms II: Niversity of The Itwatersrand Ohannesburg
COMS2003: Application and Analysis of Algorithms II: Niversity of The Itwatersrand Ohannesburg
This week, we will do some work towards producing the snake agent required by the assignment. 1. Go to the following URL: http://www.cs.wits.ac.za/wookeyd/description.php 2. Download the example java agent and the standalone snake server. 3. Open the example java agent and build it. 4. Follow the instructions on the site to run the standalone snake program with the example agent.
Modications
1. Now modify the example snake so that it goes up if the apple is above your snake, down if the apple is below, left if the apple is to the left and right if the apple is to the right. 2. Note that you can ignore obstacles at this point. 3. Note that if youre moving downwards and the apple is above you, the server will not allow you to go up as the rest of your snake is in the way. You must handle this by going left or right rst, which will allow you to go up.