Talk:Transportation problem: Difference between revisions

Line 19:
 
I have found the function getClosedPath() not easy to understand and semantically a little complex (and bug prone to translate). So can you comment the parts of getClosedPath() to help me write simpler D code, or can you restructure it to make its workings more linear (in D I've used three different 'stones' variables inside it, including a dup-ping)?
: Yes, I was planning to add a comment there, it's not very clear. I think you're supposed to use a breadth-first or depth-first search, but it occurred to me that if you remove all the "stones" that do not have a horizontal AND vertical neighbor (and therefore cannot be corner-stones) you will be left with the stones that form the closed path. (Removing stones is done in a infinite loop because certain stones will only be removed after you've removed another.) Then you have to put the remaining stones in the correct plus-minus order. (See also the link to the stepping stone explanation). [[User:Fwend|Fwend]] ([[User talk:Fwend|talk]]) 21:28, 6 November 2014 (UTC)
Anonymous user