Perl: the Markov chain saw | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I am being flooded with uninitialized value warnings for lines 52 ... Let's start with this one: your previous loop (which I visualize as "looking to the left") is working ok. In that case, you are testing visibility of $row[$current][$i], and looking at the tree $counter to the left of it as $counter ranges from 1 to $i. So you check from $row[$current][$i - 1] down to $row[$current][0]. In this loop (which I visualize as "looking to the right") you want to check each tree $counter to the right, so you should end up ranging from row[$current][$i + 1] to If you fix that error, it should then be obvious what you need to do to fix the remaining two loops, and I think it is possible you'll even get the correct answer. When you do, I would love for you to come back with your finished code - I'd like to give you tips on how to improve the code, but I don't want to spoil the fun and learning experience of solving the problem first. :) Update 2022-12-13 19:06: correct index from 99 to 98 In reply to Re: Uninitialized warnings trouble
by hv
|
|