Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to iterate in recursion?

How to iterate in recursion?

Scheduled Pinned Locked Moved C#
javaalgorithmshelptutorialquestion
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shivamkalra
    wrote on last edited by
    #1

    Hi, Is there any good and easy way to iterate through all the outcomes of recursion? Basically, I've a maze solver algorithm which solves maze instantly and prints the solved maze. I've broken down the code into each recursive call, and I need iterate to through it one by one..like if I press some button, then execution should stop at that point and maze state should be returned to main class and execution should proceed from the same point when I press some button. There is java applet on this website, I need to make one similar to it. [^] Any help would be appreciated. Thanks, Shivam Kalra

    L 1 Reply Last reply
    0
    • S shivamkalra

      Hi, Is there any good and easy way to iterate through all the outcomes of recursion? Basically, I've a maze solver algorithm which solves maze instantly and prints the solved maze. I've broken down the code into each recursive call, and I need iterate to through it one by one..like if I press some button, then execution should stop at that point and maze state should be returned to main class and execution should proceed from the same point when I press some button. There is java applet on this website, I need to make one similar to it. [^] Any help would be appreciated. Thanks, Shivam Kalra

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      The yield keyword and this article[^] might help. :)

      Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

      Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

      S 1 Reply Last reply
      0
      • L Luc Pattyn

        The yield keyword and this article[^] might help. :)

        Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

        Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

        S Offline
        S Offline
        shivamkalra
        wrote on last edited by
        #3

        I know. Is there any way of implementing "yield" on your own?

        L 1 Reply Last reply
        0
        • S shivamkalra

          I know. Is there any way of implementing "yield" on your own?

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          yes, you could do what the compiler does with yield, i.e. save and restore the entire state of the locals of all the nesting levels; it easily becomes quite cumbersome and I can't recommend it. :)

          Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

          Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

          S 1 Reply Last reply
          0
          • L Luc Pattyn

            yes, you could do what the compiler does with yield, i.e. save and restore the entire state of the locals of all the nesting levels; it easily becomes quite cumbersome and I can't recommend it. :)

            Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

            Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

            S Offline
            S Offline
            shivamkalra
            wrote on last edited by
            #5

            Alright. Thanks! :)

            L 1 Reply Last reply
            0
            • S shivamkalra

              Alright. Thanks! :)

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              you're welcome. :)

              Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

              Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups