Results 1 to 1 of 1
  1. #1
    Estrex is offline Member
    Join Date
    Dec 2012
    Posts
    7
    Rep Power
    0

    Default Help with Critter in Gridworld?

    So, I'm having trouble making this critter that can only process one critter at a time, eat it, then repeat this cycle until it has processed a critter three times. After it processes three times, it can multiply. Also, it can only look up to 8 squares for things to eat and it can only look in the current row it's in. Finally, I can't override any methods except for processActors, makeMove, getMoveLocations, getActors, and selectMoveLocation.

    I tried to make the critter do the processing one at a time thing in processActors but I can't maintain it, I can't make it process only one at a time. How do I do that? Also, if anyone could help me on the other parts too, I would be much obliged.

    This is what I have so far:
    import info.gridworld.actor.Actor;
    import info.gridworld.actor.Critter;
    import info.gridworld.grid.Location;
    import java.awt.Color;
    import info.gridworld.grid.Grid;
    import info.gridworld.actor.*;
    import java.util.ArrayList;
    public class TomaCritter extends Critter
    {
    public TomaCritter()
    {
    setColor (Color.YELLOW);
    }
    public void processActors (ArrayList < Actor > actors)
    {
    int critterLimiter = 0;
    int critters = actors.size();
    Actor jim = actors.get(critters);
    while (true)
    {
    critterLimiter++;
    if (critterLimiter >= 3)
    {

    critterLimiter = 0;
    }
    }
    }
    }
    Last edited by Estrex; 03-28-2013 at 09:03 PM.

Similar Threads

  1. URGENT: Quick rundown on GridWorld?
    By Green_Ghoul in forum New To Java
    Replies: 2
    Last Post: 05-03-2011, 03:00 AM
  2. help with gridworld?
    By Samirjthe2nd in forum New To Java
    Replies: 1
    Last Post: 04-28-2011, 11:10 PM
  3. please help/critter java
    By farahm in forum New To Java
    Replies: 2
    Last Post: 03-20-2011, 07:07 AM
  4. Object Construction ends Program in GridWorld
    By BJ1110 in forum Advanced Java
    Replies: 9
    Last Post: 02-04-2011, 05:02 PM
  5. Need gridworld help
    By robertbob in forum New To Java
    Replies: 2
    Last Post: 05-03-2010, 06:18 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •