Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Convict@Large

Function Tree Notation

This topic is 5556 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been reading the interesting article on this site about "Application of Genetic Programming to the 'Snake Game'" in the AI section: http://www.gamedev.net/reference/articles/article1175.asp I can follow most of it but I am having trouble understanding the notation that the author uses for showing the function trees of the varous solutions that were generated (this is the solution for the zig-zagger from the results section): (ifFoodAhead (ifDangerLeft (right )(ifDangerRight (1forward )(ifDangerAhead (left )( 1forward )))) (ifDangerAhead (ifDangerLeft (right )(left )) (ifDangerLeft (ifDangerRight (forward )( 2right )) (progn2 (left )(right ))))) I understand that it is a tree of functions, like the usually 'tree' used in computing: R |1 2 /|3 4 5 But how do you tell from the notation above which branch is which? Cheers, Convict@Large PS: ack can't get any indenting to work [edited by - convict@large on March 5, 2003 4:35:43 AM] [edited by - convict@large on March 5, 2003 4:36:02 AM]

Share this post


Link to post
Share on other sites
Advertisement
Tree was ment to be:

R
/ \
1 2
/|\
1 2 3


Edit: Please use the 'code' tag for overriding the auto formatting of the forum, Timkin.

[edited by - Timkin on March 5, 2003 6:39:34 PM]

Share this post


Link to post
Share on other sites
The code is built with nested function-calls, each taking two arguments, and returning true or false.

The first ifFoodAhead is the tree root, and every function call branch left and right with the first and second argument.

The leafs of the tree are the actions: left, right, forward.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!