A puzzle solver