|
Ade sape2 reti coding Starlogo tak?? nak mintak tolong tengok apa problem coding kat bawah nie..
Turtle Procedures
to condition
if (((xcor-of agent - xcor-of goal) < 40 ) or ((ycor-of agent - ycor-of goal) < 40 ))
[setxy random(screen-width) random (screen-height)]
end
to vertical
fd 1
if ycor != ycor-of 1 [vertical]
end
to horizontal
fd 1
if xcor != xcor-of 1 [horizontal]
end
Observer Procedures
breeds [agent goal obs]
patches-own [costs]
to setup
ca
ask-patches [if (random 100) < 25 [setpc white]]
ask-patches [if (random 100) < 25 [setpc yellow]]
ask-patches [if (random 100) < 25 [setpc green]]
ask-patches [if (random 100) < 25 [setpc blue]]
ask-patches [if (random 100) < 25 [setpc purple]]
create-agent-and-do 1
[setxy random (screen-width) random (screen-height)
setshape person-shape
]
create-goal-and-do 1
[setxy random (screen-width) random (screen-height)
if (((xcor-of agent - xcor-of goal) < 40 ) or ((ycor-of agent - ycor-of goal) < 40 ))
[setxy random(screen-width) random (screen-height) condition]
setshape shape13
]
create-obs-and-do 10
[setxy random (screen-width) random (screen-height)
setshape bubble-shape
]
end
to walkaround
ask-obs
[
seth random 360 fd 1
]
end
to move
ask-agent
[
vertical
ifelse xcor > xcor-of 1 [lt 90] [rt 90]
horizontal
stop
]
end |
|
|
|
|
|
|
|
Ni soklan dier.. sape yg reti coding starlogo mintak tolong sangat2.. da stuck..
Route/path finding is a common problem in various applications such as trip planning and GPS navigation. A cost function is usually used to facilitate route comparison which measures distance travelled, gas, time and other information. For this assignment, you are going to implement an A* search algorithm for an agent in a 50x50 virtual world.
Specifications:
1. The agent has limited field of vision, so it can only 搒ee |
|
|
|
|
|
|
|
tak de org tau ke coding starlogo?? |
|
|
|
|
|
|
| |
|