Pages

Saturday 24 March 2012

Differences between "forward/fd", "jump" and "move-to" in NetLogo

Their common points:
1.All can only be used on turtles;
2.All are for making turtles move.

Their differences:
1. "forward/fd" is followed by a number, which is the number of steps the turtle move forward. "jump" is followed by a number, which is the number of units (like step width) the turtle move forward. "move-to" is followed by a agent, whose position is the destination of moving. So, they control the number of steps, step width and destination of moving respectively.
2. "forward/fd" and "jump" do not change the direction of moving, so you need to set the direction first if you want the turtle to move toward a specific position. But the direction of "move-to" is determined automatically as you set the agent (destination).
3. "forward/fd" and "jump" are more similar and can be interexchanged easily. For example, "fd 6" = "repeat 6 [ jump 1 ]' and "fd 3.5" = "repeat 3 [ jump 1 ] jump 0.5".

3 comments:

  1. hey do you know how to use "move-to" function with "fd" function?
    I notice when I use "move-to" function, my turtle just "teleport" to the destination, but I want it to move there with "fd 1", if u know what i mean?
    any help would be greatly appreciated

    ReplyDelete
    Replies
    1. Sorry for delayed reply. I do not quite understand your question. "move-to" makes the turtle move to a position directly. "fd" just makes the turtle to move forward in the current direction by a certain number of steps. If you want to make the turtle move to a specific position by one step, you can change the direction of the turtle first, and the ask it "fd 1".Hope this helps.

      Delete
  2. I have the same problem as a guy before me. I want turtle to go to the certain detination, but instead of a "direct" way, I want him to do it step-by-step (1 step per tick). Could y write a code command for such a movement plx?

    ReplyDelete