Created
January 14, 2021 02:32
-
-
Save QuantumFractal/dbff4dc9b885a84d9149c1eab65f5851 to your computer and use it in GitHub Desktop.
slime mold
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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