Jump to content

recursive function

- - - - -

  • Please log in to reply
1 reply to this topic

#1
reference

reference

    Newbie

  • Members
  • Pip
  • 1 posts
Hello,
I'm building a project in C #, and has a recursive function that builds a tree moves. Every time she goes looking for a move possible. If there is a current move builds, defines and assigns a new place for another type of course and so on.
CLASS Xia move is a lot of features like matrix that preserves the appearance of the board, etc.
The problem is that it branched tree very quickly and have a computer memory problem and the project can not run,

Does anyone have a solution to this thing?
(I think to write to a file at any time the data tree instead of keeping them in CLASS problem opening and closing of files very slow pace so I thought to add TREADS. It can help??)
Thanks.

#2
Momerath

Momerath

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 242 posts
This is a common problem with developing game software that uses a tree for moves. One way to solve it is to provide a cutoff to the look-ahead method that stops developing moves after a specific depth of the tree is reached. Without knowing more about your application it's not possible to suggest other tree pruning methods (or even if tree pruning will help).

If you are going the file storage route, using threads and a routine that maintains the 'next' object to get would help some.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users