Re: Recursion
- Posted by Al Getz <Xaxo at aol.??m> Jul 22, 2007
- 529 views
DB James wrote: > > HOWEVER > > - Sometimes it is the most elegant way to do something. > > - Sometimes it is almost spooky in its effectiveness. Here is a paste from > RDS' queens.ex that solves a difficult puzzle: finding all the patterns that > 8 queens can occupy without threatening each other on a chess board... (various snips) > --Quark When i was around 12 or 13 years old i found a way to solve the 8 queens problem in my head. This might sound like a big deal to some people, but actually it wasnt that hard because i found a quick way to do it using another number base system. Anyone can do it using this method. Of course i still think it's a good way to show how computer algos work though, any way you decide to solve it. Here's a hint... The number base system is base 8, and each board column is thought of as a power of 8. > - Sometimes it is almost spooky in its effectiveness. Spooky you say? With the algorithm i was talking about in my previous post (the one that had to calculate something to high accuracy) it was perhaps the first time i saw something that actually resembled emergence on the computer! The solution set seemed to 'emerge' from the input data, and it's so darn accurate it is almost impossible to believe without seeing; really almost spookie. One little function that can call itself...so little code, such a big problem solved! Take care, Al E boa sorte com sua programacao Euphoria! My bumper sticker: "I brake for LED's" From "Black Knight": "I can live with losing the good fight, but i can not live without fighting it". "Well on second thought, maybe not."