Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Casilla final - parte 2 #57

Merged
merged 3 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pilas-bloques-exercises",
"version": "1.4.13",
"version": "1.4.14",
"description": "Exercises for Pilas Bloques",
"homepage": "http://pilasbloques.program.ar",
"author": {
Expand Down
10 changes: 9 additions & 1 deletion src/escenas/libroPrimaria/EscenaDesdeMapa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ abstract class EscenaDesdeMapa extends EscenaActividad {
let nroColumna: number = casilla.nroColumna;
let ids: string[] = mapa[nroFila][nroColumna].split("&");
ids.forEach(id => {
if (id != '' && id != ' ' && id != '-' && id != '_') { // si no es casilla libre
if(id === '+'){
this.guardarPosicionFinal([nroColumna, nroFila])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Queda la última posición que llene como la final si es que en el mapa se cargan más de una.

}else if (id != '' && id != ' ' && id != '-' && id != '_') { // si no es casilla libre
let actor = this.mapearIdentificadorAActor(id, nroFila, nroColumna);
cuadricula.agregarActorEnCasilla(actor, casilla, true);
}
Expand Down Expand Up @@ -497,6 +499,12 @@ class GeneradorDeCasillaNula implements GeneradorDeCasilla {
esAleatorioPara(generador: GeneradorDeMapasAleatorios): boolean { return false; }
}

/** Corresponde a las casillas indicadas con `+`. */
class GeneradorDeCasillaFinal implements GeneradorDeCasilla {
generarSemillaDeCasilla(generador: GeneradorDeMapasAleatorios): SemillaDeCasilla { return new SemillaDeCasilla('+'); }
esAleatorioPara(generador: GeneradorDeMapasAleatorios): boolean { return false; }
}

/** Corresponde al modificador `?` (recursivo). */
class GeneradorDeCasillaMaybe implements GeneradorDeCasilla {
constructor(private generadorInterno: GeneradorDeCasilla, private proba?: number) { }
Expand Down
5 changes: 4 additions & 1 deletion src/gramaticaAleatoria.ne
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ Atom -> Id {% d => new GeneradorDeCasillaSimple(d[0]) %}
| Col {% id %}
| Nil {% id %}
| Void {% id %}
| "(" _ Term _ ")" {% d => d[2] %}
| End {% id %}
| "(" _ Term _ ")" {% d => d[2] %}
Id -> [a-zA-Z0-9]:+ {% d => d[0].join("") %}
Bag -> "$" {% d => new GeneradorDeCasillaBolsa() %}
| "$" _ Id {% d => new GeneradorDeCasillaBolsa(d[2]) %}
Expand All @@ -56,4 +57,6 @@ Macro -> "#" _ Id {% d => new GeneradorDeCasillaMacro(d[2]) %}

And -> Atom _ "&" _ Atom {% d => new GeneradorDeCasillaAnd(d[0], d[4]) %}

End -> "+" {% d => new GeneradorDeCasillaFinal() %}

Void -> "_" {% d => new GeneradorDeCasillaNula() %}
Loading