Tutorial 1How to configure and run the Feed-Flee-Mate gameIntroductionConfigurationRun the GameTutorial 2How to create an agent in the Feed-Flee-Mate gameIntroductionStep 1Step 2Step 3Step 4Step 5Step 6Tutorial 1How to configure and run the Feed-Flee-Mate gameIntroductionIn this tutorial the configuration possibilities available in the Feed-Flee-Mate game is discussed. ConfigurationConfiguration is as of now performed in the Configuration.java file. This implies that you have to recompile this file every time you want your configuration to be used by the game. In the Configuration.java file you can add agents you want to be in the game from the very beginning as well as configure the general agent characteristics with more.All the constants used in this file have self explanatory names. However, comments are provided to further spell out their meaning. Run the GameIn order to run the game, simply invoke the “main” method in Main.java. This will initialize your game with the settings and agents provided in the Configuration.java file.Tutorial 2How to create an agent in the Feed-Flee-Mate gameIntroductionIn this tutorial a basic, non-intelligent, agent for the Feed-Flee-Mate game is developed and put into the game. The agent is called KillerAgent and the source code for this agent is available in the yaes.application.eel6938.classagents namespace. This tutorial will not cover details on how the intelligence is implemented for the KillerAgent. The process of creating a user defined agent consists of 6 steps:1. Create a new Java file with an appropriate name for your agent (KillerAgent.java, FleeAgent.java, etc.).2. Inherit, by using the Java keyword extends, from the Agent class located in the game.objects namespace.3. Create the following functions in your agent class:a. String getName()b. int[] getColor()c. void intelligence()4. Write your custom made intelligence.5. Update the Configuration.java file with your newly created agent.6. Compile and run!Step 1Create a new Java file. Place this file in the yaes.application.eel6938.classagents namespace. I name my file KillerAgent.java.Step 2Inherit from the Agent class located in the yaes.application.eel6938.game.objects namespace.package yaes.application.eel6938.classagents;import yaes.application.eel6938.game.Constants;import yaes.application.eel6938.game.objects.Agent;public class KillerAgent extends Agent {}Step 3Implement the abstract function required by the Agent class. These are:- String getName()- int[] getColor()- void intelligence()getName() - should return the name you want to display for your agent.getColor() - should return an array of integers describing the RGB components of the color you want to display for your agent.intelligence() - should contain the intelligence for your agent. This function is called every cycle of the game.Step 4Create the intelligence for your agent in the intelligence function you created in the previous step. The commands available are inherited from the Agent class. See the API package yaes.application.eel6938.classagents;import yaes.application.eel6938.game.Constants;import yaes.application.eel6938.game.objects.Agent;public class KillerAgent extends Agent {public void intelligence() {}public String getName() {return "KillerAgent";}public int[] getColor() {int[] rgb = {255,0,0};return rgb;}}for more specific information about the available commands and helper functions. The command set currently consists of:- Move- Eat- Flee- Attack- MateA simple random move behavior is created in the example below.Please refer to the KillerAgent.java file in order to get details on how path-planning, sensor reading and other commands are being used.Step 5Update the Configuration.java file to indicate use of your newly created agent. Simply open the Configuration.java file and append your agent to the Agents array. In the example below three KillerAgent agents have been added to the array.package yaes.application.eel6938.classagents;import yaes.application.eel6938.game.Constants;import yaes.application.eel6938.game.objects.Agent;public class KillerAgent extends Agent {public void intelligence(){int speed = (int)(Math.random()*5);int direction = (int)(Math.random()*4);move(direction, speed);}public String getName() {return "KillerAgent";}public int[] getColor() {int[] rgb = {255,0,0};return rgb;}}Step 6Compile the files and run the main function in Main.java.public final static String [] Agents = {"KillerAgent",
View Full Document