User Tools

Site Tools


ant_lab_1

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ant_lab_1 [2018/11/23 12:43] cthielant_lab_1 [2018/11/23 13:45] (current) cthiel
Line 5: Line 5:
 Next we need to give them some knowledge.  When they detect food, they will record the location of the food, and just go back and forth from their ''AntHill'' to the the ''Food'' supply.  When the ''Food'' runs out, they will forget the location, and go back into random walking, like before. Next we need to give them some knowledge.  When they detect food, they will record the location of the food, and just go back and forth from their ''AntHill'' to the the ''Food'' supply.  When the ''Food'' runs out, they will forget the location, and go back into random walking, like before.
  
-Finally, we will want to give them some communication skills.  If they encounter another ''Ant'', they will share any information about food.  (Maybe later you can make a subclass of ''Ant'' called ''GeniusAnt'' that will remember more than one food source, but for right now, an ''Ant'' can only remember one thing at a time). You can always enhance your simulation by adding obstacles or ants from another colony that will fight with. +Finally, we will want to give them some communication skills.  If they encounter another ''Ant'', they will share any information about food.  (Maybe later you can make a subclass of ''Ant'' called ''GeniusAnt'' that will remember more than one food source, but for right now, an ''Ant'' can only remember one thing at a time). You can always enhance your simulation by adding obstacles or ants from another colony that will fight with, or make a ''QueenAnt'' so your colony can make another colony 
 + 
 +Before we make an ''Ant'' we will be needing a way to test it (See [[https://en.wikipedia.org/wiki/Extreme_programming|Extreme programing]] for why it's a good idea to make a tester before the object you are testing).  We will make a simple ''AntCorral'' that will eventually hold ''Food'' objects and ''AntHill'' objects that spawn ''Ants''s as well as tell the all the objects in the  ''AntCorrall'' about the passage of time, so they will do something.  The objects will implement an interface we will invent called ''Active'' Any object that is ''Active'' will need to have a ''doSomething'' method. 
 + 
 +{{ ::active.java |Active.java}} 
 + 
 +{{ ::antland1.java |AntLand1.java}} 
 + 
 +The starter code above will only show the passage of time with an increasing counter called ''ticks'' Feel free to add the the String ''message'' to show information.  Now let us make the first version of ''Ant'' which  will implement the ''Active'' interface we have invented. 
 + 
ant_lab_1.1542994991.txt.gz · Last modified: 2018/11/23 12:43 by cthiel

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki