Re: Hanoi Tower programming challenge...

2012-07-19 Thread Geoff Canyon
Just for kicks I memo-ized this with a local variable. It dramatically reduces the level of recursion and speeds up the calculation for large towers. For example, calculating a twenty-disk tower goes from over 2,000,000 calls to tower() to 109, and the time is less than 1/3. I'm actually surprised

Re: Hanoi Tower programming challenge...

2012-07-19 Thread Jim Hurley
> > Message: 25 > Date: Thu, 19 Jul 2012 16:37:03 -0700 > From: Bob Sneidar > To: How to use LiveCode > Subject: Re: Hanoi Tower programming challenge... > Message-ID: > Content-Type: text/plain; charset=us-ascii > > I just read up on this. Honestly, if someone had ask

Re: Hanoi Tower programming challenge...

2012-07-19 Thread Alex Tweedly
Here I go - replying to my own posting. Silly me Q: What happens when a function reaches the "end" statement ? A: It returns "empty" So we are basically down to 3 lines !! (with even more line wraps) on mouseUp ask "How many disks are there?" put tower (it , "A", "B" , "C") into field

Re: Hanoi Tower programming challenge...

2012-07-19 Thread Bob Sneidar
I just read up on this. Honestly, if someone had asked me to come up with a programmatical solution to this physical problem, I could not do it to save my life. I don't know why. I consider myself to be fairly intelligent, but I cannot turn physical problems like this into a formula. I stumble

Re: Hanoi Tower programming challenge...

2012-07-19 Thread Alex Tweedly
Sorry if this is a duplicate - I think the original got caught because I sent it from the wrong address you can save 2 lines by using a function rather than a handler (watch for line wraps) on mouseUp ask "How many disks are there?" put tower (it , "A", "B" , "C") into field 1 end

Re: Hanoi Tower programming challenge...

2012-07-19 Thread Colin Holgate
> > >How about this? I think this is the classic recursive solution. > That looked good, and works in Director too. Given that you can call it from the message box (or message window in the case of Director), and Director doesn't need the 'end' part for handlers, it can be as short as this:

Re: Hanoi Tower programming challenge...

2012-07-19 Thread Björnke von Gierke
Showing stuff on screen in LC is always surprisingly code intensive, So text only approaches probably win here. Here's a C code that I transcribed into LC, because I'm lazy and everyone knows that c is the laziest language of them all ;) Also I'm amused by all the old geezer complaining that th

Re: Hanoi Tower programming challenge...

2012-07-19 Thread Jim Hurley
> > Message: 17 > Date: Wed, 18 Jul 2012 22:22:59 -0400 > From: Colin Holgate > To: How to use LiveCode > Subject: Hanoi Tower programming challenge... > Message-ID: <65c1b2bf-d4a1-460f-a362-afdedccec...@verizon.net> > Content-Type: text/plain; charset=us-ascii >

Re: Hanoi Tower programming challenge...

2012-07-18 Thread Dar Scott
On Jul 18, 2012, at 8:22 PM, Colin Holgate wrote: > In another tool's email list there is a thread going on about how it was > possible to solve the Hanoi Tower puzzle in under 20 lines. Without getting > too crazy it was possible to solve the problem in 16 lines of code. With a > little crazi

Re: Hanoi Tower programming challenge...

2012-07-18 Thread Mark Wieder
Colin- Wednesday, July 18, 2012, 7:50:10 PM, you wrote: > I liked your mixture of top and bottom posting… Eh? > The JavaScript solution on the other email list was 13 lines > long. My hope is that LiveCode would have both a shorter and more > readable solution. Since javascript doesn't require

Re: Hanoi Tower programming challenge...

2012-07-18 Thread Colin Holgate
I liked your mixture of top and bottom posting… The JavaScript solution on the other email list was 13 lines long. My hope is that LiveCode would have both a shorter and more readable solution. ___ use-livecode mailing list use-livecode@lists.runrev.

Re: Hanoi Tower programming challenge...

2012-07-18 Thread Mark Wieder
Colin- Wednesday, July 18, 2012, 7:22:59 PM, you wrote: > In another tool's email list there is a thread going on about how > it was possible to solve the Hanoi Tower puzzle in under 20 lines. > Without getting too crazy it was possible to solve the problem in 16 > lines of code. With a little cr

Hanoi Tower programming challenge...

2012-07-18 Thread Colin Holgate
In another tool's email list there is a thread going on about how it was possible to solve the Hanoi Tower puzzle in under 20 lines. Without getting too crazy it was possible to solve the problem in 16 lines of code. With a little craziness it could be done in 13 lines. Assuming you have any id