NetLogo:在不使用海龟的情况下创建晶格/网格资源世界吗? [英] NetLogo: creation of lattice/grid resources world without using turtles?

查看:96
本文介绍了NetLogo:在不使用海龟的情况下创建晶格/网格资源世界吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个分散的"资源世界,与中央补丁之间的距离要特定,并使这些补丁之间的距离保持相等.由于计算需求,我宁愿不使用乌龟来创建这个斑驳的世界.我希望创建这样的东西:

I would like to create a "gridded" world of resources, in specific distance from the central patch and keep distances equal between these patches. Due to calculation demand, I prefer not to use turtles to create this patchy world. I expect to create something like this:

同样,我想将补丁之间的距离定义为滑块工具.我当时在徘徊使用乌龟格子行走,然后将斑块变成不同的颜色,但是有没有办法在没有乌龟的情况下做到这一点呢?感谢您的任何建议!

Equally, I would like to define distance between patches as a slider tool. I was wandering to use turtle lattice walk and then turn patches to different color, but is there any way how to do that without turtles ? Thanks for any suggestions !

我不是完全正常的例子:

My not totally working exemple:

  to setup
  clear-all
  ask patches [set pcolor green]
    foreach [5 10 15] [
      repeat 9 [
        make-red-patch ?
      ]
    ]
  reset-ticks
end  

to make-red-patch [dist]
  crt 1 [
    fd dist
    rt 90
    while [pcolor = red] [
      bk dist
      rt 90
      fd 2 * dist
    ]
    set pcolor red
    die
  ]
end

推荐答案

我不确定您所需要的是什么,首先您提到自己不想使用海龟,并且在自己的回答中,您在使用补丁时遇到了问题龟.

I am not exactly sure what you need, first you mentioned you don't want to use turtles and in your own answer you have problem with the patch without a turtle.

可能有另一种方法来解决这个问题:

There might be another way to approach this question:

to setup
  clear-all
  ask patches with [pxcor mod Grid = 0 and pycor mod Grid = 0] [set pcolor red]
end

这些是具有不同网格大小的示例:

And these are examples with different Grid size:

这篇关于NetLogo:在不使用海龟的情况下创建晶格/网格资源世界吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆