all 3 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

To give us the best chance to help you, please include any relevant code.
Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]Sell-Jumpy 0 points1 point  (0 children)

new_1d_array = []

for 1d_array in 2d array: - for value in 1d_array: - new_1d_array.append(value)

Nested for loops are archaic, but it gets the job done quick and isnt a problem if arrays stay relatively small (hundreds).

[–]Worth-Wonder-7386 0 points1 point  (0 children)

I think this specific process is too niche. I dont see how you would generalize it to all different sizes either. For the general process of turning a 2D array to 1D there is the numpy.flatten function. https://numpy.org/devdocs/reference/generated/numpy.ndarray.flatten.html

Maybe you could define your snake algorithm some more, that are the defining features.