Final Project Code

Brick 1 Code

global [winner]


to library
      when [switch 7] [repeat 3 [a, onfor 20 rd win-sound] setwinner (winner + 1)]
end

to fly-doves
      when [switch 8] [b, onfor 60 win-sound setwinner (winner + 1)]
end

to science
      when [switch 9] [c, onfor 25 rd win-sound setwinner (winner + 1)]
end

to pinball
      initialize
     library
      fly-doves
     science
      when [winner = 10] [d, onfor 230 graduationsong stoprules pinball]
end

to initialize
      setwinner 0
end

to test
      onfor 50
end

to graduationsong
      note 81 4 wait 1
      note 80 2 wait 1
      note 81 2 wait 1
      note 83 2 wait 1
      note 78 6 wait 1
      note 76 4 wait 2
      note 74 4 wait 1
      note 73 2 wait 1
      note 74 3 wait 1
      note 76 2 wait 1
      note 71 6 wait 4
      note 73 6 wait 1
      note 73 2 wait 1
      note 73 2 wait 1
      note 74 2 wait 1
      note 76 4 wait 2
      note 73 4 wait 1
      note 69 4 wait 1
      note 74 4 wait 2
      note 74 2 wait 2
      note 74 2 wait 1
      note 73 2 wait 1
      note 71 2 wait 2
      note 69 4 wait 2
end

to win-sound
      note 38 1
      note 49 1
      note 62 1
      note 70 1
      note 79 1
      note 89 1
      note 94 1
      note 105 1
      note 119 2
end

to lose-sound
      note 38 1
      note 38 1
      note 30 3
end

Brick 2 Code


to chime
      when [switch 7] [a, repeat 4 [onfor 10 rd] win-sound]
end

to bus
      when [(sensor 0) > 20] [b, onfor 30 lose-sound]
end

to pinball2
      chime
      bus
end

to lose
      when [switch 8] [lose-sound] end

to win-sound
      note 38 1
      note 49 1
      note 62 1
      note 70 1
      note 79 1
      note 89 1
      note 94 1
      note 105 1
      note 119 2
end

to lose-sound
      note 38 1
      note 38 1
      note 30 3
end

 

 

Back to Main Page