Simple implementation of fifteen-puzzle (term-based)