Class: GamesAndRpgParadise::Nut

Inherits:
Object
  • Object
show all
Includes:
Directions_7
Defined in:
lib/games_and_rpg_paradise/games/rubynuts/rubynuts.rb

Constant Summary

Constants included from Directions_7

Directions_7::DIRECTIONS

Instance Method Summary collapse

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

#displayObject

#

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_ccwObject

#

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_cwObject

#

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