Itangalo / Bot-Playtesting-Toolkit

A toolkit for simulating board games with Google spreadsheets. Intended use is board game development.
GNU General Public License v3.0
9 stars 1 forks source link

Add methods to tracks/spaces to allow more complex movement #15

Closed Itangalo closed 2 years ago

Itangalo commented 2 years ago

It would be nice to have "moveTowards" or "getPathTo" as methods on tracks or (more likely) spaces. This would require that spaces have information about which spaces they connect to. The code would have to include BFS (breadth-first-seach) or A* (A-star) algorithm, or something equivalent.

The code/execution might become heavy, which is worth keeping an eye on.

Itangalo commented 2 years ago

A* algorithm now included, for both finding shortest path and shortest distance between two nodes in a graph.

A question that emerged is whether this more complex movement should be a part of the tracks class, or a board class should be introduced. But "spaces" are used on both, so maybe they should be the same class. Then move will mean "move to the next space in order" while moveTowards(steps, goal) means moving a number of steps towards the set goal. If "goal" is excluded the current set path is used. If set, and it doesn't match the current path, a new path is built and saved.

Or maybe move should mean advance on the set path, and if none is set the trivial order of spaces will be used? Naw, it is probably a bad idea to mix simple movement with complex movement.

Where will the path be saved? Probably on the pawn, not an agent. There could be non-agent pawns, even for complex movement.

Itangalo commented 2 years ago

Done! There will probably be more things later on, but not now.