-
Notifications
You must be signed in to change notification settings - Fork 0
/
Base.js
42 lines (39 loc) · 978 Bytes
/
Base.js
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
class base{
constructor(
forma = [[]]
)
{
this.forma = forma
this.Nivel = this.formar()
}
formar () {
return Array.from(new Array(11), (col,y) =>
Array.from(new Array(9), (fil,x) =>
this.forma[y][x] != null ? (
new lad(x*3*dim + dim, y*dim + dim, colores[this.forma[y][x]], this.forma[y][x])
)
: null
)
)
}
vacio() {
let n = 0;
for (let i = 0; i < alto; i++) {
for (let j = 0; j < ancho; j++) {
if(this.forma[i][j] != 0 && this.forma[i][j] != null){
n++
}
}
}
if(n==0){
return true;
}
return false
}
revelar() {
this.Nivel.forEach(
x => x.filter(
j => j != null).forEach(
Ladrillo => Ladrillo.revelar()))
}
}