From f78493e192daf4639b91352909e4029b9970fcdb Mon Sep 17 00:00:00 2001 From: sanine Date: Wed, 8 Nov 2023 00:47:06 -0600 Subject: implement basic sensing & refactor world/cells -> lattice --- src/world/proposal.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/world/proposal.js') 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]; } -- cgit v1.2.1