Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
每次点击我都希望特定百分比的海龟死亡(即 50%)。目前我正在使用代码:
if random 100 < 50 [die]
虽然这可行,但并不一致,最终,纯属偶然,所有海龟都会使用这种方法死亡。
任何帮助表示赞赏,谢谢!
ask n-of (count turtles / 2) turtles [ die ]会杀死 50% 的海龟。(如果海龟的数量是奇数,多余的海龟会被放过。)
ask n-of (count turtles / 2) turtles [ die ]