[r109] Recursion bug

0 favourites
  • 3 posts
From the Asset Store
Match same tiles with each other as fast as you can and earn more score during a limited time!
  • Hi,

    I've been playing around with recursion to test the new function feature.

    Building a simple factorial function works fine

    +Function: On "factorial"
        + Function: parameter 0 > 1
            -> return Function.Param(0)*Function.Call("factorial",Function.Param(0)-1)
        + Else
            -> return 1[/code:2kjajkjt]
    
    But then I wanted to test a recursive backtrack for generating a 2D maze.
    And there's a js bug.
    
    So here's the capx (it's the dig() function)
    [url=https://app.box.com/s/ygapi1fe12hvikra6ql2]maze.capx[/url]
    
    Also, when you change global/local variable names, the parameters in the function call don't get updated, I ended up with a crash and an invalid capx at some point.
    
    Also, parameter 0 > 1  feels weird somehow, maybe parameter[0] or parameter(0) would be betterYann2012-11-09 19:41:38
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I think this is fixed in the next build (same issue as other thread). I also fixed the fact local non-static variables would share their values across all levels of recursion, like global variables - from the next build now their values also work independently in each call.

  • cool thanks (:

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)