mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-28 21:54:17 -08:00
add 78 sinewave in ruby
This commit is contained in:
15
78 Sine Wave/ruby/sinewave.rb
Normal file
15
78 Sine Wave/ruby/sinewave.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
def intro
|
||||
puts " SINE WAVE
|
||||
CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n\n\n\n\n\n"
|
||||
end
|
||||
|
||||
def main
|
||||
intro
|
||||
(0..40).step(0.25).each do |t|
|
||||
a = (26 + 25 * Math.sin(t)).to_i
|
||||
text = (t % 0.5) == 0 ? "CREATIVE" : "COMPUTING"
|
||||
puts " " * a + text
|
||||
end
|
||||
end
|
||||
|
||||
main
|
||||
Reference in New Issue
Block a user