You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the level generation is quite random, I'm essentially keep swapping tiles until I get a solved board. I need to find an algorithm that can generate a board without unnecessary tries.
Current algorithm:
generate a checkerboard pattern
swap 2 tiles randomly 100x times
set number of retries to 10k
keep swapping 2 tiles randomly and after every swap check if the number of incorrect fields is decreasing. If not, then undo swapping and decrease number of retries by 1
if we have a solved pattern then we're good to go, else if the number of retries > 0 then goto 4
if there are no more retries and the board is still not solved, then start over by going to 1
This algorithm gets really slow even at as low as 12x12
The text was updated successfully, but these errors were encountered:
Currently the level generation is quite random, I'm essentially keep swapping tiles until I get a solved board. I need to find an algorithm that can generate a board without unnecessary tries.
Current algorithm:
This algorithm gets really slow even at as low as 12x12
The text was updated successfully, but these errors were encountered: