Class: GamesAndRpgParadise::Nut
- Inherits:
-
Object
- Object
- GamesAndRpgParadise::Nut
- Includes:
- Directions_7
- Defined in:
- lib/games_and_rpg_paradise/games/rubynuts/rubynuts.rb
Constant Summary
Constants included from Directions_7
Instance Method Summary collapse
-
#display ⇒ Object
# === display ========================================================================= #.
-
#initialize(n = 2, ne = 2, se = 2, s = 2, sw = 2, nw = 2) ⇒ Nut
constructor
# === initialize ========================================================================= #.
-
#side(x) ⇒ Object
# === side ========================================================================= #.
-
#spin_ccw ⇒ Object
# === spin_ccw ========================================================================= #.
-
#spin_cw ⇒ Object
# === spin_cw ========================================================================= #.
Constructor Details
#initialize(n = 2, ne = 2, se = 2, s = 2, sw = 2, nw = 2) ⇒ Nut
#
initialize
#
28 29 30 31 32 |
# File 'lib/games_and_rpg_paradise/games/rubynuts/rubynuts.rb', line 28 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
#
display
#
37 38 39 40 41 42 43 |
# File 'lib/games_and_rpg_paradise/games/rubynuts/rubynuts.rb', line 37 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
#
48 49 50 |
# File 'lib/games_and_rpg_paradise/games/rubynuts/rubynuts.rb', line 48 def side(x) @nut[x] end |
#spin_ccw ⇒ Object
#
spin_ccw
#
62 63 64 |
# File 'lib/games_and_rpg_paradise/games/rubynuts/rubynuts.rb', line 62 def spin_ccw @nut.push(@nut.shift) end |
#spin_cw ⇒ Object
#
spin_cw
#
55 56 57 |
# File 'lib/games_and_rpg_paradise/games/rubynuts/rubynuts.rb', line 55 def spin_cw @nut.unshift(@nut.pop) end |