Class: Nut
- Inherits:
-
Object
- Object
- Nut
- Includes:
- Directions_7
- Defined in:
- lib/games_paradise/rubynuts/rubynuts.rb
Constant Summary
Constants included from Directions_7
Instance Method Summary collapse
- #display ⇒ Object
-
#initialize(n = 2, ne = 2, se = 2, s = 2, sw = 2, nw = 2) ⇒ Nut
constructor
# === initialize ========================================================================= #.
-
#side(x) ⇒ Object
# === side ========================================================================= #.
- #spin_ccw ⇒ Object
-
#spin_cw ⇒ Object
# === spin_cw ========================================================================= #.
Constructor Details
#initialize(n = 2, ne = 2, se = 2, s = 2, sw = 2, nw = 2) ⇒ Nut
#
initialize
#
21 22 23 24 25 |
# File 'lib/games_paradise/rubynuts/rubynuts.rb', line 21 def initialize( n = 2, ne = 2, se = 2, s = 2, sw = 2, nw = 2 ) @nut = [n, ne, se, s, sw, nw] end |
Instance Method Details
#display ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/games_paradise/rubynuts/rubynuts.rb', line 27 def display ee " _____ \n" ee " / #{@nut[N]} \\ \n" ee " / #{@nut[NW]} #{@nut[NE]} \\ \n" ee " \\ #{@nut[SW]} #{@nut[SE]} / \n" ee " \\__#{@nut[S]}__/ \n" end |
#side(x) ⇒ Object
#
side
#
38 39 40 |
# File 'lib/games_paradise/rubynuts/rubynuts.rb', line 38 def side(x) @nut[x] end |
#spin_ccw ⇒ Object
48 49 50 |
# File 'lib/games_paradise/rubynuts/rubynuts.rb', line 48 def spin_ccw @nut.push(@nut.shift) end |
#spin_cw ⇒ Object
#
spin_cw
#
45 46 47 |
# File 'lib/games_paradise/rubynuts/rubynuts.rb', line 45 def spin_cw @nut.unshift(@nut.pop) end |