Skip to content

Instantly share code, notes, and snippets.

@QuantumFractal
Created January 14, 2021 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save QuantumFractal/dbff4dc9b885a84d9149c1eab65f5851 to your computer and use it in GitHub Desktop.
Save QuantumFractal/dbff4dc9b885a84d9149c1eab65f5851 to your computer and use it in GitHub Desktop.
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