The comment in your code asked if we could do it in 600 bytes. Here's my go at it. Excluding the comment, it's 573 bytes.
After launching the game, press a button to scramble the tiles. Use the direction buttons to slide tiles, or press B to exit. The game will detect when the solution is found. After that, press a button to exit.

プレイ済み