2017-07-20 76 views

回答

3

有一个在你的问题有很多不确定性,但你应该能够更改以下,以满足您的需求。

turtles-own [ID] ;if unique, you can just use `who` 

to setup ;make some turtles with various xcors and IDs 
    ca 
    crt 100 [ 
    setxy random-xcor random-ycor 
    set ID random 1000 
    ] 
end 

to-report top ;get a turtle with biggest id 
    report max-one-of turtles [ID] 
end 

to-report winners ;get turtles to right of top 
    let topx [xcor] of top 
    report turtles with [xcor > topx] 
end 

to test 
    setup 
    print count winners 
end 
+0

@goodgest这听起来像你需要问一个单独的问题。但在你这样做之前,请思考这个经验法则:记者是你的朋友。 (也就是说,不要认为你不能轻易使用这些记者或其变体,没有什么能阻止你的表单在你的“结束”程序中叫记者。) – Alan