using MrGameEng.Pathfinding; namespace MrGameEng.Pathfinding.Tests; /// Грид из строк: '#' — стена, '.' — клетка с ценой 1, '2'..'9' — клетка с этой ценой. public sealed class TestGrid : IPathGrid { private readonly string[] _rows; public TestGrid(params string[] rows) => _rows = rows; public int Width => _rows[0].Length; public int Height => _rows.Length; public bool IsPassable(int x, int y) => _rows[y][x] != '#'; public float Cost(int x, int y) { var cell = _rows[y][x]; return cell is >= '2' and <= '9' ? cell - '0' : 1f; } }