arXiv2026
In a recreational column of the Scientific American, Martin Gardner presented in 1973 a game called \textsc{Racetrack}, consisting of computing an optimal trajectory for a vehicle on a race circuit, subject to acceleration constraints in discrete space~$\mathbb{Z}^2$. In this model, each step consists of changing the position of the vehicle by a vector in $\mathbb{Z}^2$, with the constraints that two consecutive vectors differ by at most one unit in each dimension. We investigate two problems related to this model in arbitrary dimension in open space (no obstacles), where a \emph{configuration} of the vehicle consists of its current position and the last-used vector (concretely, a value in $\mathbb{Z}^d \times \mathbb{Z}^d$). The two problems are the following. In BRANCHING COST, two configurations are given and the goal is to compute the minimum number of moves (length of a trajectory) between the two configurations. BRANCHING TRAJECTORY has the same input and asks for a description of the trajectory. We obtain various results. First, we revisit known approaches solving BRANCHING COST in 2D, clarifying the analysis and showing that this problem can be solved in constant time in any fixed number of dimensions $d$ (more generally, in $O(d \log d)$ time). We also show that BRANCHING TRAJECTORY can also be solved in constant time for any fixed $d$, despite the fact that the length of the trajectory is not constant. The main ingredient is to show that there always exists \emph{at least one} optimal trajectory that can be compactly represented using only $O(1)$ intermediate configurations, with monotonic evolution between them. Among other uses, the latter implies that computing an optimal trajectory that visits a sequence of $n$ points at prescribed velocities in 2D or 3D can be done in linear time in the number of points.