Subject: Re: Hanoi Tower
Date: Sat, 5 Apr 1997 11:58:34 -0500
From: Alexander Bogomolny

Hi, Amir:

I am not quite certain what is it you need. I believe the Description on my page is pseudo enough :) Real Java code follows closely this Description:

// real Java code starts

    public void Solve()
    {
        Solution(m_N, m_Src, m_Aux, m_Dst);
    }

    private void Solution(int n, int nSrc, int nAux, int nDst)
    {
        if (n == 0)
            return;

        Solution(n-1, nSrc, nDst, nAux);
        m_Moves.push(new Point(nSrc, nDst)); // use Point(from, to)
        Solution(n-1, nAux, nSrc, nDst);
    }

// real Java code ends

I have nothing below this level. Does it answer your question?

Reards

|Reply| |Up| |Exchange index| |Contents| |Store|

Copyright © 1996-2018 Alexander Bogomolny

71948718