Module: ConsoleTetris::Block

Defined in:
lib/console_tetris/block.rb

Class Method Summary collapse

Class Method Details

.type_i(degree) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/console_tetris/block.rb', line 63

def type_i(degree)
  case degree
  when 0, 180
    [
      [6, 6, 6, 6]
    ]
  when 90, 270
    [
      [6],
      [6],
      [6],
      [6]
    ]
  end
end

.type_j(degree) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/console_tetris/block.rb', line 5

def type_j(degree)
  case degree
  when 0
    [
      [4, 4, 4, 4],
      [0, 0, 0, 4]
    ]
  when 90
    [
      [0, 4],
      [0, 4],
      [0, 4],
      [4, 4]
    ]
  when 180
    [
      [4, 0, 0, 0],
      [4, 4, 4, 4]
    ]
  when 270
    [
      [4, 4],
      [4, 0],
      [4, 0],
      [4, 0]
    ]
  end
end

.type_l(degree) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/console_tetris/block.rb', line 34

def type_l(degree)
  case degree
  when 0
    [
      [7, 7, 7, 7],
      [7, 0, 0, 0]
    ]
  when 90
    [
      [7, 7],
      [0, 7],
      [0, 7],
      [0, 7]
    ]
  when 180
    [
      [0, 0, 0, 7],
      [7, 7, 7, 7]
    ]
  when 270
    [
      [7, 0],
      [7, 0],
      [7, 0],
      [7, 7]
    ]
  end
end

.type_o(degree) ⇒ Object



79
80
81
82
83
84
# File 'lib/console_tetris/block.rb', line 79

def type_o(degree)
  [
    [3, 3],
    [3, 3]
  ]
end

.type_s(degree) ⇒ Object



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/console_tetris/block.rb', line 86

def type_s(degree)
  case degree
  when 0, 180
    [
      [0, 2, 2],
      [2, 2, 0]
    ]
  when 90, 270
    [
      [2, 0],
      [2, 2],
      [0, 2]
    ]
  end
end

.type_t(degree) ⇒ Object



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/console_tetris/block.rb', line 118

def type_t(degree)
  case degree
  when 0
    [
      [5, 5, 5],
      [0, 5, 0]
    ]
  when 90
    [
      [0, 5],
      [5, 5],
      [0, 5]
    ]
  when 180
    [
      [0, 5, 0],
      [5, 5, 5]
    ]
  when 270
    [
      [5, 0],
      [5, 5],
      [5, 0]
    ]
  end
end

.type_z(degree) ⇒ Object



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/console_tetris/block.rb', line 102

def type_z(degree)
  case degree
  when 0, 180
    [
      [1, 1, 0],
      [0, 1, 1]
    ]
  when 90, 270
    [
      [0, 1],
      [1, 1],
      [1, 0]
    ]
  end
end