1. Scientific & Mathematical Overview
Bubble Path Escape is a turn-based discrete graph strategy simulator and dynamic multi-agent pathfinding laboratory. The game abstracts spatial navigation into a 2D planar graph $\mathcal{G} = (V, E)$, where each vertex $v \in V$ represents an isolated spherical bubble node, and unweighted bidirectional edges $e = (u, v) \in E$ define allowable discrete orthogonal transitions:
$$E = \left\{ ((c_1, r_1), (c_2, r_2)) \;\middle|\; |c_1 - c_2| + |r_1 - r_2| = 1 \right\}$$
The primary player entity (the Happy Person) formulates a directional trajectory sequence $\mathcal{P} = \langle v_0, v_1, v_2, \dots, v_k \rangle$ from an initial state $v_0 = s$ to a designated absorbing exit state $v_k = t$. Navigational complexity emerges from the interaction of two asynchronous, distinct dynamic adversaries operating under heterogeneous behavioral paradigms:
- Periodic Deterministic Patrol (Shark): Governed by a cyclic directed waypoint array $\mathcal{W}_{\text{shark}} = \langle w_0, w_1, \dots, w_{m-1} \rangle$, advancing one discrete vertex per execution cycle with reversal upon terminus boundary encounters.
- Dynamic Shortest-Path Breadth-First Search AI (Zombie): An adaptive pursuit agent that recalculates the unweighted graph geodesic $\min \text{dist}_{\mathcal{G}}(z, p)$ toward the instantaneous player coordinates $p \in V$ on every turn cycle using a soft-goal adjacency constraint.
3. Mathematical & Algorithmic Foundations
The simulation employs a Breadth-First Search (BFS) graph traversal algorithm operating in $\mathcal{O}(|V| + |E|)$ time to govern dynamic pursuit. Given player coordinates $p = (c_p, r_p)$ and zombie coordinates $z = (c_z, r_z)$, the soft-goal search identifies the immediate neighbor $z' \in \mathcal{N}(z)$ that minimizes graph geodesic distance while preventing direct landing on the player node:
$$\text{Next Step } z^* = \arg\min_{u \in \mathcal{N}(z)} \text{dist}_{\mathcal{G}}(u, p) \quad \text{s.t.} \quad u \neq p$$
The spatial distance heuristic on the Manhattan grid satisfies the unweighted metric:
$$d_M(u, v) = |c_u - c_v| + |r_u - r_v|$$
Kinematic rendering utilizes isotropic coordinate transformations centered within the canvas viewport. Given viewport dimensions $(W, H)$, column count $C$, and row count $R$, the cell spacing $S$ and origin offsets $(O_x, O_y)$ are computed dynamically:
$$S = \min\left(\frac{W}{C + 1}, \frac{H}{R + 1}\right), \quad O_x = \frac{W - (C - 1)S}{2}, \quad O_y = \frac{H - (R - 1)S}{2}$$
Sub-pixel rendering interpolates entity positions during state transition animations via cubic Hermite / ease-in-out polynomial mappings:
$$\text{pos}(t) = P_{\text{from}} + (P_{\text{to}} - P_{\text{from}}) \cdot \left(3t^2 - 2t^3\right), \quad t \in [0, 1]$$
Open Access License: This interactive educational module is released under
CC BY-NC 4.0 (Attribution-NonCommercial)
for non-commercial research, academic study, and clinical education.
Commercial & Enterprise Licensing: For white-labeling, proprietary LMS/course embedding, hardware dashboard telemetry integration, or custom feature engineering, secure a commercial license at
BioniCloud.com or contact
Dr. Yuri Beno.