Class: AsciiParadise::StaticPacman
- Inherits:
-
Object
- Object
- AsciiParadise::StaticPacman
- Defined in:
- lib/ascii_paradise/static_ascii/static_pacman.rb
Overview
AsciiParadise::StaticPacman
Constant Summary collapse
- PACMAN_WIDTH =
#
PACMAN_WIDTH
#
12
Instance Method Summary collapse
-
#atan2(a, b) ⇒ Object
# === atan2 ========================================================================= #.
-
#initialize(run_already = true) ⇒ StaticPacman
constructor
# === initialize ========================================================================= #.
-
#return_proper_width ⇒ Object
# === return_proper_width ========================================================================= #.
-
#run ⇒ Object
# === run ========================================================================= #.
Constructor Details
#initialize(run_already = true) ⇒ StaticPacman
#
initialize
#
17 18 19 20 21 |
# File 'lib/ascii_paradise/static_ascii/static_pacman.rb', line 17 def initialize( run_already = true ) run if run_already end |
Instance Method Details
#atan2(a, b) ⇒ Object
#
atan2
#
33 34 35 |
# File 'lib/ascii_paradise/static_ascii/static_pacman.rb', line 33 def atan2(a, b) Math.atan2(a,b) end |
#return_proper_width ⇒ Object
#
return_proper_width
#
26 27 28 |
# File 'lib/ascii_paradise/static_ascii/static_pacman.rb', line 26 def return_proper_width (-PACMAN_WIDTH .. PACMAN_WIDTH) end |
#run ⇒ Object
#
run
#
40 41 42 43 44 45 46 47 48 |
# File 'lib/ascii_paradise/static_ascii/static_pacman.rb', line 40 def run (-10 .. 10).each { |y| _ = ''.dup return_proper_width.each {|x| _ << ( x ** 2 + y ** 2 < 11 ** 2 && atan2(y,x) < Math::PI * 0.8 && atan2(y,x) >- Math::PI * 0.8 && x ** 2+(y+6) ** 2>1 ? '@':' ') * 2 } puts _ } end |