diff --git a/index.html b/index.html index b719deb..68adfa4 100644 --- a/index.html +++ b/index.html @@ -156,6 +156,8 @@ margin-bottom: 4px; neighbors at every step ("Step"). Depending on the results obtained, a cell may adopt the strategy of a better-performing neighbor, which causes the distribution of colors to evolve over successive steps. +

+ Moreover, one cell randomly change strategy in order to see the emergence of new cluster when the parameters are changed.

Parameters (payoff matrix)

diff --git a/main.js b/main.js index 5c0d061..ed7200f 100644 --- a/main.js +++ b/main.js @@ -175,6 +175,14 @@ class Party { } } + // a random cell change + let ni = Math.floor(Math.random() * this.length); + let nj = Math.floor(Math.random() * this.length); + const index = Math.floor(Math.random() * this.functions.length); + newGrid[ni][nj] = this.functions[index]; + + this.grid = newGrid; + this.grid = newGrid; } } \ No newline at end of file