From b235b76fd91fffd301b6e5421f95312c9aa67923 Mon Sep 17 00:00:00 2001
From: Didictateur
Date: Sat, 25 Jul 2026 23:04:05 +0200
Subject: [PATCH] added small random changes
---
index.html | 2 ++
main.js | 8 ++++++++
2 files changed, 10 insertions(+)
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