我的模型工作的世界总是一个方2^N。
我想要一些允许我导入如下CSV的代码:
3
5; 6; 8; 9; 8; 4; 1; 5
7; 7; 8; 2; 9; 5; 2; 6
5; 8; 4; 2; 6; 8; 9; 2
5; 4; 9; 8; 6; 3; 2; 4
5; 6; 8; 9; 8; 4; 1; 5
7; 7; 8; 2; 9; 5; 2; 6
5; 8; 4; 2; 6; 8; 9; 2
5; 4; 9; 8; 6; 3; 2; 4值3表示N,因此世界大小应该设置为8×8块(2^3=8)的平方。
补丁拥有一个名为"value“的变量,我想根据CSV中的值设置这些值。
发布于 2015-04-17 19:23:41
正如Seth所提到的,CSV扩展可以在这里提供帮助:
let matrix but-first (csv:from-file "filename.csv" ";") ; `but-first` since we don't care about that first line
ask patches [
let row max-pycor - pycor
let column pxcor - min-pxcor
set value item column item row matrix
]https://stackoverflow.com/questions/29701020
复制相似问题