Project Euler 313 - Sliding game

Official link: https://projecteuler.net/problem=313