Help for code #3666
Closed
PG1966
started this conversation in
Examples of GAMA use
Help for code
#3666
Replies: 2 comments
-
It looks like the code is written in NetLogo language, but it's missing the to keyword before the action block, which is required to define a procedure or function. Here's the corrected code with the to keyword added: to evacuation_model
type: simulation
species {
evacuee {
initial_location: select_one(shelter)
speed: 10
}
vehicle {
initial_location: select_one(house)
speed: 30
capacity: 4
}
}
grid {
topology: torus
shape: hexagon
size: 100, 100
resolution: 1
}
environment {
shelter: patch kind: shelter
house: patch kind: house
road: link kind: road
}
experiment {
duration: 3600
steps_per_second: 5
}
to action
create shelter type: patch quantity: 1
create house type: patch quantity: 1000
create road type: link connect: all_to_all
connect_patch_to_link(road, house)
connect_patch_to_patch(shelter, house)
create vehicle type: vehicle quantity: 200
for (v: vehicle) {
go_to(v, select_one(shelter))
}
end
end Note that the action block now has a to keyword at the beginning, and an end keyword at the end to indicate the end of the procedure. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Dear,
I highly recommend you to have a do at least one of the tutorials.
There is nothing correct in your syntax, both in GAML or even in Netlogo.
I do not know how you produce it.
By curiosity, did you produce it using chatGPT ?
Cheers
Benoit
Le mar. 14 mars 2023 à 07:45, Baptiste Lesquoy ***@***.***> a
écrit :
… It looks like the code is written in NetLogo language, but it's missing
the to keyword before the action block, which is required to define a
procedure or function. Here's the corrected code with the to keyword added:
to evacuation_model
type: simulation
species {
evacuee {
initial_location: select_one(shelter)
speed: 10
}
vehicle {
initial_location: select_one(house)
speed: 30
capacity: 4
}
}
grid {
topology: torus
shape: hexagon
size: 100, 100
resolution: 1
}
environment {
shelter: patch kind: shelter
house: patch kind: house
road: link kind: road
}
experiment {
duration: 3600
steps_per_second: 5
}
to action
create shelter type: patch quantity: 1
create house type: patch quantity: 1000
create road type: link connect: all_to_all
connect_patch_to_link(road, house)
connect_patch_to_patch(shelter, house)
create vehicle type: vehicle quantity: 200
for (v: vehicle) {
go_to(v, select_one(shelter))
}
endend
Note that the action block now has a to keyword at the beginning, and an
end keyword at the end to indicate the end of the procedure.
—
Reply to this email directly, view it on GitHub
<https://github.com/gama-platform/gama/discussions/3666#discussioncomment-5299618>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAL3WSQLSKOBCU36XULFIQLW4AHX7ANCNFSM6AAAAAAV2AO4G4>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I don't know why this code gives me an error.
Thanks in advance
Gabriele
model evacuation_model type: simulation {
species {
evacuee {
initial_location: select_one(shelter)
speed: 10
}
vehicle {
initial_location: select_one(house)
speed: 30
capacity: 4
}
}
}
Beta Was this translation helpful? Give feedback.
All reactions