Untitled
unknown
plain_text
8 months ago
2.2 kB
5
Indexable
class Persistence{ model = []; pushElement(elemnt){ this.model.push(elemnt); } getModel(){ return this.model; }; free(){ this.model = [] } } class Umano{ constructor( stanchezzaFisica, stanchezzaMentale, interesse, disinteresse, distrazioni, sonnoPerso){ this.stanchezzaFisica = stanchezzaFisica; this.stanchezzaMentale = stanchezzaMentale; this.interesse = interesse; this.distrazioni = distrazioni; this.sonnoPerso = sonnoPerso } getIterStatus(){ return [ this.stanchezzaFisica, this.stanchezzaMentale, this.interesse, this.distrazioni, this.sonnoPerso ] } ioC(StatusManager){ this.statusmanager =new StatusManager(this.getIterStatus()); } randomizeStatus(){ this.stanchezzaFisica = Math.random() * 100; this.stanchezzaMentale = Math.random() * 100; this.interesse = Math.random() * 100; this.distrazioni = Math.random() * 100; this.sonnoPerso = Math.random() * 100; } updateSelf(vlore){ this.statusmanager.update(value); }; getStatus(){ return { "stanchezzaFisica":this.stanchezzaFisica, "stanchezzaMentale":this.stanchezzaMentale, "interesse":this.interesse, "distrazioni":this.distrazioni, "sonnoPerso":this.sonnoPerso } }; } class StatusManager{ constructor(statusList){this.statuslist = statusList} update(value){}; } class Add extends StatusManager{ constructor(){ super( ); } update(value){ this.statusList.foreach((element)=>{element += value}); return statusList; }; } class Subtract extends StatusManager{ constructor(){ super( ); } update(value){ this.statusList.foreach((element)=>{element -= value}); return statusList; }; } class Day{ curvaStato=[] Day( StatoUmano ){ this.ora = 0; this.statoumano = StatoUmano; } nextTime(valore){ this.ora += 1; this.statoumano.updateSelf(valore); } class Mount{ days = []; constructor(Day,Persistence){ this.day = Day; this.persistence = Persistence; } registDay(numberOfDay){ for(let d = 0; d < numberOfDay; i++){ days.push(this.day); } } saveDay(){ this.persistence.pushElement(this.days); } startMount(){ /*algoritmo di timeskeep*/ /*ritorno model per creare il grafico*/ }
Editor is loading...
Leave a Comment