1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Request Make TreeBot treat null children properly

Discussion in 'Client & Site Suggestions' started by Savior, Feb 15, 2017.

  1. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    TreeBot shouldn't throw an UnsupportedOperationException if a child of a branch is null, in trees of graph theory, not having a right or left subtree is legal too.
    If failureTask() returns null as an example, it should be obvious that the respective branch simply has no failure task.
    So if a child is null i would suppose it getting treated as an empty leaf instead.
     
  2. Defeat3d

    Defeat3d Primate

    Joined:
    Oct 30, 2014
    Messages:
    3,073
    Likes Received:
    1,895
    Support!
     
    Savior likes this.
  3. Infinite Inferno

    Infinite Inferno The Pip Collector

    Joined:
    Sep 14, 2014
    Messages:
    445
    Likes Received:
    122
    Support!
     
    Savior likes this.
  4. Gengsta

    Gengsta Community Manager

    Joined:
    Apr 7, 2015
    Messages:
    1,392
    Likes Received:
    763
    Great suggestion Savior. Support!
     
  5. Defeat3d

    Defeat3d Primate

    Joined:
    Oct 30, 2014
    Messages:
    3,073
    Likes Received:
    1,895
  6. chris121

    Joined:
    May 27, 2016
    Messages:
    745
    Likes Received:
    126
    rejected and closed not for further discussion
     
  7. qverkk

    Joined:
    Sep 22, 2015
    Messages:
    1,603
    Likes Received:
    381
    Need an support, i'll adc
     
  8. A Savage

    A Savage The Führer

    Joined:
    Feb 6, 2017
    Messages:
    237
    Likes Received:
    149
    I'm mid fuck off.
     
  9. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    can this please not get hijacked into a fucking lol thread
     
    Qosmiof2 likes this.
  10. Glitch_

    Glitch_ bored

    Joined:
    Feb 11, 2017
    Messages:
    21
    Likes Received:
    6
    Why not just return the root Branch? It's the equivalent of an empty leaf..
     
  11. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    Because its a tree
     
  12. Wet Rag

    Wet Rag easily triggered ✌

    Joined:
    Dec 31, 2015
    Messages:
    4,457
    Likes Received:
    1,695
    when your thread turns into a shit fest
     
  13. Glitch_

    Glitch_ bored

    Joined:
    Feb 11, 2017
    Messages:
    21
    Likes Received:
    6
    Is there something I'm missing here? createRootBranch --> custom extension of RootBranch ... bot runs into empty leaf -> return your RootBranch to restart.

    is there an issue with doing it that way (minus not having the delay)
     
  14. Party

    Party Client Developer

    Joined:
    Oct 12, 2015
    Messages:
    3,708
    Likes Received:
    1,606
    That's not the issue he's getting at.
     
  15. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,216
    Likes Received:
    1,043
    By linking back to your root, you'll create a cycle, which you don't really want to do. I assume it was done the way it is to try to encourage authors to balance the tree rather than having one which is heavily weighted to a side.
     
  16. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    Got the point, but i suppose devs are just using an empty leaf task instead.
     
  17. Glitch_

    Glitch_ bored

    Joined:
    Feb 11, 2017
    Messages:
    21
    Likes Received:
    6
    Code (Text):
    1. LeafTask emptyLeaf = new LeafTask() {@Override public void execute() {});
    Easiest way if you haven't already, instead of making new class.
     
  18. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    Yeah thank you i know how to make an empty LeafTask, but my point is using a leaftask that does nothing is pretty much equivalent to a null child, which should get represented as null. In a tree you wouldnt want any nodes with null as content, but rather let the node itself be null.
     
  19. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,216
    Likes Received:
    1,043
    Tbh I'm torn each way, although I am leaning towards allowing null sub-nodes... @Party @Cloud opinions?
     
  20. Party

    Party Client Developer

    Joined:
    Oct 12, 2015
    Messages:
    3,708
    Likes Received:
    1,606
    I'm the opposite, I wouldn't mind the idea but I'm definitely leaning in favour of restriction. In my opinion if you're going to have a branch with a null sub-node, that branch should be replaced by a leaf.
     

Share This Page

Loading...