Engine Settings
diff --git a/script.js b/script.js
index 97627b8..5d1da9a 100644
--- a/script.js
+++ b/script.js
@@ -2,6 +2,8 @@ var UPDATE_INTERVAL = 10;
var CONNECTION_DISTANCE = 250;
var DROP_PENALTY = 1.2;
var TTL = 5;
+var MAX_OUTGOING_CONNECTIONS = 3;
+var MAX_INCOMING_CONNECTIONS = 3;
function smoothColorTransition(color1, color2, min, max, current) {
// Clamp current between min and max
@@ -329,7 +331,7 @@ function main() {
if (nodeTable[neighbor.node].incoming.length == 0) {
connectionScore += 10000;
}
- if (nodeTable[neighbor.node].incoming.length >= 3) {
+ if (nodeTable[neighbor.node].incoming.length >= MAX_INCOMING_CONNECTIONS) {
continue;
}
if (nodeTable[node1].outgoing.includes(neighbor.node)) {
@@ -341,7 +343,7 @@ function main() {
const neighborMap = new Map(neighbors.map(n => [n.node, n]));
const top3 = scores.slice(0, 3);
for (let score of top3) {
- if (nodeTable[node1].outgoing.length >= 3) {
+ if (nodeTable[node1].outgoing.length >= MAX_OUTGOING_CONNECTIONS) {
let dropped = false;
if (nodeTable[node1].outgoing.includes(score.node)) {
//console.log(`${score.node} is already in outgoing; skipping drop attempt`);
@@ -378,7 +380,7 @@ function main() {
}
}
// still at capacity and nothing was dropped — skip adding this candidate
- if (nodeTable[node1].outgoing.length >= 3 && !dropped) {
+ if (nodeTable[node1].outgoing.length >= MAX_OUTGOING_CONNECTIONS && !dropped) {
continue;
}
}
@@ -469,4 +471,12 @@ document.getElementById('dropPenalty').addEventListener('change', function() {
document.getElementById('ttl').addEventListener('change', function() {
TTL = parseInt(this.value);
+});
+
+document.getElementById('maxOutgoingConnections').addEventListener('change', function() {
+ MAX_OUTGOING_CONNECTIONS = parseInt(this.value);
+});
+
+document.getElementById('maxIncomingConnections').addEventListener('change', function() {
+ MAX_INCOMING_CONNECTIONS = parseInt(this.value);
});
\ No newline at end of file
diff --git a/style.css b/style.css
index 007264d..7095698 100644
--- a/style.css
+++ b/style.css
@@ -68,7 +68,7 @@ html, body {
gap: 10px;
}
-#simpleSettingsContent {
+#simpleSettingsContent, #engineSettingsContent, #hardwareConstraintsContent {
display: flex;
flex-direction: column;
gap: 10px;
@@ -76,18 +76,6 @@ html, body {
padding-top: 10px;
}
-#engineSettingsContent {
- display: flex;
- flex-direction: column;
- gap: 10px;
- padding-left: 20px;
- padding-top: 10px;
-}
-
-#simpleSettings {
- margin-bottom: 10px;
-}
-
-#engineSettings {
+#simpleSettings, #hardwareConstraints, #engineSettings {
margin-bottom: 10px;
}
\ No newline at end of file