Skip to content

Commit

Permalink
Merge pull request #50 from Program-AR/ContandoManic
Browse files Browse the repository at this point in the history
Mañic contando astros
  • Loading branch information
asanzo authored Oct 3, 2023
2 parents fb18cbd + c96c8eb commit e60c029
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 2 deletions.
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.4",
"version": "1.4.5",
"description": "Exercises for Pilas Bloques",
"homepage": "http://pilasbloques.program.ar",
"author": {
Expand Down
Binary file added src/assets/casilla.manic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/casillafin.manic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/casillainicio.manic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions src/escenas/ContandoDeNuevoManic.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/// <reference path="ContandoPlanetasYEstrellas.ts"/>

class ContandoDeNuevoManic extends ContandoPlanetasYEstrellas {
automata;

iniciar(){ // TODO: DEMASIADO SELF MODIFICATION E INTROSPECTION
super.iniciar();
this.tableros.largoFila = new Tablero(0, 210, { texto: "Largo Columna Actual" , atributoObservado: 'largoColumnaActual2'});

Trait.toObject(Observado, this.automata);
this.automata.largoColumnaActual2 = function(){ return this.largoColumnaActual() - 1;};
this.automata.registrarObservador(this.tableros.largoFila);
this.automata.setCasillaActualViejo = this.automata.setCasillaActual;
this.automata.setCasillaActual = function (c,m){
this.setCasillaActualViejo(c,m);
this.changed();
}
this.automata.changed();
}
cambiarImagenesFin() {
//No hace nada
}
}
49 changes: 49 additions & 0 deletions src/escenas/ContandoPlanetasYEstrellas.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/// <reference path = "EscenaActividad.ts" />
/// <reference path="../actores/CuadriculaMultiple.ts"/>
/// <reference path="../actores/segundoCiclo/Manic/Estrella.ts"/>
/// <reference path="../actores/segundoCiclo/Manic/Planeta.ts"/>
/// <reference path="../actores/segundoCiclo/Manic/Manic.ts"/>
/// <reference path="../actores/Tablero.ts"/>


class ContandoPlanetasYEstrellas extends EscenaActividad {
fondo;
cuadricula : CuadriculaMultipleColumnas;
tableros;

iniciar() {
this.fondo = new Fondo('fondo.manic.png',0,0);
this.cuadricula = new CuadriculaMultipleColumnas(
new DefinidorColumnasRandom(5, 6),
0, -45,
{ separacionEntreCasillas: 5 },
{ alto: 40, ancho: 40, grilla: 'casilla.manic.png', cantColumnas: 1 })
this.cuadricula.cambiarImagenInicio('casillainicio.manic.png');
this.cambiarImagenesFin();

this.cuadricula.completarConObjetosRandom(new ConjuntoClases([Planeta, Estrella]),
{condiciones:[
(casilla) => casilla.hayArriba(), //no incluye en primera fila
(casilla) => casilla.hayAbajo() //no incluye en ultima fila
]}
);

this.automata = new Manic();
this.cuadricula.agregarActorEnPerspectiva(this.automata, 0, 0);
this.automata.escala *= this.escalaSegunCuadricula(2);

this.tableros = {};
this.tableros.Planeta = new Tablero(150,210,{texto:"Planetas"});
this.tableros.Estrella = new Tablero(-150,210,{texto:"Estrellas"});
}

cambiarImagenesFin(){
this.cuadricula.cambiarImagenFin('casillafin.manic.png');
}

estaResueltoElProblema(){
return this.cantidadObjetosConEtiqueta('Planeta') === this.tableros.Planeta.dameValor() &&
this.cantidadObjetosConEtiqueta('Estrella') === this.tableros.Estrella.dameValor();
}

}

0 comments on commit e60c029

Please sign in to comment.