home *** CD-ROM | disk | FTP | other *** search
/ Really Useful CD 1 / ReallyUsefulCD1.iso / extras / languages / smalltalk / _smalltalk / tests / plane < prev    next >
Encoding:
Text File  |  1987-12-30  |  2.1 KB  |  66 lines

  1. Class Main
  2. [
  3.      main | i |
  4.           i <- Plane new.
  5.           i init.
  6.           i fly.
  7.           i bomb.
  8. ]
  9. Class Plane
  10. | plane bomb cloud |
  11. [
  12.      init
  13.           plane <- Form new.
  14.           plane row:  1 put: '                    '.
  15.           plane row:  2 put: '   \                '.
  16.           plane row:  3 put: '   |\       --------'.
  17.           plane row:  4 put: '   |\\________/ /___|'.
  18.           plane row:  5 put: '   | -- SU   / /    0'.
  19.           plane row:  6 put: '   <--------/ /-----|'.
  20.           plane row:  7 put: '         --------    '.
  21.           plane row:  8 put: '            rm *'.
  22.           bomb <- 'rm *'.
  23.           cloud <- Form new.
  24.           cloud row:  1 put: '   (  ) )'.
  25.           cloud row:  2 put: ' (  *  )  )'.
  26.           cloud row:  3 put: '( { } ) * )'.
  27.           cloud row:  4 put: ' ( - ) ) )'.
  28.           cloud row:  5 put: '   ( )'.
  29.           ^ plane
  30. |
  31.      bomb           | location bombLocation |
  32.           smalltalk clearScreen.
  33.           'FILES' printAt: 23 @ 60.
  34.           cloud printAt: 1@30.
  35.           location <- 1 @ 1.
  36.           plane printAt: location.
  37.           (1 to: 8) do: [:j |
  38.                location <- j @ (j * 3).
  39.                plane printAt: location].
  40.           plane row: 8 put: '                 '.
  41.           bombLocation <- (location x + 7) @ (location y + 10).
  42.           (7 to: 2 by: -1) do: [:j |
  43.                location <- j @ (location y + 3).
  44.                plane printAt: location.
  45.                '         ' printAt: bombLocation.
  46.                bombLocation <- (bombLocation x + 1) @
  47.                          (bombLocation y + 3).
  48.                bomb printAt: bombLocation ].
  49.           '        ' printAt: bombLocation.
  50.           '*****OPPS*****' printAt: 23 @ 55.
  51.           ' ' printAt: 21 @ 0.
  52. |
  53.      fly            | sky |
  54.           smalltalk clearScreen.
  55.           (10 to: 50 by: 5) do: [:i |
  56.                sky <- Form new.
  57.                sky placeForm: cloud at: 10 @ 40.
  58.                sky overLayForm: plane at: 10 @ i.
  59.                sky printAt: 1 @ 1
  60.                ].
  61.           ' ' printAt: 21 @ 0
  62. |
  63.      display
  64.           plane printAt: 10@10 . '   ' print
  65. ]
  66.