Answer the question
In order to leave comments, you need to log in
Who can and knows, and also tell you how to use the movement in the triangular polygon mesh in Scratch?
I need to implement movement in a polygon grid of triangles along the vertices and Dijkstra's algorithm.
Here is a field with a chip on it.
I need to walk on the peaks
. How can I do this?
example and step by step explanation.
Answer the question
In order to leave comments, you need to log in
Once you have variables and lists, take the dijkstra code from wikipedia, translate it into these blocks of yours, and here is your dijkstra.
The graph is set very simply: enter the coordinate system - each vertex corresponds to 2 numbers - the number of the line (the horizontal line where it is located) and the number in the line (what order it is there). There will be n vertices on odd lines, and n-1 on even lines.
In the lists of edges for each vertex, add left and right edges (at (x, y+1) and (x, y-1)). Oblique edges must be created differently for vertices with even x and odd x. In the first case it will be (x+-1, y-1), (x+-1, y); in the second - (x+-1, y), (x+-1, y+1);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question