Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
slime mold
function attraction_table(n)
table = zeros(n,n)
attr_norm = Normal(1.0, 0.25)
repl_norm = Normal(-1.0, 0.5)
for index in CartesianIndices(table)
if index[1] == index[2]
table[index] = rand(attr_norm, 1)[1]
else
table[index] = rand(repl_norm, 1)[1]
end
end
return table
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment