From: Sander Land Date: 2006-08-14T05:34:21+09:00 Subject: Re: [Solution] [QUIZ] Pen and Paper (#90) My solution also uses the Warnsdorff heuristic (moving to the square with the least amount of possible moves left). It works very well for sizes under 100 or so, gets worse after that and starts taking hundreds of tries at about n=175. I also included an option to see how long tours are starting from each square (give the script any second parameter to show this). This shows how well (or poor) the algorithm works for that size, but it's obviously quite slow for larger sizes as it runs the algorithm for every square. Pastie link: http://pastie.caboo.se/8427 Code: module Enumerable def x(enum) # Cartesian product map{|a| enum.map{|b| [a,b].flatten }}.inject([]) {|a,b| a+b} end def **(n) # Cartesian power if n == 1 self else self.x(self**(n-1)) end end end module OpenStructable def method_missing(method,*args) (class<