Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Re: Triangle Golf

by petral (Curate)
on Apr 25, 2001 at 21:15 UTC ( #75542=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    #!/usr/local/bin/perl -ln0777
      print " " x (40 - ($c = 1 + length $1) / 2), $1
  2. or download this
                                        a a a 
                          words only on spaces or new lines 
  3. or download this
    > perl -ln0777we '$c=0;s/\s+/ /sg;print" "x(40-($c=length$1)/2),$1 whi
    +le s/(.{$c,}?. |.+$)//' a.txt w.txt
                                          a a 
  4. or download this
    > perl -ln0777e's/\s+/ /sg;print$"x(40-($c=length$&)/2),$&while s/.{0$
    +c,}?. |.+$//' a.txt w.txt
                                          a a 
                                    a a a a a a a a 
                                       a a a a a 

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://75542]
[Eily]: the demonstration itself is fairly easy. The number of paths on a node is the sum of the numbers of paths to the two nodes above (or one node above on the edges of the triangle)
[Eily]: since the value of a node is also the sum from the two nodes above, you just have to demonstrate that the equality is true at the top of the triangle
[Discipulus]: yes Eily, thanks oiskuu but i dont get it.. ;=( maybe I'll ask a SOPW
[LanX]: all combinations with same amount of left and right?
[Eily]: if you want to store in a structure with the coordinates as key, arrays might do, since the keys are going to be 0..n
[LanX]: (Pascale path)
[Eily]: paths like that
[Discipulus]: yes Eily++ (very keen) I want to integrate my project with a 17th experiments. I want to colorize in sequence all paths
[oiskuu]: Yeah, modifry the recursive func combinations() to return not the number, but the paths themselves.
[Eily]: Discipulus I'd do that by starting from the bottom node I think. That way it can inherit the paths from the two nodes above (and so on, recursively)

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2018-03-19 11:18 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (239 votes). Check out past polls.