summaryrefslogtreecommitdiff
path: root/share/hackvr/examples/fib.sh
blob: c1d87aba6902405e48bc7e5a272de1c8b1d64b14 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
z=0
a=1
b=1

for i in $(seq 1 10);do
  if [ $[$i % 2] = 0 ];then
    x=$[$z]
    y=0
  else
    x=0
    y=$[$z]
  fi

  w=$a
  h=$a

  echo fib_$a addshape 2 4 $x $y 0 $[$x+$w] $y 0 $[$x+$w] $[$y+$h] 0 $x $[$y+$h] 0
  z=$a
  s=$[$a+$b]
  a=$b
  b=$s

done