Skip to content

Commit

Permalink
fix casillas
Browse files Browse the repository at this point in the history
  • Loading branch information
tfloxolodeiro committed Sep 25, 2023
1 parent 4d80aff commit edb205b
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/actores/CuadriculaEsparsa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,20 @@ class CuadriculaEsparsa extends Cuadricula{
});
}

hayDerecha(casilla){
/*Devuelve true sii existe una casilla
a la inmediata derecha de la casilla */
return this.casilla(casilla.nroFila,casilla.nroColumna+1)!=undefined;
hayDerecha(casilla: Casilla){
return this.matriz[casilla.nroFila][casilla.nroColumna+1] == 'T'
}

hayIzquierda(casilla){
return this.casilla(casilla.nroFila,casilla.nroColumna-1)!=undefined;
hayIzquierda(casilla: Casilla){
return this.matriz[casilla.nroFila][casilla.nroColumna-1] == 'T'
}

hayAbajo(casilla){
return this.casilla(casilla.nroFila+1,casilla.nroColumna)!=undefined;
hayAbajo(casilla: Casilla){
return this.matriz[casilla.nroFila+1] !== undefined && this.matriz[casilla.nroFila+1][casilla.nroColumna] == 'T'
}

hayArriba(casilla){
return this.casilla(casilla.nroFila-1,casilla.nroColumna)!=undefined;
hayArriba(casilla: Casilla){
return this.matriz[casilla.nroFila-1] !== undefined && this.matriz[casilla.nroFila-1][casilla.nroColumna] == 'T'
}

}

0 comments on commit edb205b

Please sign in to comment.