Dec-16-2019, 08:25 PM
I am looking for the name of an algorithm if one exists, or something to read as an answer to this question.
I am writing a video game and I need to keep all background processes to a minimum so I am looking for a method of solving this goal that is as optimized as possible.
I have list of lists that forms a 2D grid of numbers like this
The tile must be touching on the top, bottom, left, or right. Diagonals do not touch.
So there are 5 shapes, horizontal 2, horizontal 3, vertical 2, vertical 3, and elbow bend 3.
The final result should be a list of lists containing 2 or 3 values each.
Is there an algorithm or search pattern already designed that will minimize the amount of processing necessary create a complete output list?
I am writing a video game and I need to keep all background processes to a minimum so I am looking for a method of solving this goal that is as optimized as possible.
I have list of lists that forms a 2D grid of numbers like this
Output:3, 4, 4, 5, 4, 4
5, 2, 2, 3, 3, 4
3, 4, 4, 4, 4, 3
4, 3, 4, 2, 2, 4
5, 4, 5, 5, 3, 3
5, 2, 5, 5, 2, 2
5, 3, 5, 3, 4, 2
5, 4, 3, 3, 4, 2
I need to find every combination of neighbors in groups of 2 and in groups of 3.The tile must be touching on the top, bottom, left, or right. Diagonals do not touch.
So there are 5 shapes, horizontal 2, horizontal 3, vertical 2, vertical 3, and elbow bend 3.
The final result should be a list of lists containing 2 or 3 values each.
Is there an algorithm or search pattern already designed that will minimize the amount of processing necessary create a complete output list?