-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtetromino_i.e
103 lines (83 loc) · 2.27 KB
/
tetromino_i.e
1
2
3
4
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
33
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
note
description : "The I {TETROMINO}."
author : "Louis Marchand"
date : "July 19 2012"
revision : "1.0"
class
TETROMINO_I
inherit
TETROMINO
rename
make as make_tetromino
redefine
default_state,
init_wall_kicks_list
end
create
make,
make_from_other
feature {NONE} -- Initialization
make(l_surface:GAME_SURFACE;block_width,block_height:NATURAL;rotation:BOOLEAN)
-- Initialisation of `Current' using the images on `l_surface' with {BLOCK}
-- of dimension `block_width'x`block_height'.
-- If `rotation' is `True', apply rotation on individual {BLOCK}.
do
make_tetromino(l_surface,1,block_width,block_height,rotation)
y:=21
end
feature -- Access
default_state
-- <Precursor>
do
precursor
y:=21
end
feature {NONE} -- Initialisation
blocks_positions_init:ARRAY[TUPLE[row,column:INTEGER]]
-- <Precursor>
once
Result:=<< [2,1],[2,2],[2,3],[2,4],
[1,3],[2,3],[3,3],[4,3],
[3,4],[3,3],[3,2],[3,1],
[4,2],[3,2],[2,2],[1,2]>>
end
init_wall_kicks_list
-- <Precursor>
local
temp_list:ARRAYED_LIST[TUPLE[x,y:INTEGER]]
do
create {ARRAYED_LIST[LIST[TUPLE[x,y:INTEGER]]]} wall_kicks_list.make(8)
create temp_list.make(5)
temp_list.extend ([0,0])
temp_list.extend ([-2,0])
temp_list.extend ([1,0])
temp_list.extend ([-2,-1])
temp_list.extend ([1,2])
wall_kicks_list.extend (temp_list) -- 0->R
create temp_list.make(5)
temp_list.extend ([0,0])
temp_list.extend ([-1,0])
temp_list.extend ([2,0])
temp_list.extend ([-1,2])
temp_list.extend ([2,-1])
wall_kicks_list.extend (temp_list) -- R->2
create temp_list.make(5)
temp_list.extend ([0,0])
temp_list.extend ([2,0])
temp_list.extend ([-1,0])
temp_list.extend ([2,1])
temp_list.extend ([-1,-2])
wall_kicks_list.extend (temp_list) -- 2->L
create temp_list.make(5)
temp_list.extend ([0,0])
temp_list.extend ([1,0])
temp_list.extend ([-2,0])
temp_list.extend ([1,-2])
temp_list.extend ([-2,1])
wall_kicks_list.extend (temp_list) -- L->0
wall_kicks_list.extend (wall_kicks_list.at (2)) -- 0->L
wall_kicks_list.extend (wall_kicks_list.at (3)) -- R->0
wall_kicks_list.extend (wall_kicks_list.at (4)) -- 2->R
wall_kicks_list.extend (wall_kicks_list.at (1)) -- L->2
end
end