summaryrefslogtreecommitdiff
path: root/src/world/proposal.js
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-11-08 00:47:06 -0600
committersanine <sanine.not@pm.me>2023-11-08 00:47:06 -0600
commitf78493e192daf4639b91352909e4029b9970fcdb (patch)
tree5b43952cc5da05ffcc942d079f0c3b60674060be /src/world/proposal.js
parent3ae8f476f3865982ca69d0e39b05b5aa8ec43694 (diff)
implement basic sensing & refactor world/cells -> lattice
Diffstat (limited to 'src/world/proposal.js')
-rw-r--r--src/world/proposal.js22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/world/proposal.js b/src/world/proposal.js
index 775466c..9f98fd4 100644
--- a/src/world/proposal.js
+++ b/src/world/proposal.js
@@ -27,16 +27,16 @@ import { pairs, deepEqual } from '../util.js';
/* proposal structure
- * all proposed world and agent changes must be included for the proposed action to be valid
- * similarly, if any world or agent change creates merge conflicts, the proposal cannot be merged
+ * all proposed lattice and agent changes must be included for the proposed action to be valid
+ * similarly, if any lattice or agent change creates merge conflicts, the proposal cannot be merged
* and must be removed
* {
- * world_changes: proposal_world_change[]?
+ * lattice_changes: proposal_lattice_change[]?
* agent_changes: proposal_agent_change[]?
* }
*/
-/* proposal_world_change
+/* proposal_lattice_change
* {
* x, y: number
* from: string
@@ -69,10 +69,10 @@ function flags_compatible(a, b) {
// return a tuple [conflict, merge]
-// conflict is true if the two world_changes are incompatible
-// merge is true if the two world changes are identical
+// conflict is true if the two lattice_changes are incompatible
+// merge is true if the two lattice changes are identical
// otherwise they are false
-function world_change_conflict(a, b) {
+function lattice_change_conflict(a, b) {
if (deepEqual(a, b)) {
// merge
return [false, true];
@@ -145,11 +145,11 @@ function agent_change_conflict(a, b) {
}
-// combine world_change and agent_change conflict/merge tuples for a pair of proposals
+// combine lattice_change and agent_change conflict/merge tuples for a pair of proposals
function proposal_conflict_merge(a, b) {
- const [world_conflict, world_merge] = pairs(a.world_changes || [], b.world_changes || []).reduce(
+ const [lattice_conflict, lattice_merge] = pairs(a.lattice_changes || [], b.lattice_changes || []).reduce(
(acc, [a, b]) => {
- const [conflict, merge] = world_change_conflict(a, b);
+ const [conflict, merge] = lattice_change_conflict(a, b);
return [acc[0] || conflict, acc[1] || merge];
},
[false, false]
@@ -161,7 +161,7 @@ function proposal_conflict_merge(a, b) {
},
[false, false]
);
- return [world_conflict || agent_conflict, world_merge || agent_merge];
+ return [lattice_conflict || agent_conflict, lattice_merge || agent_merge];
}