4:46 I meant to say "the lowest number" or "the smallest number", not "the shortest number".
I didn't have time to explain this, but we can be sure that, once we've finished with a square (colored it orange in the video), we definitely have the shortest path to that square.
There are three types of squares:
Squares with no number (we haven't found any path to it yet)
Squares with a black number (we've found a path to it, but we're not yet sure it's the shortest)
Squares with an orange number (we've found a path, and we're sure it's the shortest path);.
We pick the smallest black number, or one of the equal smallest.
We can't make a shorter path to it from an orange number, because we only color a number orange once we've worked out paths to all its neighbors.
We can't make a shorter path to it from another black square, because their number is at least equal to this square's number, and we would have to increase it (by at least 10 in this case) to make the path.
We can't make a shorter path to it from a square with no number, because once it gets a number, it will be higher than the smallest existing number, and this square has the smallest existing number.
So once we check all its neighbors to see if we can reduce their number, we can color the number orange, certain that there is no shorter path we've missed.
https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm
Download the files: https://gamebookgenerator.itch.io/lmag
Twine: https://twinery.org
Graphics in the program are from 32rogues: https://sethbb.itch.io/32rogues
SugarCube documentation: https://www.motoslave.net/sugarcube/2/docs/
Image: https://www.reddit.com/r/CoolSciFiCovers/comments/1wbia4h/virgin_planet_and_star_ways_by_poul_anderson/
#twine #game #games #gamedev #gamedesign #gamebook #crpg #rpg #gaming #programming #retrogames
Дата на публикация: 10 септември, 2026
Категория:
Друго