ich eine Liste der Array rufen die Jobarray jedoch drucken erstellen möchten, wenn ich das zu tun versuchen, NetLogo den folgenden Fehler zurückgibt:Wie Erstellen und ein Array
Extension exception: not an array: 0
error while job 470 running ARRAY:ITEM
called by procedure JOBLIST
called by procedure PLACE-JOBS
called by procedure SETUP
called by Button 'Setup'
Diese
meinen Code sindto setup
ca
place-jobs
print Jobarray
reset-ticks
end
to set-job-index
let columns 3
let rows-job Number-Of-Jobs set
Jobarray array:from-list n-values rows-job [array:from-list n-values columns [0]]
end
to Joblist [#col #row #val]
array:set (array:item Jobarray #row) #col #val
end
to draw-pods
;draw pods area
ask patches with [(pxcor mod 4 = 2 or pxcor mod 4 = 3) and (pycor mod (Pod-size + 2) > 1 and pycor < (max-pycor - 4))]
[
sprout 1
[
set shape "square"
set color blue
stamp
die
]
set meaning "pods"
]
end
to place-jobs
let Job-index 0 ;; row of list; 0 == 1
ask n-of (Number-Of-Jobs) patches with [meaning = "pods"]
[
sprout-jobs 1
[
Joblist 0 Job-index who
Joblist 1 Job-index pxcor
Joblist 2 Job-index pycor
set Job-index (Job-index + 1)
set shape "square"
set color pink
set job-value 1
stamp
; die
]
set meaning "jobs"
set Jobnum (count jobs-on patches with [meaning = "jobs"])
]
end
Kann mir jemand erklären warum und wie kann ich es beheben? Ich habe es beim Suchen von Google und auch im Wörterbuch versucht, verstehe aber immer noch nicht warum. Mit freundlichen Grüßen Minh
Oh, ich sehe, vielen Dank: D –
Kein Problem! Achten Sie darauf, die Antwort richtig zu markieren, damit andere wissen, dass diese Frage beantwortet wurde. –