added small random changes

This commit is contained in:
Didictateur 2026-07-25 23:04:05 +02:00
parent 28924f4516
commit b235b76fd9
2 changed files with 10 additions and 0 deletions

View file

@ -156,6 +156,8 @@ margin-bottom: 4px;
neighbors at every step ("Step"). Depending on the results obtained, a cell may adopt 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 the strategy of a better-performing neighbor, which causes the distribution of colors
to evolve over successive steps. to evolve over successive steps.
<p></p>
Moreover, one cell randomly change strategy in order to see the emergence of new cluster when the parameters are changed.
</p> </p>
<h3>Parameters (payoff matrix)</h3> <h3>Parameters (payoff matrix)</h3>

View file

@ -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; this.grid = newGrid;
} }
} }