Java simulation of a sliding tile puzzle