added small random changes
This commit is contained in:
parent
28924f4516
commit
b235b76fd9
2 changed files with 10 additions and 0 deletions
|
|
@ -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>
|
||||||
|
|
|
||||||
8
main.js
8
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;
|
this.grid = newGrid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue