Mais um blog inútil.

Abril 13, 2009

A minha arvorezeca em tcl ;]

Filed under: Arvorezinha,Coding — madinfo @ 18:54

by Juvenal

 #!/usr/bin/env tclsh
 set chars 40
 set bottom 4
 set bott 4
 set s " "
 set f *
 proc repeat {a b} {return [string repeat $a $b]}
 for {set a 1;set b [expr ($chars / 2)*2];set x $bott;set y [expr ($chars - $bottom)+1]} {$a < = $chars||$x>1} {incr a 1;incr b -1} {
  if {$a< =$chars} {set z [repeat $f $a];puts [repeat $s $b]$z$z} {
   set z [repeat $f $bottom];puts [repeat $s $y]$z$z;incr x -1
  }
 }

2 comentários a “A minha arvorezeca em tcl ;]”

  1. plastik diz:

    Pega em Python:

    i = 0
    ast = "*"
    while i < 5:
    print ast
    ast += "*"
    i += 1

    Abraço

  2. nifan diz:

    Já agora em powershell :D

    echo "Arvorezinha"; foreach($i in 1..5) {"*"*$i};

Leave a Reply for plastik

widgeon
widgeon
widgeon
widgeon