#!/bin/sh
#
# This is an example of a useful executable mission
# I recommend you stay away from using shells other than 'sh' just to make
# sure that you can give this to someone else (IE, it's standard UNIX).
#
# $$.temp evaluates to <processid>.temp (it should be unique)
#
cat > /tmp/$$.temp  << EOF
level = {
  author = "Aaron Hightower"
  numlives = #numlives
  name = "#name"
  rock = {
    count = 40
    scale = 0.025
    geometry = "fireball"
    maxlifespan = 100
    rock = {
      count = ##
      scale = 0.010
      maxlifespan = 20
      geometry = "fireball"
      speed = 4
    }
  }
  rock = {
    count = 1
    scale = .10
    geometry = "#rock"
    points = ##0
    rock = {
      count = ##0
      scale = 0.050
      maxlifespan = 5
      geometry = "fireball"
      speed = 10
    }
    rock = {
      count = ##
      scale = .05
      geometry = "#rock"
      points = ##00
      rock = {
	count = ##0
	scale = 0.050
	maxlifespan = 5
	geometry = "fireball"
	speed = 3
      }
      rock = {
	count = ##
	scale = .025
	geometry = "#rock"
	points = ##000
      }
    }
  }
}
EOF
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; do
  name="progressive level $i" ;
  count="${i}0" ;
  numlives="0"
  case "$i" in
    '1') numlives="5" ; rock="walker" ;;
    '2') rock="spinstar" ;;
    '3') rock="dodec" ;;
    '4') rock="sgi";;
    '5') rock="Zipper";;
    *)
       rock="shieldwalk"
  esac
  cat /tmp/$$.temp | sed "s/#name/$name/;s/#count/$count/;s/##/$i/;s/#rock/$rock/;s/#numlives/$numlives/"
done
# Make sure if you use this to remove these temporary files
rm -f /tmp/$$.temp
