zwischenspeicherung - fast der gesamte Aufbau ist nun Klassen-frei

This commit is contained in:
Christian Fraß 2018-03-20 22:39:00 +01:00
parent d407b04bd3
commit 6012730288
18 changed files with 1777 additions and 1622 deletions

View file

@ -64,14 +64,13 @@ ${dir_erzeugnis}/vtm.js: \
${dir_quelldatein}/aufbau/stelle.ts \ ${dir_quelldatein}/aufbau/stelle.ts \
${dir_quelldatein}/aufbau/zustand.ts \ ${dir_quelldatein}/aufbau/zustand.ts \
${dir_quelldatein}/aufbau/figur.ts \ ${dir_quelldatein}/aufbau/figur.ts \
${dir_quelldatein}/aufbau/aktoren/aktor.ts \
${dir_quelldatein}/aufbau/aktoren/erzeuger.ts \ ${dir_quelldatein}/aufbau/aktoren/erzeuger.ts \
${dir_quelldatein}/aufbau/aktoren/annehmer.ts \ ${dir_quelldatein}/aufbau/aktoren/annehmer.ts \
${dir_quelldatein}/aufbau/aktoren/verwerfer.ts \ ${dir_quelldatein}/aufbau/aktoren/verwerfer.ts \
${dir_quelldatein}/aufbau/aktoren/befoerderer.ts \ ${dir_quelldatein}/aufbau/aktoren/befoerderer.ts \
${dir_quelldatein}/aufbau/aktoren/schreiber.ts \ ${dir_quelldatein}/aufbau/aktoren/schreiber.ts \
${dir_quelldatein}/aufbau/aktoren/leser.ts \ ${dir_quelldatein}/aufbau/aktoren/leser.ts \
${dir_quelldatein}/aufbau/aktoren/aktor_.ts \ ${dir_quelldatein}/aufbau/aktoren/aktor.ts \
${dir_quelldatein}/aufbau/welt.ts \ ${dir_quelldatein}/aufbau/welt.ts \
${dir_quelldatein}/aufbau/aufgaben/test.ts \ ${dir_quelldatein}/aufbau/aufgaben/test.ts \
${dir_quelldatein}/aufbau/aufgaben/akzeptortest.ts \ ${dir_quelldatein}/aufbau/aufgaben/akzeptortest.ts \
@ -108,14 +107,13 @@ ${dir_erzeugnis}/vtm.js: \
${dir_quelldatein}/aufbau/stelle.ts \ ${dir_quelldatein}/aufbau/stelle.ts \
${dir_quelldatein}/aufbau/zustand.ts \ ${dir_quelldatein}/aufbau/zustand.ts \
${dir_quelldatein}/aufbau/figur.ts \ ${dir_quelldatein}/aufbau/figur.ts \
${dir_quelldatein}/aufbau/aktoren/aktor.ts \
${dir_quelldatein}/aufbau/aktoren/erzeuger.ts \ ${dir_quelldatein}/aufbau/aktoren/erzeuger.ts \
${dir_quelldatein}/aufbau/aktoren/annehmer.ts \ ${dir_quelldatein}/aufbau/aktoren/annehmer.ts \
${dir_quelldatein}/aufbau/aktoren/verwerfer.ts \ ${dir_quelldatein}/aufbau/aktoren/verwerfer.ts \
${dir_quelldatein}/aufbau/aktoren/befoerderer.ts \ ${dir_quelldatein}/aufbau/aktoren/befoerderer.ts \
${dir_quelldatein}/aufbau/aktoren/schreiber.ts \ ${dir_quelldatein}/aufbau/aktoren/schreiber.ts \
${dir_quelldatein}/aufbau/aktoren/leser.ts \ ${dir_quelldatein}/aufbau/aktoren/leser.ts \
${dir_quelldatein}/aufbau/aktoren/aktor_.ts \ ${dir_quelldatein}/aufbau/aktoren/aktor.ts \
${dir_quelldatein}/aufbau/welt.ts \ ${dir_quelldatein}/aufbau/welt.ts \
${dir_quelldatein}/aufbau/aufgaben/test.ts \ ${dir_quelldatein}/aufbau/aufgaben/test.ts \
${dir_quelldatein}/aufbau/aufgaben/akzeptortest.ts \ ${dir_quelldatein}/aufbau/aufgaben/akzeptortest.ts \

View file

@ -22,32 +22,306 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export interface schnittstelle_aktor export type typ_aktor =
{ {
art : string;
/** angaben ?: any;
* @author kcf <vidofnir@folksprak.org> }
*/ ;
drehen(inkrement ?: int) : void;
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
verwenden(figur : klasse_figur) : void; export function aktor_erstellen
(
art : string,
angaben : any = {}
)
: typ_aktor
{
switch (art)
{
case "erzeuger":
{
return {
"art": art,
"angaben": aktor_erzeuger_erstellen(angaben["richtung"]),
};
break;
}
case "annehmer":
{
return {
"art": art,
"angaben": aktor_annehmer_erstellen(),
};
break;
}
case "verwerfer":
{
return {
"art": art,
"angaben": aktor_verwerfer_erstellen(),
};
break;
}
case "befoerderer":
{
return {
"art": art,
"angaben": aktor_befoerderer_erstellen(angaben["richtung"]),
};
break;
}
case "schreiber":
{
return {
"art": art,
"angaben": aktor_schreiber_erstellen(angaben["richtung"], angaben["symbol"]),
};
break;
}
case "leser":
{
return {
"art": art,
"angaben": aktor_leser_erstellen(angaben["richtung"], angaben["symbol_links"], angaben["symbol_rechts"]),
};
break;
}
default:
{
let meldung : string = "unbehandelte Art";
throw (new Error(meldung));
break;
}
}
}
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
exportieren() : any; export function aktor_drehen
(
aktor : typ_aktor,
inkrement ?: int
)
: void
{
switch (aktor.art)
{
case "erzeuger":
{
return aktor_erzeuger_drehen(aktor.angaben, inkrement);
break;
}
case "annehmer":
{
return aktor_annehmer_drehen(aktor.angaben, inkrement);
break;
}
case "verwerfer":
{
return aktor_verwerfer_drehen(aktor.angaben, inkrement);
break;
}
case "befoerderer":
{
return aktor_befoerderer_drehen(aktor.angaben, inkrement);
break;
}
case "schreiber":
{
return aktor_schreiber_drehen(aktor.angaben, inkrement);
break;
}
case "leser":
{
return aktor_leser_drehen(aktor.angaben, inkrement);
break;
}
default:
{
let meldung : string = "unbehandelt";
throw (new Error(meldung));
break;
}
}
}
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
// static importieren(roh : any) : schnittstelle_aktor; export function aktor_verwenden
(
aktor : typ_aktor,
figur : typ_figur
)
: void
{
switch (aktor.art)
{
case "erzeuger":
{
return aktor_erzeuger_verwenden(aktor.angaben, figur);
break;
}
case "annehmer":
{
return aktor_annehmer_verwenden(aktor.angaben, figur);
break;
}
case "verwerfer":
{
return aktor_verwerfer_verwenden(aktor.angaben, figur);
break;
}
case "befoerderer":
{
return aktor_befoerderer_verwenden(aktor.angaben, figur);
break;
}
case "schreiber":
{
return aktor_schreiber_verwenden(aktor.angaben, figur);
break;
}
case "leser":
{
return aktor_leser_verwenden(aktor.angaben, figur);
break;
}
default:
{
let meldung : string = "unbehandelt";
throw (new Error(meldung));
break;
}
}
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_exportieren
(
aktor : typ_aktor
)
: any
{
switch (aktor.art)
{
case "erzeuger":
{
return aktor_erzeuger_exportieren(aktor.angaben);
break;
}
case "annehmer":
{
return aktor_annehmer_exportieren(aktor.angaben);
break;
}
case "verwerfer":
{
return aktor_verwerfer_exportieren(aktor.angaben);
break;
}
case "befoerderer":
{
return aktor_befoerderer_exportieren(aktor.angaben);
break;
}
case "schreiber":
{
return aktor_schreiber_exportieren(aktor.angaben);
break;
}
case "leser":
{
return aktor_leser_exportieren(aktor.angaben);
break;
}
default:
{
let meldung : string = "unbehandelt";
throw (new Error(meldung));
break;
}
}
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_importieren
(
roh : any
)
: typ_aktor
{
switch (roh["art"])
{
case "erzeuger":
{
return {
"art": roh["art"],
"angaben": aktor_erzeuger_importieren(roh["angaben"]),
};
break;
}
case "annehmer":
{
return {
"art": roh["art"],
"angaben": aktor_annehmer_importieren(roh["angaben"]),
};
break;
}
case "verwerfer":
{
return {
"art": roh["art"],
"angaben": aktor_verwerfer_importieren(roh["angaben"]),
};
break;
}
case "befoerderer":
{
return {
"art": roh["art"],
"angaben": aktor_befoerderer_importieren(roh["angaben"]),
};
break;
}
case "schreiber":
{
return {
"art": roh["art"],
"angaben": aktor_schreiber_importieren(roh["angaben"]),
};
break;
}
case "leser":
{
return {
"art": roh["art"],
"angaben": aktor_leser_importieren(roh["angaben"]),
};
break;
}
default:
{
let meldung : string = "unbehandelte Art";
throw (new Error(meldung));
break;
}
}
} }
} }

View file

@ -1,124 +0,0 @@
/*
* Verrückte Turing-Maschinen A turing complete game
* Copyright (C) 2016 Christian Fraß <vidofnir@folksprak.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
module mod_vtm_aufbau
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_exportieren(aktor : schnittstelle_aktor) : any
{
if (aktor instanceof klasse_erzeuger)
{
return {
"art": "erzeuger",
"angaben": aktor.exportieren()
};
}
else if (aktor instanceof klasse_annehmer)
{
return {
"art": "annehmer",
"angaben": aktor.exportieren()
};
}
else if (aktor instanceof klasse_verwerfer)
{
return {
"art": "verwerfer",
"angaben": aktor.exportieren()
};
}
else if (aktor instanceof klasse_befoerderer)
{
return {
"art": "befoerderer",
"angaben": aktor.exportieren()
};
}
else if (aktor instanceof klasse_schreiber)
{
return {
"art": "schreiber",
"angaben": aktor.exportieren()
};
}
else if (aktor instanceof klasse_leser)
{
return {
"art": "leser",
"angaben": aktor.exportieren()
};
}
else
{
let meldung : string = "unbehandelte Klasse";
throw (new Error(meldung));
}
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_importieren(aktor_roh : any) : schnittstelle_aktor
{
switch (aktor_roh["art"])
{
case "erzeuger":
{
return klasse_erzeuger.importieren(aktor_roh["angaben"]);
break;
}
case "annehmer":
{
return klasse_annehmer.importieren(aktor_roh["angaben"]);
break;
}
case "verwerfer":
{
return klasse_verwerfer.importieren(aktor_roh["angaben"]);
break;
}
case "befoerderer":
{
return klasse_befoerderer.importieren(aktor_roh["angaben"]);
break;
}
case "schreiber":
{
return klasse_schreiber.importieren(aktor_roh["angaben"]);
break;
}
case "leser":
{
return klasse_leser.importieren(aktor_roh["angaben"]);
break;
}
default:
{
let meldung : string = "unbehandelte Art";
throw (new Error(meldung));
break;
}
}
}
}

View file

@ -3,16 +3,16 @@
* Copyright (C) 2016 Christian Fraß <vidofnir@folksprak.org> * Copyright (C) 2016 Christian Fraß <vidofnir@folksprak.org>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General export function aktor_annehmer_License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General export function aktor_annehmer_License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General export function aktor_annehmer_License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
@ -22,42 +22,19 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export class klasse_annehmer export type typ_aktor_annehmer =
implements schnittstelle_aktor
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
public constructor()
{ {
} }
;
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
* @implementation
*/ */
public drehen(inkrement ?: int) : void export function aktor_annehmer_erstellen
{ (
} )
: typ_aktor_annehmer
/**
* @author kcf <vidofnir@folksprak.org>
* @implementation
*/
public verwenden(figur : klasse_figur) : void
{
figur.annehmen();
}
/**
* @author kcf <vidofnir@folksprak.org>
* @implementation
*/
public exportieren() : any
{ {
return { return {
}; };
@ -66,12 +43,38 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
* @implementation
*/ */
public static importieren(roh : any) : klasse_annehmer export function aktor_annehmer_drehen(aktor_annehmer : typ_aktor_annehmer, inkrement ?: int) : void
{
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_annehmer_verwenden(aktor_annehmer : typ_aktor_annehmer, figur : typ_figur) : void
{
figur_annehmen(figur);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_annehmer_exportieren(aktor_annehmer : typ_aktor_annehmer) : any
{
return {
};
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_annehmer_importieren(roh : any) : typ_aktor_annehmer
{ {
return ( return (
new klasse_annehmer aktor_annehmer_erstellen
( (
) )
); );
@ -79,6 +82,4 @@ module mod_vtm_aufbau
} }
}

View file

@ -3,16 +3,16 @@
* Copyright (C) 2016 Christian Fraß <vidofnir@folksprak.org> * Copyright (C) 2016 Christian Fraß <vidofnir@folksprak.org>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General export function aktor_befoerderer_License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General export function aktor_befoerderer_License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General export function aktor_befoerderer_License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
@ -22,74 +22,69 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export class klasse_befoerderer export type typ_aktor_befoerderer =
implements schnittstelle_aktor
{ {
richtung : typ_richtung;
/**
* @author kcf <vidofnir@folksprak.org>
*/
private richtung : typ_richtung;
/**
* @author kcf <vidofnir@folksprak.org>
*/
public constructor(richtung : typ_richtung = 0)
{
this.richtung = richtung;
} }
;
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public richtung_lesen() : typ_richtung export function aktor_befoerderer_erstellen(richtung : typ_richtung = 0) : typ_aktor_befoerderer
{
return this.richtung;
}
/**
* @author kcf <vidofnir@folksprak.org>
* @implementation
*/
public drehen(inkrement : int = +1) : void
{
this.richtung = richtung_addieren(this.richtung, inkrement);
}
/**
* @author kcf <vidofnir@folksprak.org>
* @implementation
*/
public verwenden(figur : klasse_figur) : void
{
figur.bewegen(this.richtung);
}
/**
* @author kcf <vidofnir@folksprak.org>
* @implementation
*/
public exportieren() : any
{ {
return { return {
"richtung": richtung_exportieren(this.richtung), "richtung": richtung,
}; };
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
* @implementation
*/ */
public static importieren(roh : any) : klasse_befoerderer export function aktor_befoerderer_richtung_lesen(aktor_befoerderer : typ_aktor_befoerderer) : typ_richtung
{
return aktor_befoerderer.richtung;
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_befoerderer_drehen(aktor_befoerderer : typ_aktor_befoerderer, inkrement : int = +1) : void
{
aktor_befoerderer.richtung = richtung_addieren(aktor_befoerderer.richtung, inkrement);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_befoerderer_verwenden(aktor_befoerderer : typ_aktor_befoerderer, figur : typ_figur) : void
{
figur_bewegen(figur, aktor_befoerderer.richtung);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_befoerderer_exportieren(aktor_befoerderer : typ_aktor_befoerderer) : any
{
return {
"richtung": richtung_exportieren(aktor_befoerderer.richtung),
};
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_befoerderer_importieren(roh : any) : typ_aktor_befoerderer
{ {
return ( return (
new klasse_befoerderer aktor_befoerderer_erstellen
( (
richtung_importieren(roh["richtung"]) richtung_importieren(roh["richtung"])
) )
@ -98,6 +93,4 @@ module mod_vtm_aufbau
} }
}

View file

@ -22,74 +22,95 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export class klasse_erzeuger export type typ_aktor_erzeuger =
implements schnittstelle_aktor
{ {
richtung : typ_richtung;
/**
* @author kcf <vidofnir@folksprak.org>
*/
private richtung : typ_richtung;
/**
* @author kcf <vidofnir@folksprak.org>
*/
public constructor(richtung : typ_richtung = 0)
{
this.richtung = richtung;
} }
;
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public richtung_lesen() : typ_richtung export function aktor_erzeuger_erstellen
{ (
return this.richtung; richtung : typ_richtung = 0
} )
: typ_aktor_erzeuger
/**
* @author kcf <vidofnir@folksprak.org>
* @implementation
*/
public drehen(inkrement : int = +1) : void
{
this.richtung = richtung_addieren(this.richtung, inkrement);
}
/**
* @author kcf <vidofnir@folksprak.org>
* @implementation
*/
public verwenden(figur : klasse_figur) : void
{
figur.bewegen(this.richtung);
}
/**
* @author kcf <vidofnir@folksprak.org>
* @implementation
*/
public exportieren() : any
{ {
return { return {
"richtung": richtung_exportieren(this.richtung), "richtung": richtung,
}; };
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
* @implementation
*/ */
public static importieren(roh : any) : klasse_erzeuger export function aktor_erzeuger_richtung_lesen
(
aktor_erzeuger : typ_aktor_erzeuger
)
: typ_richtung
{
return aktor_erzeuger.richtung;
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_erzeuger_drehen
(
aktor_erzeuger : typ_aktor_erzeuger,
inkrement : int = +1
)
: void
{
aktor_erzeuger.richtung = richtung_addieren(aktor_erzeuger.richtung, inkrement);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_erzeuger_verwenden
(
aktor_erzeuger : typ_aktor_erzeuger,
figur : typ_figur
)
: void
{
figur_bewegen(figur, aktor_erzeuger.richtung);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_erzeuger_exportieren
(
aktor_erzeuger : typ_aktor_erzeuger
)
: any
{
return {
"richtung": richtung_exportieren(aktor_erzeuger.richtung),
};
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_erzeuger_importieren
(
roh : any
)
: typ_aktor_erzeuger
{ {
return ( return (
new klasse_erzeuger aktor_erzeuger_erstellen
( (
richtung_importieren(roh["richtung"]) richtung_importieren(roh["richtung"])
) )
@ -98,6 +119,4 @@ module mod_vtm_aufbau
} }
}

View file

@ -3,16 +3,16 @@
* Copyright (C) 2016 Christian Fraß <vidofnir@folksprak.org> * Copyright (C) 2016 Christian Fraß <vidofnir@folksprak.org>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General export function aktor_leser_License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General export function aktor_leser_License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General export function aktor_leser_License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
@ -22,95 +22,82 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export class klasse_leser export type typ_aktor_leser =
implements schnittstelle_aktor
{ {
"richtung": typ_richtung,
/** "symbol_links": typ_symbol,
* @author kcf <vidofnir@folksprak.org> "symbol_rechts": typ_symbol,
*/ }
private richtung : typ_richtung; ;
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
private symbol_links : typ_symbol; export function aktor_leser_erstellen(richtung : typ_richtung = 0, symbol_links : typ_symbol = 0, symbol_rechts : typ_symbol = 1) : typ_aktor_leser
/**
* @author kcf <vidofnir@folksprak.org>
*/
private symbol_rechts : typ_symbol;
/**
* @author kcf <vidofnir@folksprak.org>
*/
public constructor(richtung : typ_richtung = 0, symbol_links : typ_symbol = 0, symbol_rechts : typ_symbol = 1)
{ {
this.richtung = richtung; return {
this.symbol_links = symbol_links; "richtung": richtung,
this.symbol_rechts = symbol_rechts; "symbol_links": symbol_links,
"symbol_rechts": symbol_rechts,
};
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public richtung_lesen() : typ_richtung export function aktor_leser_richtung_lesen(aktor_leser : typ_aktor_leser) : typ_richtung
{ {
return this.richtung; return aktor_leser.richtung;
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public symbol_links_lesen() : typ_symbol export function aktor_leser_symbol_links_lesen(aktor_leser : typ_aktor_leser) : typ_symbol
{ {
return this.symbol_links; return aktor_leser.symbol_links;
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public symbol_rechts_lesen() : typ_symbol export function aktor_leser_symbol_rechts_lesen(aktor_leser : typ_aktor_leser) : typ_symbol
{ {
return this.symbol_rechts; return aktor_leser.symbol_rechts;
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
* @implementation
*/ */
public drehen(inkrement : int = +1) : void export function aktor_leser_drehen(aktor_leser : typ_aktor_leser, inkrement : int = +1) : void
{ {
this.richtung = richtung_addieren(this.richtung, inkrement); aktor_leser.richtung = richtung_addieren(aktor_leser.richtung, inkrement);
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
* @implementation
*/ */
public verwenden(figur : klasse_figur) : void export function aktor_leser_verwenden(aktor_leser : typ_aktor_leser, figur : typ_figur) : void
{ {
let symbol_ : schnittstelle_fehlermonade<typ_symbol> = figur.lesen(); let symbol_ : schnittstelle_fehlermonade<typ_symbol> = figur_lesen(figur);
let summand : typ_richtung; let summand : typ_richtung;
if (symbol_.ist_schlicht()) if (symbol_.ist_schlicht())
{ {
let symbol : typ_symbol = symbol_.lesen(); let symbol : typ_symbol = symbol_.lesen();
if (symbol === this.symbol_links) if (symbol === aktor_leser.symbol_links)
{ {
figur.schieben(); figur_schieben(figur);
summand = +2; summand = +2;
} }
else if (symbol === this.symbol_rechts) else if (symbol === aktor_leser.symbol_rechts)
{ {
figur.schieben(); figur_schieben(figur);
summand = -2; summand = -2;
} }
else else
@ -122,33 +109,31 @@ module mod_vtm_aufbau
{ {
summand = 0; summand = 0;
} }
let richtung : typ_richtung = richtung_addieren(this.richtung, summand); let richtung : typ_richtung = richtung_addieren(aktor_leser.richtung, summand);
figur.bewegen(richtung); figur_bewegen(figur, richtung);
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
* @implementation
*/ */
public exportieren() : any export function aktor_leser_exportieren(aktor_leser : typ_aktor_leser) : any
{ {
return { return {
"richtung": richtung_exportieren(this.richtung), "richtung": richtung_exportieren(aktor_leser.richtung),
"symbol_links": symbol_exportieren(this.symbol_links), "symbol_links": symbol_exportieren(aktor_leser.symbol_links),
"symbol_rechts": symbol_exportieren(this.symbol_rechts), "symbol_rechts": symbol_exportieren(aktor_leser.symbol_rechts),
}; };
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
* @implementation
*/ */
public static importieren(roh : any) : klasse_leser export function aktor_leser_importieren(roh : any) : typ_aktor_leser
{ {
return ( return (
new klasse_leser aktor_leser_erstellen
( (
richtung_importieren(roh["richtung"]), richtung_importieren(roh["richtung"]),
symbol_importieren(roh["symbol_links"]), symbol_importieren(roh["symbol_links"]),
@ -159,6 +144,4 @@ module mod_vtm_aufbau
} }
}

View file

@ -3,16 +3,16 @@
* Copyright (C) 2016 Christian Fraß <vidofnir@folksprak.org> * Copyright (C) 2016 Christian Fraß <vidofnir@folksprak.org>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General export function aktor_schreiber_License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General export function aktor_schreiber_License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General export function aktor_schreiber_License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
@ -22,92 +22,82 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export class klasse_schreiber export type typ_aktor_schreiber =
implements schnittstelle_aktor
{ {
richtung : typ_richtung;
/** symbol : typ_symbol;
* @author kcf <vidofnir@folksprak.org>
*/
private richtung : typ_richtung;
/**
* @author kcf <vidofnir@folksprak.org>
*/
private symbol : typ_symbol;
/**
* @author kcf <vidofnir@folksprak.org>
*/
public constructor(richtung : typ_richtung = 0, symbol : typ_symbol = 0)
{
this.richtung = richtung;
this.symbol = symbol;
} }
;
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public richtung_lesen() : typ_richtung export function aktor_schreiber_erstellen(richtung : typ_richtung = 0, symbol : typ_symbol = 0) : typ_aktor_schreiber
{
return this.richtung;
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
public symbol_lesen() : typ_symbol
{
return this.symbol;
}
/**
* @author kcf <vidofnir@folksprak.org>
* @implementation
*/
public drehen(inkrement : int = +1) : void
{
this.richtung = richtung_addieren(this.richtung, inkrement);
}
/**
* @author kcf <vidofnir@folksprak.org>
* @implementation
*/
public verwenden(figur : klasse_figur) : void
{
figur.schreiben(this.symbol);
figur.bewegen(this.richtung);
}
/**
* @author kcf <vidofnir@folksprak.org>
* @implementation
*/
public exportieren() : any
{ {
return { return {
"richtung": richtung_exportieren(this.richtung), "richtung": richtung,
"symbol": symbol_exportieren(this.symbol), "symbol": symbol,
}
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_schreiber_richtung_lesen(aktor_schreiber : typ_aktor_schreiber) : typ_richtung
{
return aktor_schreiber.richtung;
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_schreiber_symbol_lesen(aktor_schreiber : typ_aktor_schreiber) : typ_symbol
{
return aktor_schreiber.symbol;
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_schreiber_drehen(aktor_schreiber : typ_aktor_schreiber, inkrement : int = +1) : void
{
aktor_schreiber.richtung = richtung_addieren(aktor_schreiber.richtung, inkrement);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_schreiber_verwenden(aktor_schreiber : typ_aktor_schreiber, figur : typ_figur) : void
{
figur_schreiben(figur, aktor_schreiber.symbol);
figur_bewegen(figur, aktor_schreiber.richtung);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_schreiber_exportieren(aktor_schreiber : typ_aktor_schreiber) : any
{
return {
"richtung": richtung_exportieren(aktor_schreiber.richtung),
"symbol": symbol_exportieren(aktor_schreiber.symbol),
}; };
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
* @implementation
*/ */
public static importieren(roh : any) : klasse_schreiber export function aktor_schreiber_importieren(roh : any) : typ_aktor_schreiber
{ {
return ( return (
new klasse_schreiber aktor_schreiber_erstellen
( (
richtung_importieren(roh["richtung"]), richtung_importieren(roh["richtung"]),
symbol_importieren(roh["symbol"]) symbol_importieren(roh["symbol"])
@ -117,6 +107,4 @@ module mod_vtm_aufbau
} }
}

View file

@ -3,16 +3,16 @@
* Copyright (C) 2016 Christian Fraß <vidofnir@folksprak.org> * Copyright (C) 2016 Christian Fraß <vidofnir@folksprak.org>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General export function aktor_verwerfer_License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General export function aktor_verwerfer_License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General export function aktor_verwerfer_License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
@ -22,42 +22,16 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export class klasse_verwerfer export type typ_aktor_verwerfer =
implements schnittstelle_aktor
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
public constructor()
{ {
} }
;
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
* @implementation
*/ */
public drehen(inkrement ?: int) : void export function aktor_verwerfer_erstellen() : typ_aktor_verwerfer
{
}
/**
* @author kcf <vidofnir@folksprak.org>
* @implementation
*/
public verwenden(figur : klasse_figur) : void
{
figur.verwerfen();
}
/**
* @author kcf <vidofnir@folksprak.org>
* @implementation
*/
public exportieren() : any
{ {
return { return {
}; };
@ -66,12 +40,38 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
* @implementation
*/ */
public static importieren(roh : any) : klasse_verwerfer export function aktor_verwerfer_drehen(aktor_verwerfer : typ_aktor_verwerfer, inkrement ?: int) : void
{
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_verwerfer_verwenden(aktor_verwerfer : typ_aktor_verwerfer, figur : typ_figur) : void
{
figur_verwerfen(figur);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_verwerfer_exportieren(aktor_verwerfer : typ_aktor_verwerfer) : any
{
return {
};
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_verwerfer_importieren(roh : any) : typ_aktor_verwerfer
{ {
return ( return (
new klasse_verwerfer aktor_verwerfer_erstellen
( (
) )
); );
@ -79,6 +79,4 @@ module mod_vtm_aufbau
} }
}

View file

@ -3,16 +3,16 @@
* Copyright (C) 2016 Christian Fraß <vidofnir@folksprak.org> * Copyright (C) 2016 Christian Fraß <vidofnir@folksprak.org>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General export function figur_License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General export function figur_License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General export function figur_License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
@ -22,96 +22,117 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export class klasse_figur export type typ_figur =
{ {
zustand : typ_zustand;
/** band : Array<typ_symbol>;
* @author kcf <vidofnir@folksprak.org> stelle : typ_stelle;
*/ }
private zustand : typ_zustand; ;
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
private band : Array<typ_symbol>; export function figur_erstellen
(
band : Array<typ_symbol> = [],
/** stelle : typ_stelle = stelle_null()
* @author kcf <vidofnir@folksprak.org> )
*/ : typ_figur
private stelle : typ_stelle;
/**
* @author kcf <vidofnir@folksprak.org>
*/
public constructor(band : Array<typ_symbol> = [], stelle : typ_stelle = stelle_null())
{ {
this.zustand = zustand_laufend; return {
this.band = band; "zustand": zustand_laufend,
this.stelle = stelle; "band": band,
"stelle": stelle,
};
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public zustand_lesen() : typ_zustand export function figur_zustand_lesen
(
figur : typ_figur
)
: typ_zustand
{ {
return this.zustand; return figur.zustand;
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public band_lesen() : Array<typ_symbol> export function figur_band_lesen
(
figur : typ_figur
)
: Array<typ_symbol>
{ {
return this.band; return figur.band;
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public stelle_lesen() : typ_stelle export function figur_stelle_lesen
(
figur : typ_figur
)
: typ_stelle
{ {
return this.stelle; return figur.stelle;
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public bewegen(richtung : typ_richtung) : void export function figur_bewegen
(
figur : typ_figur,
richtung : typ_richtung
)
: void
{ {
let summand : typ_stelle = stelle_von_richtung(richtung); let summand : typ_stelle = stelle_von_richtung(richtung);
this.stelle = stelle_addieren(this.stelle, summand); figur.stelle = stelle_addieren(figur.stelle, summand);
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public schreiben(symbol : typ_symbol) : void export function figur_schreiben
(
figur : typ_figur,
symbol : typ_symbol
)
: void
{ {
this.band.push(symbol); figur.band.push(symbol);
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public lesen() : schnittstelle_fehlermonade<typ_symbol> export function figur_lesen
(
figur : typ_figur
)
: schnittstelle_fehlermonade<typ_symbol>
{ {
if (this.band.length <= 0) if (figur.band.length <= 0)
{ {
return (new klasse_nichts<typ_symbol>()); return (new klasse_nichts<typ_symbol>());
} }
else else
{ {
return (new klasse_schlicht<typ_symbol>(this.band[0])); return (new klasse_schlicht<typ_symbol>(figur.band[0]));
} }
} }
@ -119,16 +140,20 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public schieben() : void export function figur_schieben
(
figur : typ_figur
)
: void
{ {
if (this.band.length <= 0) if (figur.band.length <= 0)
{ {
let meldung : string = "Band ist leer"; let meldung : string = "Band ist leer";
throw (new Error(meldung)); throw (new Error(meldung));
} }
else else
{ {
this.band.shift(); figur.band.shift();
} }
} }
@ -136,20 +161,26 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public annehmen() : void export function figur_annehmen
(
figur : typ_figur
)
: void
{ {
this.zustand = zustand_angenommen; figur.zustand = zustand_angenommen;
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public verwerfen() : void export function figur_verwerfen
(
figur : typ_figur
)
: void
{ {
this.zustand = zustand_abgelehnt; figur.zustand = zustand_abgelehnt;
}
} }
} }

View file

@ -3,16 +3,16 @@
* Copyright (C) 2016 Christian Fraß <vidofnir@folksprak.org> * Copyright (C) 2016 Christian Fraß <vidofnir@folksprak.org>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General export function partie_License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General export function partie_License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General export function partie_License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
@ -22,73 +22,55 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export class klasse_partie export type typ_partie =
{ {
welt : typ_welt;
/** figur : schnittstelle_fehlermonade<typ_figur>;
* @author kcf <vidofnir@folksprak.org> aufgabe : schnittstelle_aufgabe;
*/ testindex : schnittstelle_fehlermonade<int>;
private welt : klasse_welt; modus : typ_modus;
lauscher : {[ereignis : string] : Array<(angaben ?: any)=>void>};
}
;
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
private figur : schnittstelle_fehlermonade<klasse_figur>; export function partie_erstellen
/**
* @author kcf <vidofnir@folksprak.org>
*/
private aufgabe : schnittstelle_aufgabe;
/**
* @author kcf <vidofnir@folksprak.org>
*/
private testindex : schnittstelle_fehlermonade<int>;
/**
* @author kcf <vidofnir@folksprak.org>
*/
private modus : typ_modus;
/**
* @author kcf <vidofnir@folksprak.org>
*/
private lauscher : {[ereignis : string] : Array<(angaben ?: any)=>void>};
/**
* @author kcf <vidofnir@folksprak.org>
*/
public constructor
( (
aufgabe : schnittstelle_aufgabe aufgabe : schnittstelle_aufgabe
) )
: typ_partie
{ {
this.aufgabe = aufgabe; let partie : typ_partie = {
this.welt_leeren(false); "welt": undefined,
this.zuruecksetzen(false); "figur": undefined,
this.lauscher = { "aufgabe": aufgabe,
"testindex": undefined,
"modus": undefined,
"lauscher": undefined,
};
partie.lauscher = {
"aenderung_aufgabe": [], "aenderung_aufgabe": [],
"aenderung_welt": [], "aenderung_welt": [],
"aenderung_figur": [], "aenderung_figur": [],
"aenderung_modus": [], "aenderung_modus": [],
}; };
partie_welt_leeren(partie, false);
partie_zuruecksetzen(partie, false);
return partie;
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public lauschen(ereignis : string, prozedur : (angaben ?: any)=>void) : void export function partie_lauschen(partie : typ_partie, ereignis : string, prozedur : (angaben ?: any)=>void) : void
{ {
if (ereignis in this.lauscher) if (ereignis in partie.lauscher)
{ {
this.lauscher[ereignis].push(prozedur); partie.lauscher[ereignis].push(prozedur);
} }
else else
{ {
@ -101,11 +83,11 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
private benachrichtigen(ereignis : string, angaben : any = {}) : void function partie_benachrichtigen(partie : typ_partie, ereignis : string, angaben : any = {}) : void
{ {
if (ereignis in this.lauscher) if (ereignis in partie.lauscher)
{ {
this.lauscher[ereignis].forEach partie.lauscher[ereignis].forEach
( (
prozedur => prozedur =>
{ {
@ -125,15 +107,15 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public zuruecksetzen(bescheid_geben : boolean = true) : void export function partie_zuruecksetzen(partie : typ_partie, bescheid_geben : boolean = true) : void
{ {
this.figur = (new klasse_nichts<klasse_figur>()); partie.figur = (new klasse_nichts<typ_figur>());
this.testindex = (new klasse_nichts<int>()); partie.testindex = (new klasse_nichts<int>());
this.modus = modus_initial; partie.modus = modus_initial;
if (bescheid_geben) if (bescheid_geben)
{ {
this.benachrichtigen("aenderung_figur", {}); partie_benachrichtigen(partie, "aenderung_figur", {});
this.benachrichtigen("aenderung_modus", {}); partie_benachrichtigen(partie, "aenderung_modus", {});
} }
else else
{ {
@ -145,42 +127,42 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public aufgabe_lesen() : schnittstelle_aufgabe export function partie_aufgabe_lesen(partie : typ_partie) : schnittstelle_aufgabe
{ {
return this.aufgabe; return partie.aufgabe;
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public aufgabe_setzen(aufgabe : schnittstelle_aufgabe) : void export function partie_aufgabe_setzen(partie : typ_partie, aufgabe : schnittstelle_aufgabe) : void
{ {
this.aufgabe = aufgabe; partie.aufgabe = aufgabe;
// this.welt_leeren(); // partie.welt_leeren();
this.benachrichtigen("aenderung_aufgabe", {}); partie_benachrichtigen(partie, "aenderung_aufgabe", {});
this.zuruecksetzen(); partie_zuruecksetzen(partie);
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public welt_lesen() : klasse_welt export function partie_welt_lesen(partie : typ_partie) : typ_welt
{ {
return this.welt; return partie.welt;
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public welt_setzen(welt : mod_vtm_aufbau.klasse_welt, bescheid_geben : boolean = true) : void export function partie_welt_setzen(partie : typ_partie, welt : mod_vtm_aufbau.typ_welt, bescheid_geben : boolean = true) : void
{ {
this.welt = welt; partie.welt = welt;
if (bescheid_geben) if (bescheid_geben)
{ {
this.benachrichtigen("aenderung_welt", {}); partie_benachrichtigen(partie, "aenderung_welt", {});
} }
else else
{ {
@ -192,12 +174,12 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public welt_leeren(bescheid_geben : boolean = true) : void export function partie_welt_leeren(partie : typ_partie, bescheid_geben : boolean = true) : void
{ {
this.welt = klasse_welt.blanko(); partie.welt = welt_blanko();
if (bescheid_geben) if (bescheid_geben)
{ {
this.benachrichtigen("aenderung_welt", {}); partie_benachrichtigen(partie, "aenderung_welt", {});
} }
else else
{ {
@ -209,35 +191,36 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public figur_lesen() : schnittstelle_fehlermonade<klasse_figur> export function partie_figur_lesen(partie : typ_partie) : schnittstelle_fehlermonade<typ_figur>
{ {
return this.figur; return partie.figur;
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public modus_lesen() : typ_modus export function partie_modus_lesen(partie : typ_partie) : typ_modus
{ {
return this.modus; return partie.modus;
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public welt_feld_wechseln(stelle : typ_stelle, umgekehrt : boolean = false) : void export function partie_welt_feld_wechseln(partie : typ_partie, stelle : typ_stelle, umgekehrt : boolean = false) : void
{ {
if (! (this.modus === mod_vtm_aufbau.modus_initial)) if (! (partie.modus === mod_vtm_aufbau.modus_initial))
{ {
let meldung : string = "gesperrt"; let meldung : string = "gesperrt";
} }
else else
{ {
this.welt.feld_wechseln(stelle, umgekehrt); welt_feld_wechseln(partie.welt, stelle, umgekehrt);
this.benachrichtigen partie_benachrichtigen
( (
partie,
"aenderung_welt", "aenderung_welt",
{ {
"art": "feld_wechseln", "art": "feld_wechseln",
@ -245,7 +228,7 @@ module mod_vtm_aufbau
{ {
"stelle": stelle, "stelle": stelle,
"umgekehrt": umgekehrt, "umgekehrt": umgekehrt,
"feld": this.welt.feld_holen(stelle), "feld": welt_feld_holen(partie.welt, stelle),
} }
} }
) )
@ -257,16 +240,16 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public welt_feld_drehen(stelle : typ_stelle, inkrement : int = +1) : void export function partie_welt_feld_drehen(partie : typ_partie, stelle : typ_stelle, inkrement : int = +1) : void
{ {
if (! (this.modus === mod_vtm_aufbau.modus_initial)) if (! (partie.modus === mod_vtm_aufbau.modus_initial))
{ {
let meldung : string = "gesperrt"; let meldung : string = "gesperrt";
} }
else else
{ {
this.welt.feld_drehen(stelle, inkrement); welt_feld_drehen(partie.welt, stelle, inkrement);
this.benachrichtigen("aenderung_welt", {}); partie_benachrichtigen(partie, "aenderung_welt", {});
} }
} }
@ -274,28 +257,28 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public fortfahren() : void export function partie_fortfahren(partie : typ_partie) : void
{ {
switch (this.modus) switch (partie.modus)
{ {
case modus_initial: case modus_initial:
{ {
this.modus = modus_ungewiss; partie.modus = modus_ungewiss;
this.testindex = (new klasse_schlicht<int>(0)); partie.testindex = (new klasse_schlicht<int>(0));
this.benachrichtigen("aenderung_modus", {}); partie_benachrichtigen(partie, "aenderung_modus", {});
break; break;
} }
case modus_ungewiss: case modus_ungewiss:
{ {
if (! this.figur.ist_schlicht()) if (! partie.figur.ist_schlicht())
{ {
let test : schnittstelle_test = this.aufgabe.tests()[this.testindex.lesen()]; let test : schnittstelle_test = partie.aufgabe.tests()[partie.testindex.lesen()];
let band : Array<typ_symbol> = mod_vtm_helfer.liste_kopieren<typ_symbol>(test.eingabe()); let band : Array<typ_symbol> = mod_vtm_helfer.liste_kopieren<typ_symbol>(test.eingabe());
let stelle : typ_stelle = this.welt.erzeuger_finden(); let stelle : typ_stelle = welt_erzeuger_finden(partie.welt);
this.figur = ( partie.figur = (
new klasse_schlicht<klasse_figur> new klasse_schlicht<typ_figur>
( (
new klasse_figur figur_erstellen
( (
band, band,
stelle stelle
@ -305,12 +288,12 @@ module mod_vtm_aufbau
} }
else else
{ {
let figur : klasse_figur = this.figur.lesen(); let figur : typ_figur = partie.figur.lesen();
let stelle : typ_stelle = figur.stelle_lesen(); let stelle : typ_stelle = figur_stelle_lesen(figur);
let aktor_ : schnittstelle_fehlermonade<schnittstelle_aktor> = this.welt.feld_holen(stelle); let aktor_ : schnittstelle_fehlermonade<typ_aktor> = welt_feld_holen(partie.welt, stelle);
let aktor : schnittstelle_aktor = (aktor_.ist_schlicht() ? aktor_.lesen() : (new klasse_verwerfer())); let aktor : typ_aktor = (aktor_.ist_schlicht() ? aktor_.lesen() : aktor_erstellen("verwerfer", {}));
aktor.verwenden(figur); aktor_verwenden(aktor, figur);
let zustand : typ_zustand = figur.zustand_lesen(); let zustand : typ_zustand = figur_zustand_lesen(figur);
if (zustand === zustand_laufend) if (zustand === zustand_laufend)
{ {
// nichts tun // nichts tun
@ -318,15 +301,15 @@ module mod_vtm_aufbau
else if ((zustand === zustand_angenommen) || (zustand === zustand_abgelehnt)) else if ((zustand === zustand_angenommen) || (zustand === zustand_abgelehnt))
{ {
let angenommen : boolean = (zustand === zustand_angenommen); let angenommen : boolean = (zustand === zustand_angenommen);
let ausgabe : Array<typ_symbol> = figur.band_lesen(); let ausgabe : Array<typ_symbol> = figur_band_lesen(figur);
this.figur = (new klasse_nichts<klasse_figur>()); partie.figur = (new klasse_nichts<typ_figur>());
let testindex : int = this.testindex.lesen(); let testindex : int = partie.testindex.lesen();
let tests : Array<schnittstelle_test> = this.aufgabe.tests(); let tests : Array<schnittstelle_test> = partie.aufgabe.tests();
let test : schnittstelle_test = tests[testindex]; let test : schnittstelle_test = tests[testindex];
if (! test.pruefen(angenommen, ausgabe)) if (! test.pruefen(angenommen, ausgabe))
{ {
this.modus = modus_fehlerhaft; partie.modus = modus_fehlerhaft;
this.benachrichtigen("aenderung_modus", {}); partie_benachrichtigen(partie, "aenderung_modus", {});
} }
else else
{ {
@ -334,14 +317,14 @@ module mod_vtm_aufbau
if (testindex < tests.length) if (testindex < tests.length)
{ {
// nächsten Test auswählen // nächsten Test auswählen
this.testindex = (new klasse_schlicht<int>(testindex)); partie.testindex = (new klasse_schlicht<int>(testindex));
} }
else else
{ {
// auf Modus "korrekt" wechseln // auf Modus "korrekt" wechseln
this.testindex = (new klasse_nichts<int>()); partie.testindex = (new klasse_nichts<int>());
this.modus = modus_korrekt; partie.modus = modus_korrekt;
this.benachrichtigen("aenderung_modus", {}); partie_benachrichtigen(partie, "aenderung_modus", {});
} }
} }
} }
@ -351,7 +334,7 @@ module mod_vtm_aufbau
throw (new Error(meldung)); throw (new Error(meldung));
} }
} }
this.benachrichtigen("aenderung_figur", {}); partie_benachrichtigen(partie, "aenderung_figur", {});
break; break;
} }
case modus_fehlerhaft: case modus_fehlerhaft:
@ -371,7 +354,6 @@ module mod_vtm_aufbau
break; break;
} }
} }
}
} }

View file

@ -3,16 +3,16 @@
* Copyright (C) 2016 Christian Fraß <vidofnir@folksprak.org> * Copyright (C) 2016 Christian Fraß <vidofnir@folksprak.org>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General export function welt_License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General export function welt_License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General export function welt_License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
@ -22,34 +22,35 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export class klasse_welt export type typ_welt =
{ {
felder : mod_vtm_helfer.klasse_hashmap<typ_stelle, typ_aktor>;
/** }
* @author kcf <vidofnir@folksprak.org> ;
*/
private felder : mod_vtm_helfer.klasse_hashmap<typ_stelle, schnittstelle_aktor>;
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public constructor export function welt_erstellen
( (
felder : mod_vtm_helfer.klasse_hashmap<typ_stelle, schnittstelle_aktor> = (new mod_vtm_helfer.klasse_hashmap<typ_stelle, schnittstelle_aktor>(stelle_hash)) felder : mod_vtm_helfer.klasse_hashmap<typ_stelle, typ_aktor> = (new mod_vtm_helfer.klasse_hashmap<typ_stelle, typ_aktor>(stelle_hash))
) )
: typ_welt
{ {
this.felder = felder; return {
"felder": felder,
};
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public felder_lesen() : Array<{stelle : typ_stelle; aktor : schnittstelle_aktor;}> export function welt_felder_lesen(welt : typ_welt) : Array<{stelle : typ_stelle; aktor : typ_aktor;}>
{ {
let felder : Array<{stelle : typ_stelle; aktor : schnittstelle_aktor;}> = []; let felder : Array<{stelle : typ_stelle; aktor : typ_aktor;}> = [];
this.felder.iterieren welt.felder.iterieren
( (
(stelle, aktor) => felder.push({"stelle": stelle, "aktor": aktor}) (stelle, aktor) => felder.push({"stelle": stelle, "aktor": aktor})
) )
@ -61,35 +62,35 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public feld_holen(stelle : typ_stelle) : schnittstelle_fehlermonade<schnittstelle_aktor> export function welt_feld_holen(welt : typ_welt, stelle : typ_stelle) : schnittstelle_fehlermonade<typ_aktor>
{ {
return this.felder.holen(stelle); return welt.felder.holen(stelle);
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public feld_setzen(stelle : typ_stelle, aktor : schnittstelle_aktor) : void export function welt_feld_setzen(welt : typ_welt, stelle : typ_stelle, aktor : typ_aktor) : void
{ {
this.felder.setzen(stelle, aktor); welt.felder.setzen(stelle, aktor);
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public feld_wechseln(stelle : typ_stelle, umgekehrt : boolean = false) : void export function welt_feld_wechseln(welt : typ_welt, stelle : typ_stelle, umgekehrt : boolean = false) : void
{ {
let erweitert : boolean = true; let erweitert : boolean = true;
let liste : Array<{pruefer : (aktor : schnittstelle_aktor)=>boolean; ersteller : ()=>schnittstelle_aktor;}> = ( let liste : Array<{pruefer : (aktor : typ_aktor)=>boolean; ersteller : ()=>typ_aktor;}> = (
[] []
.concat .concat
( (
[ [
{ {
"pruefer": (aktor) => (aktor instanceof klasse_befoerderer), "pruefer": (aktor) => (aktor.art === "befoerderer"),
"ersteller": () => new klasse_befoerderer(), "ersteller": () => aktor_erstellen("befoerderer"),
}, },
] ]
) )
@ -101,10 +102,9 @@ module mod_vtm_aufbau
{ {
"pruefer": (aktor) => "pruefer": (aktor) =>
{ {
if (aktor instanceof klasse_schreiber) if (aktor.art === "schreiber")
{ {
let schreiber : klasse_schreiber = <klasse_schreiber>(aktor); return (aktor_schreiber_symbol_lesen(aktor.angaben) === symbol);
return (schreiber.symbol_lesen() === symbol);
} }
else else
{ {
@ -112,7 +112,7 @@ module mod_vtm_aufbau
} }
} }
, ,
"ersteller": () => new klasse_schreiber(0, symbol), "ersteller": () => aktor_erstellen("schreiber", {"richtung": 0, "symbol": symbol})
} }
) )
) )
@ -129,13 +129,12 @@ module mod_vtm_aufbau
{ {
"pruefer": (aktor) => "pruefer": (aktor) =>
{ {
if (aktor instanceof klasse_leser) if (aktor.art === "leser")
{ {
let leser : klasse_leser = <klasse_leser>(aktor);
return ( return (
(leser.symbol_links_lesen() === symbol_links) (aktor_leser_symbol_links_lesen(aktor.angaben) === symbol_links)
&& &&
(leser.symbol_rechts_lesen() === symbol_rechts) (aktor_leser_symbol_links_lesen(aktor.angaben) === symbol_rechts)
); );
} }
else else
@ -144,7 +143,7 @@ module mod_vtm_aufbau
} }
} }
, ,
"ersteller": () => new klasse_leser(0, symbol_links, 2*index+1), "ersteller": () => aktor_erstellen("leser", {"richtung": 0, "symbol_links": symbol_links, "symbol_rechts": (2*index+1)}),
} }
); );
} }
@ -154,17 +153,17 @@ module mod_vtm_aufbau
( (
[ [
{ {
"pruefer": (aktor) => (aktor instanceof klasse_verwerfer), "pruefer": (aktor) => (aktor.art === "verwerfer"),
"ersteller": () => new klasse_verwerfer(), "ersteller": () => aktor_erstellen("verwerfer"),
}, },
] ]
) )
); );
let index_alt : schnittstelle_fehlermonade<int>; let index_alt : schnittstelle_fehlermonade<int>;
let aktor_alt_ : schnittstelle_fehlermonade<schnittstelle_aktor> = this.felder.holen(stelle); let aktor_alt_ : schnittstelle_fehlermonade<typ_aktor> = welt.felder.holen(stelle);
if (aktor_alt_.ist_schlicht) if (aktor_alt_.ist_schlicht)
{ {
let aktor_alt : schnittstelle_aktor = aktor_alt_.lesen(); let aktor_alt : typ_aktor = aktor_alt_.lesen();
let gefunden : boolean = liste.some let gefunden : boolean = liste.some
( (
(eintrag, index) => (eintrag, index) =>
@ -199,8 +198,8 @@ module mod_vtm_aufbau
if (index_alt.ist_schlicht()) if (index_alt.ist_schlicht())
{ {
let index_neu : int = mod_vtm_helfer.mod(index_alt.lesen() + (umgekehrt ? -1 : +1), liste.length); let index_neu : int = mod_vtm_helfer.mod(index_alt.lesen() + (umgekehrt ? -1 : +1), liste.length);
let aktor_neu : schnittstelle_aktor = liste[index_neu].ersteller(); let aktor_neu : typ_aktor = liste[index_neu].ersteller();
this.feld_setzen(stelle, aktor_neu); welt_feld_setzen(welt, stelle, aktor_neu);
} }
else else
{ {
@ -214,12 +213,12 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public feld_drehen(stelle : typ_stelle, inkrement : int = +1) : void export function welt_feld_drehen(welt : typ_welt, stelle : typ_stelle, inkrement : int = +1) : void
{ {
let aktor_ : schnittstelle_fehlermonade<schnittstelle_aktor> = this.felder.holen(stelle); let aktor_ : schnittstelle_fehlermonade<typ_aktor> = welt.felder.holen(stelle);
if (aktor_.ist_schlicht) if (aktor_.ist_schlicht)
{ {
aktor_.lesen().drehen(inkrement); aktor_drehen(aktor_.lesen(), inkrement);
} }
else else
{ {
@ -232,14 +231,14 @@ module mod_vtm_aufbau
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
* @throws {Error} * @throws {Error}
*/ */
public erzeuger_finden() : typ_stelle export function welt_erzeuger_finden(welt : typ_welt) : typ_stelle
{ {
let stelle : schnittstelle_fehlermonade<typ_stelle> = (new klasse_nichts<typ_stelle>()); let stelle : schnittstelle_fehlermonade<typ_stelle> = (new klasse_nichts<typ_stelle>());
this.felder.iterieren welt.felder.iterieren
( (
(stelle_, aktor) => (stelle_, aktor) =>
{ {
if (aktor instanceof klasse_erzeuger) if (aktor.art === "erzeuger")
{ {
if (stelle.ist_schlicht()) if (stelle.ist_schlicht())
{ {
@ -269,9 +268,9 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public static blanko(groesse : int = 3) : klasse_welt export function welt_blanko(groesse : int = 3) : typ_welt
{ {
let welt : klasse_welt = new klasse_welt(); let welt : typ_welt = welt_erstellen();
for (let u : int = -groesse; u <= +groesse; u += 1) for (let u : int = -groesse; u <= +groesse; u += 1)
{ {
for (let v : int = -groesse; v <= +groesse; v += 1) for (let v : int = -groesse; v <= +groesse; v += 1)
@ -279,18 +278,18 @@ module mod_vtm_aufbau
if (Math.abs(u-v) <= groesse) if (Math.abs(u-v) <= groesse)
{ {
let stelle : typ_stelle = {"u": u, "v": v}; let stelle : typ_stelle = {"u": u, "v": v};
let aktor : schnittstelle_aktor; let aktor : typ_aktor;
if ((u === -groesse) && (v === 0)) if ((u === -groesse) && (v === 0))
{ {
aktor = (new klasse_erzeuger(0)); aktor = aktor_erstellen("erzeuger", {"richtung": 0});
} }
else if ((u === +groesse) && (v === 0)) else if ((u === +groesse) && (v === 0))
{ {
aktor = (new klasse_annehmer()); aktor = aktor_erstellen("annehmer", {});
} }
else else
{ {
aktor = (new klasse_verwerfer()); aktor = aktor_erstellen("verwerfer", {});
} }
welt.felder.setzen(stelle, aktor); welt.felder.setzen(stelle, aktor);
} }
@ -303,11 +302,11 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public exportieren() : any export function welt_exportieren(welt : typ_welt) : any
{ {
let roh : any = {}; let roh : any = {};
roh["felder"] = {}; roh["felder"] = {};
this.felder.iterieren welt.felder.iterieren
( (
(stelle, aktor) => (stelle, aktor) =>
{ {
@ -324,18 +323,18 @@ module mod_vtm_aufbau
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public static importieren(roh : any) : klasse_welt export function welt_importieren(roh : any) : typ_welt
{ {
let felder : mod_vtm_helfer.klasse_hashmap<typ_stelle, schnittstelle_aktor> = (new mod_vtm_helfer.klasse_hashmap<typ_stelle, schnittstelle_aktor>(stelle_hash)); let felder : mod_vtm_helfer.klasse_hashmap<typ_stelle, typ_aktor> = (new mod_vtm_helfer.klasse_hashmap<typ_stelle, typ_aktor>(stelle_hash));
for (let stelle_ in roh["felder"]) for (let stelle_ in roh["felder"])
{ {
let stelle : typ_stelle = stelle_importieren(stelle_); let stelle : typ_stelle = stelle_importieren(stelle_);
let aktor_ : schnittstelle_aktor = roh["felder"][stelle_]; let aktor_ : typ_aktor = roh["felder"][stelle_];
let aktor : schnittstelle_aktor = aktor_importieren(aktor_); let aktor : typ_aktor = aktor_importieren(aktor_);
felder.setzen(stelle, aktor); felder.setzen(stelle, aktor);
} }
return ( return (
new klasse_welt welt_erstellen
( (
felder felder
) )
@ -344,5 +343,3 @@ module mod_vtm_aufbau
} }
}

View file

@ -115,27 +115,27 @@ function haupt() : void
let hoehe : float = 80; let hoehe : float = 80;
[ [
{ {
"aufbau": (new mod_vtm_aufbau.klasse_erzeuger()), "aufbau": mod_vtm_aufbau.aktor_erstellen("erzeuger"),
"bereich": document.querySelector("#hilfe_aktoren_aktor_erzeuger"), "bereich": document.querySelector("#hilfe_aktoren_aktor_erzeuger"),
}, },
{ {
"aufbau": (new mod_vtm_aufbau.klasse_annehmer()), "aufbau": mod_vtm_aufbau.aktor_erstellen("annehmer"),
"bereich": document.querySelector("#hilfe_aktoren_aktor_annehmer"), "bereich": document.querySelector("#hilfe_aktoren_aktor_annehmer"),
}, },
{ {
"aufbau": (new mod_vtm_aufbau.klasse_verwerfer()), "aufbau": mod_vtm_aufbau.aktor_erstellen("verwerfer"),
"bereich": document.querySelector("#hilfe_aktoren_aktor_verwerfer"), "bereich": document.querySelector("#hilfe_aktoren_aktor_verwerfer"),
}, },
{ {
"aufbau": (new mod_vtm_aufbau.klasse_befoerderer()), "aufbau": mod_vtm_aufbau.aktor_erstellen("befoerderer"),
"bereich": document.querySelector("#hilfe_aktoren_aktor_befoerderer"), "bereich": document.querySelector("#hilfe_aktoren_aktor_befoerderer"),
}, },
{ {
"aufbau": (new mod_vtm_aufbau.klasse_schreiber()), "aufbau": mod_vtm_aufbau.aktor_erstellen("schreiber"),
"bereich": document.querySelector("#hilfe_aktoren_aktor_schreiber"), "bereich": document.querySelector("#hilfe_aktoren_aktor_schreiber"),
}, },
{ {
"aufbau": (new mod_vtm_aufbau.klasse_leser()), "aufbau": mod_vtm_aufbau.aktor_erstellen("leser"),
"bereich": document.querySelector("#hilfe_aktoren_aktor_leser"), "bereich": document.querySelector("#hilfe_aktoren_aktor_leser"),
}, },
] ]
@ -154,13 +154,13 @@ function haupt() : void
} }
// Spiel // Spiel
{ {
let aufbau : mod_vtm_aufbau.klasse_partie; let aufbau : mod_vtm_aufbau.typ_partie;
aufgaben_eintragen aufgaben_eintragen
( (
function (aufgabe : mod_vtm_aufbau.schnittstelle_aufgabe) : void {aufbau.aufgabe_setzen(aufgabe);} function (aufgabe : mod_vtm_aufbau.schnittstelle_aufgabe) : void {mod_vtm_aufbau.partie_aufgabe_setzen(aufbau, aufgabe);}
) )
; ;
aufbau = (new mod_vtm_aufbau.klasse_partie(mod_vtm_aufbau.aufgabe_holen(0))); aufbau = mod_vtm_aufbau.partie_erstellen(mod_vtm_aufbau.aufgabe_holen(0));
(new mod_vtm_manifestation.klasse_web_partie(aufbau, document.querySelector("#bereich_mitte"))).einrichten(); (new mod_vtm_manifestation.klasse_web_partie(aufbau, document.querySelector("#bereich_mitte"))).einrichten();
(new mod_vtm_manifestation.klasse_speicher_partie(aufbau)).einrichten(); (new mod_vtm_manifestation.klasse_speicher_partie(aufbau)).einrichten();
} }

View file

@ -23,13 +23,13 @@ module mod_vtm_manifestation
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export class klasse_speicher_partie export class klasse_speicher_partie
extends klasse_manifestation<mod_vtm_aufbau.klasse_partie, void> extends klasse_manifestation<mod_vtm_aufbau.typ_partie, void>
{ {
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public constructor(aufbau : mod_vtm_aufbau.klasse_partie) public constructor(aufbau : mod_vtm_aufbau.typ_partie)
{ {
super(aufbau); super(aufbau);
} }
@ -41,42 +41,45 @@ module mod_vtm_manifestation
*/ */
public einrichten() : void public einrichten() : void
{ {
this.aufbau.lauschen mod_vtm_aufbau.partie_lauschen
( (
this.aufbau,
"aenderung_aufgabe", "aenderung_aufgabe",
(angaben) => (angaben) =>
{ {
// console.info("aenderung_aufgabe", angaben); // console.info("aenderung_aufgabe", angaben);
let id : string = this.aufbau.aufgabe_lesen().id_lesen(); let id : string = mod_vtm_aufbau.partie_aufgabe_lesen(this.aufbau).id_lesen();
let key : string = ("vtm_" + id); let key : string = ("vtm_" + id);
if (key in localStorage) if (key in localStorage)
{ {
let item : string = localStorage.getItem(key); let item : string = localStorage.getItem(key);
let welt : mod_vtm_aufbau.klasse_welt = mod_vtm_aufbau.klasse_welt.importieren(JSON.parse(item)); let welt : mod_vtm_aufbau.typ_welt = mod_vtm_aufbau.welt_importieren(JSON.parse(item));
this.aufbau.welt_setzen(welt, false); mod_vtm_aufbau.partie_welt_setzen(this.aufbau, welt, false);
} }
else else
{ {
this.aufbau.welt_leeren(); mod_vtm_aufbau.partie_welt_leeren(this.aufbau);
// nichts tun // nichts tun
} }
} }
) )
; ;
this.aufbau.lauschen mod_vtm_aufbau.partie_lauschen
( (
this.aufbau,
"aenderung_welt", "aenderung_welt",
(angaben) => (angaben) =>
{ {
let id : string = this.aufbau.aufgabe_lesen().id_lesen(); let id : string = mod_vtm_aufbau.partie_aufgabe_lesen(this.aufbau).id_lesen();
let key : string = ("vtm_" + id); let key : string = ("vtm_" + id);
let item : string = JSON.stringify(this.aufbau.welt_lesen().exportieren()); let item : string = JSON.stringify(mod_vtm_aufbau.welt_exportieren(mod_vtm_aufbau.partie_welt_lesen(this.aufbau)));
localStorage.setItem(key, item); localStorage.setItem(key, item);
} }
) )
; ;
this.aufbau.lauschen mod_vtm_aufbau.partie_lauschen
( (
this.aufbau,
"aenderung_figur", "aenderung_figur",
(angaben) => (angaben) =>
{ {
@ -84,8 +87,9 @@ module mod_vtm_manifestation
} }
) )
; ;
this.aufbau.lauschen mod_vtm_aufbau.partie_lauschen
( (
this.aufbau,
"aenderung_modus", "aenderung_modus",
(angaben) => (angaben) =>
{ {

View file

@ -23,7 +23,7 @@ module mod_vtm_manifestation
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export class klasse_svg_aktor export class klasse_svg_aktor
extends klasse_manifestation<mod_vtm_aufbau.schnittstelle_aktor, mod_vtm_helfer.schnittstelle_xmlknoten> extends klasse_manifestation<mod_vtm_aufbau.typ_aktor, mod_vtm_helfer.schnittstelle_xmlknoten>
{ {
/** /**
@ -35,7 +35,7 @@ module mod_vtm_manifestation
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public constructor(aufbau : mod_vtm_aufbau.schnittstelle_aktor, stelle : mod_vtm_aufbau.typ_stelle) public constructor(aufbau : mod_vtm_aufbau.typ_aktor, stelle : mod_vtm_aufbau.typ_stelle)
{ {
super(aufbau); super(aufbau);
this.stelle = stelle; this.stelle = stelle;
@ -48,7 +48,7 @@ module mod_vtm_manifestation
*/ */
public darstellen() : mod_vtm_helfer.schnittstelle_xmlknoten public darstellen() : mod_vtm_helfer.schnittstelle_xmlknoten
{ {
let aktor : mod_vtm_aufbau.schnittstelle_aktor = this.aufbau; let aktor : mod_vtm_aufbau.typ_aktor = this.aufbau;
let knoten_rahmen = function () : mod_vtm_helfer.schnittstelle_xmlknoten let knoten_rahmen = function () : mod_vtm_helfer.schnittstelle_xmlknoten
{ {
return ( return (
@ -64,11 +64,12 @@ module mod_vtm_manifestation
} }
; ;
let kinder_feld : Array<mod_vtm_helfer.schnittstelle_xmlknoten> = []; let kinder_feld : Array<mod_vtm_helfer.schnittstelle_xmlknoten> = [];
if (aktor instanceof mod_vtm_aufbau.klasse_erzeuger) switch (aktor.art)
{
case "erzeuger":
{ {
kinder_feld.push(knoten_rahmen()); kinder_feld.push(knoten_rahmen());
let erzeuger : mod_vtm_aufbau.klasse_erzeuger = <mod_vtm_aufbau.klasse_erzeuger>(aktor); let richtung : mod_vtm_aufbau.typ_richtung = mod_vtm_aufbau.aktor_erzeuger_richtung_lesen(aktor.angaben);
let richtung : mod_vtm_aufbau.typ_richtung = erzeuger.richtung_lesen();
let knoten_pfeil : mod_vtm_helfer.schnittstelle_xmlknoten = ( let knoten_pfeil : mod_vtm_helfer.schnittstelle_xmlknoten = (
new mod_vtm_helfer.klasse_xmlknoten_normal new mod_vtm_helfer.klasse_xmlknoten_normal
( (
@ -92,12 +93,12 @@ module mod_vtm_manifestation
) )
); );
kinder_feld.push(knoten_pfeil); kinder_feld.push(knoten_pfeil);
break;
} }
else if (aktor instanceof mod_vtm_aufbau.klasse_befoerderer) case "befoerderer":
{ {
kinder_feld.push(knoten_rahmen()); kinder_feld.push(knoten_rahmen());
let befoerderer : mod_vtm_aufbau.klasse_befoerderer = <mod_vtm_aufbau.klasse_befoerderer>(aktor); let richtung : mod_vtm_aufbau.typ_richtung = mod_vtm_aufbau.aktor_befoerderer_richtung_lesen(aktor.angaben);
let richtung : mod_vtm_aufbau.typ_richtung = befoerderer.richtung_lesen();
let knoten_pfeil : mod_vtm_helfer.schnittstelle_xmlknoten = ( let knoten_pfeil : mod_vtm_helfer.schnittstelle_xmlknoten = (
new mod_vtm_helfer.klasse_xmlknoten_normal new mod_vtm_helfer.klasse_xmlknoten_normal
( (
@ -121,13 +122,13 @@ module mod_vtm_manifestation
) )
); );
kinder_feld.push(knoten_pfeil); kinder_feld.push(knoten_pfeil);
break;
} }
else if (aktor instanceof mod_vtm_aufbau.klasse_schreiber) case "schreiber":
{ {
kinder_feld.push(knoten_rahmen()); kinder_feld.push(knoten_rahmen());
let schreiber : mod_vtm_aufbau.klasse_schreiber = <mod_vtm_aufbau.klasse_schreiber>(aktor); let richtung : mod_vtm_aufbau.typ_richtung = mod_vtm_aufbau.aktor_schreiber_richtung_lesen(aktor.angaben);
let richtung : mod_vtm_aufbau.typ_richtung = schreiber.richtung_lesen(); let symbol : mod_vtm_aufbau.typ_symbol = mod_vtm_aufbau.aktor_schreiber_symbol_lesen(aktor.angaben);
let symbol : mod_vtm_aufbau.typ_symbol = schreiber.symbol_lesen();
let knoten_pfeil : mod_vtm_helfer.schnittstelle_xmlknoten = ( let knoten_pfeil : mod_vtm_helfer.schnittstelle_xmlknoten = (
new mod_vtm_helfer.klasse_xmlknoten_normal new mod_vtm_helfer.klasse_xmlknoten_normal
( (
@ -151,12 +152,14 @@ module mod_vtm_manifestation
) )
); );
kinder_feld.push(knoten_pfeil); kinder_feld.push(knoten_pfeil);
break;
} }
else if (aktor instanceof mod_vtm_aufbau.klasse_leser) case "leser":
{ {
kinder_feld.push(knoten_rahmen()); kinder_feld.push(knoten_rahmen());
let leser : mod_vtm_aufbau.klasse_leser = <mod_vtm_aufbau.klasse_leser>(aktor); let richtung : mod_vtm_aufbau.typ_richtung = mod_vtm_aufbau.aktor_leser_richtung_lesen(aktor.angaben);
let richtung : mod_vtm_aufbau.typ_richtung = leser.richtung_lesen(); let symbol_links : mod_vtm_aufbau.typ_symbol = mod_vtm_aufbau.aktor_leser_symbol_links_lesen(aktor.angaben);
let symbol_rechts : mod_vtm_aufbau.typ_symbol = mod_vtm_aufbau.aktor_leser_symbol_rechts_lesen(aktor.angaben);
let ausgaenge : Array<{summand : mod_vtm_aufbau.typ_richtung, symbol : schnittstelle_fehlermonade<mod_vtm_aufbau.typ_symbol>;}> = let ausgaenge : Array<{summand : mod_vtm_aufbau.typ_richtung, symbol : schnittstelle_fehlermonade<mod_vtm_aufbau.typ_symbol>;}> =
[ [
{ {
@ -165,11 +168,11 @@ module mod_vtm_manifestation
}, },
{ {
"summand": +2, "summand": +2,
"symbol": new klasse_schlicht<mod_vtm_aufbau.typ_symbol>(leser.symbol_links_lesen()), "symbol": new klasse_schlicht<mod_vtm_aufbau.typ_symbol>(symbol_links),
}, },
{ {
"summand": -2, "summand": -2,
"symbol": new klasse_schlicht<mod_vtm_aufbau.typ_symbol>(leser.symbol_rechts_lesen()), "symbol": new klasse_schlicht<mod_vtm_aufbau.typ_symbol>(symbol_rechts),
}, },
] ]
; ;
@ -209,11 +212,11 @@ module mod_vtm_manifestation
} }
) )
; ;
break;
} }
else if (aktor instanceof mod_vtm_aufbau.klasse_verwerfer) case "verwerfer":
{ {
kinder_feld.push(knoten_rahmen()); kinder_feld.push(knoten_rahmen());
let verwerfer : mod_vtm_aufbau.klasse_annehmer = <mod_vtm_aufbau.klasse_verwerfer>(aktor);
let knoten_kreis : mod_vtm_helfer.schnittstelle_xmlknoten = ( let knoten_kreis : mod_vtm_helfer.schnittstelle_xmlknoten = (
new mod_vtm_helfer.klasse_xmlknoten_normal new mod_vtm_helfer.klasse_xmlknoten_normal
( (
@ -232,11 +235,11 @@ module mod_vtm_manifestation
) )
); );
kinder_feld.push(knoten_kreis); kinder_feld.push(knoten_kreis);
break;
} }
else if (aktor instanceof mod_vtm_aufbau.klasse_annehmer) case "annehmer":
{ {
kinder_feld.push(knoten_rahmen()); kinder_feld.push(knoten_rahmen());
let annehmer : mod_vtm_aufbau.klasse_annehmer = <mod_vtm_aufbau.klasse_annehmer>(aktor);
let knoten_kreis : mod_vtm_helfer.schnittstelle_xmlknoten = ( let knoten_kreis : mod_vtm_helfer.schnittstelle_xmlknoten = (
new mod_vtm_helfer.klasse_xmlknoten_normal new mod_vtm_helfer.klasse_xmlknoten_normal
( (
@ -255,11 +258,14 @@ module mod_vtm_manifestation
) )
); );
kinder_feld.push(knoten_kreis); kinder_feld.push(knoten_kreis);
break;
} }
else default:
{ {
let meldung : string = ("unbehandelter Aktor-Typ"); let meldung : string = ("unbehandelter Aktor-Typ");
throw (new Error(meldung)); throw (new Error(meldung));
break;
}
} }
let position : typ_position = position_von_stelle(this.stelle); let position : typ_position = position_von_stelle(this.stelle);
let knoten_feld : mod_vtm_helfer.schnittstelle_xmlknoten = ( let knoten_feld : mod_vtm_helfer.schnittstelle_xmlknoten = (

View file

@ -23,13 +23,13 @@ module mod_vtm_manifestation
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export class klasse_svg_figur export class klasse_svg_figur
extends klasse_manifestation<mod_vtm_aufbau.klasse_figur, mod_vtm_helfer.schnittstelle_xmlknoten> extends klasse_manifestation<mod_vtm_aufbau.typ_figur, mod_vtm_helfer.schnittstelle_xmlknoten>
{ {
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public constructor(aufbau : mod_vtm_aufbau.klasse_figur) public constructor(aufbau : mod_vtm_aufbau.typ_figur)
{ {
super(aufbau); super(aufbau);
} }
@ -41,7 +41,7 @@ module mod_vtm_manifestation
*/ */
public darstellen() : mod_vtm_helfer.schnittstelle_xmlknoten public darstellen() : mod_vtm_helfer.schnittstelle_xmlknoten
{ {
let figur : mod_vtm_aufbau.klasse_figur = this.aufbau; let figur : mod_vtm_aufbau.typ_figur = this.aufbau;
let kinder_figur : Array<mod_vtm_helfer.schnittstelle_xmlknoten> = []; let kinder_figur : Array<mod_vtm_helfer.schnittstelle_xmlknoten> = [];
// Stein // Stein
{ {
@ -61,7 +61,7 @@ module mod_vtm_manifestation
} }
// Band // Band
{ {
let band : Array<mod_vtm_aufbau.typ_symbol> = figur.band_lesen(); let band : Array<mod_vtm_aufbau.typ_symbol> = mod_vtm_aufbau.figur_band_lesen(figur);
let kinder_band : Array<mod_vtm_helfer.schnittstelle_xmlknoten> = []; let kinder_band : Array<mod_vtm_helfer.schnittstelle_xmlknoten> = [];
band.forEach band.forEach
( (
@ -109,7 +109,7 @@ module mod_vtm_manifestation
); );
kinder_figur.push(knoten_band); kinder_figur.push(knoten_band);
} }
let position : typ_position = position_von_stelle(figur.stelle_lesen()); let position : typ_position = position_von_stelle(mod_vtm_aufbau.figur_stelle_lesen(figur));
let knoten_figur = ( let knoten_figur = (
new mod_vtm_helfer.klasse_xmlknoten_normal new mod_vtm_helfer.klasse_xmlknoten_normal
( (

View file

@ -23,13 +23,13 @@ module mod_vtm_manifestation
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export class klasse_svg_partie export class klasse_svg_partie
extends klasse_manifestation<mod_vtm_aufbau.klasse_partie, mod_vtm_helfer.schnittstelle_xmlknoten> extends klasse_manifestation<mod_vtm_aufbau.typ_partie, mod_vtm_helfer.schnittstelle_xmlknoten>
{ {
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public constructor(aufbau : mod_vtm_aufbau.klasse_partie) public constructor(aufbau : mod_vtm_aufbau.typ_partie)
{ {
super(aufbau); super(aufbau);
} }
@ -48,11 +48,11 @@ module mod_vtm_manifestation
// Felder // Felder
{ {
let kinder_felder : Array<mod_vtm_helfer.schnittstelle_xmlknoten> = []; let kinder_felder : Array<mod_vtm_helfer.schnittstelle_xmlknoten> = [];
this.aufbau.welt_lesen().felder_lesen().forEach mod_vtm_aufbau.welt_felder_lesen(mod_vtm_aufbau.partie_welt_lesen(this.aufbau)).forEach
( (
({"stelle": stelle, "aktor": aktor}) => ({"stelle": stelle, "aktor": aktor}) =>
{ {
let manifestation_feld : klasse_manifestation<mod_vtm_aufbau.schnittstelle_aktor, mod_vtm_helfer.schnittstelle_xmlknoten> = new klasse_svg_aktor(aktor, stelle); let manifestation_feld : klasse_manifestation<mod_vtm_aufbau.typ_aktor, mod_vtm_helfer.schnittstelle_xmlknoten> = new klasse_svg_aktor(aktor, stelle);
let knoten_feld : mod_vtm_helfer.schnittstelle_xmlknoten = manifestation_feld.darstellen(); let knoten_feld : mod_vtm_helfer.schnittstelle_xmlknoten = manifestation_feld.darstellen();
kinder_felder.push(knoten_feld); kinder_felder.push(knoten_feld);
} }
@ -85,11 +85,11 @@ module mod_vtm_manifestation
} }
// Figur // Figur
{ {
let figur_ : schnittstelle_fehlermonade<mod_vtm_aufbau.klasse_figur> = this.aufbau.figur_lesen(); let figur_ : schnittstelle_fehlermonade<mod_vtm_aufbau.typ_figur> = mod_vtm_aufbau.partie_figur_lesen(this.aufbau);
if (figur_.ist_schlicht()) if (figur_.ist_schlicht())
{ {
let figur : mod_vtm_aufbau.klasse_figur = figur_.lesen(); let figur : mod_vtm_aufbau.typ_figur = figur_.lesen();
let manifestation_figur : klasse_manifestation<mod_vtm_aufbau.klasse_figur, mod_vtm_helfer.schnittstelle_xmlknoten> = (new klasse_svg_figur(figur)); let manifestation_figur : klasse_manifestation<mod_vtm_aufbau.typ_figur, mod_vtm_helfer.schnittstelle_xmlknoten> = (new klasse_svg_figur(figur));
let knoten_figur : mod_vtm_helfer.schnittstelle_xmlknoten = manifestation_figur.darstellen(); let knoten_figur : mod_vtm_helfer.schnittstelle_xmlknoten = manifestation_figur.darstellen();
kinder_partie.push(knoten_figur); kinder_partie.push(knoten_figur);
} }

View file

@ -33,7 +33,7 @@ module mod_vtm_manifestation
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export class klasse_web_partie export class klasse_web_partie
extends klasse_manifestation<mod_vtm_aufbau.klasse_partie, void> extends klasse_manifestation<mod_vtm_aufbau.typ_partie, void>
{ {
/** /**
@ -51,14 +51,15 @@ module mod_vtm_manifestation
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
public constructor(aufbau : mod_vtm_aufbau.klasse_partie, bereich : Element) public constructor(aufbau : mod_vtm_aufbau.typ_partie, bereich : Element)
{ {
super(aufbau); super(aufbau);
this.bereich = bereich; this.bereich = bereich;
this.intervall = (new klasse_nichts<any>()); this.intervall = (new klasse_nichts<any>());
/* /*
this.aufbau.lauschen mod_vtm_aufbau.partie_lauschen
( (
this.aufbau,
"aenderung_welt", "aenderung_welt",
(angaben) => (angaben) =>
{ {
@ -76,8 +77,9 @@ module mod_vtm_manifestation
*/ */
public einrichten() : void public einrichten() : void
{ {
this.aufbau.lauschen mod_vtm_aufbau.partie_lauschen
( (
this.aufbau,
"aenderung_aufgabe", "aenderung_aufgabe",
(angaben) => (angaben) =>
{ {
@ -85,8 +87,9 @@ module mod_vtm_manifestation
} }
) )
; ;
this.aufbau.lauschen mod_vtm_aufbau.partie_lauschen
( (
this.aufbau,
"aenderung_welt", "aenderung_welt",
(angaben) => (angaben) =>
{ {
@ -94,8 +97,9 @@ module mod_vtm_manifestation
} }
) )
; ;
this.aufbau.lauschen mod_vtm_aufbau.partie_lauschen
( (
this.aufbau,
"aenderung_figur", "aenderung_figur",
(angaben) => (angaben) =>
{ {
@ -103,8 +107,9 @@ module mod_vtm_manifestation
} }
) )
; ;
this.aufbau.lauschen mod_vtm_aufbau.partie_lauschen
( (
this.aufbau,
"aenderung_modus", "aenderung_modus",
(angaben) => (angaben) =>
{ {
@ -123,7 +128,7 @@ module mod_vtm_manifestation
*/ */
private erneuern_aufgabe() : void private erneuern_aufgabe() : void
{ {
document.querySelector("#aufgabe_text").innerHTML = text_nachbearbeiten(this.aufbau.aufgabe_lesen().text()); document.querySelector("#aufgabe_text").innerHTML = text_nachbearbeiten(mod_vtm_aufbau.partie_aufgabe_lesen(this.aufbau).text());
} }
@ -169,7 +174,7 @@ module mod_vtm_manifestation
private erneuern_modus() : void private erneuern_modus() : void
{ {
let status : string; let status : string;
switch (this.aufbau.modus_lesen()) switch (mod_vtm_aufbau.partie_modus_lesen(this.aufbau))
{ {
case mod_vtm_aufbau.modus_initial: case mod_vtm_aufbau.modus_initial:
{ {
@ -207,7 +212,7 @@ module mod_vtm_manifestation
*/ */
public erneuern_knoepfe() : void public erneuern_knoepfe() : void
{ {
let modus : mod_vtm_aufbau.typ_modus = this.aufbau.modus_lesen(); let modus : mod_vtm_aufbau.typ_modus = mod_vtm_aufbau.partie_modus_lesen(this.aufbau);
let klasse : string; let klasse : string;
switch (modus) switch (modus)
{ {
@ -274,8 +279,8 @@ module mod_vtm_manifestation
*/ */
private fortfahren() : void private fortfahren() : void
{ {
this.aufbau.fortfahren(); mod_vtm_aufbau.partie_fortfahren(this.aufbau);
let modus : mod_vtm_aufbau.typ_modus = this.aufbau.modus_lesen(); let modus : mod_vtm_aufbau.typ_modus = mod_vtm_aufbau.partie_modus_lesen(this.aufbau);
if (modus <= 1) if (modus <= 1)
{ {
// nichts tun // nichts tun
@ -304,7 +309,7 @@ module mod_vtm_manifestation
private bearbeiten() : void private bearbeiten() : void
{ {
this.anhalten(); this.anhalten();
this.aufbau.zuruecksetzen(); mod_vtm_aufbau.partie_zuruecksetzen(this.aufbau);
} }
@ -313,8 +318,8 @@ module mod_vtm_manifestation
*/ */
private leeren() : void private leeren() : void
{ {
this.aufbau.welt_leeren(); mod_vtm_aufbau.partie_welt_leeren(this.aufbau);
this.aufbau.zuruecksetzen(); mod_vtm_aufbau.partie_zuruecksetzen(this.aufbau);
} }
@ -350,7 +355,7 @@ module mod_vtm_manifestation
let stelle_ : schnittstelle_fehlermonade<mod_vtm_aufbau.typ_stelle> = stelle_ermitteln(event.target); let stelle_ : schnittstelle_fehlermonade<mod_vtm_aufbau.typ_stelle> = stelle_ermitteln(event.target);
if (stelle_.ist_schlicht()) if (stelle_.ist_schlicht())
{ {
this.aufbau.welt_feld_wechseln(stelle_.lesen(), false); mod_vtm_aufbau.partie_welt_feld_wechseln(this.aufbau, stelle_.lesen(), false);
} }
else else
{ {
@ -369,7 +374,7 @@ module mod_vtm_manifestation
let stelle_ : schnittstelle_fehlermonade<mod_vtm_aufbau.typ_stelle> = stelle_ermitteln(event.target); let stelle_ : schnittstelle_fehlermonade<mod_vtm_aufbau.typ_stelle> = stelle_ermitteln(event.target);
if (stelle_.ist_schlicht()) if (stelle_.ist_schlicht())
{ {
this.aufbau.welt_feld_wechseln(stelle_.lesen(), true); mod_vtm_aufbau.partie_welt_feld_wechseln(this.aufbau, stelle_.lesen(), true);
} }
else else
{ {
@ -389,7 +394,7 @@ module mod_vtm_manifestation
if (stelle_.ist_schlicht()) if (stelle_.ist_schlicht())
{ {
let inkrement : int = ((event["deltaY"] < 0) ? -1 : +1); let inkrement : int = ((event["deltaY"] < 0) ? -1 : +1);
this.aufbau.welt_feld_drehen(stelle_.lesen(), inkrement); mod_vtm_aufbau.partie_welt_feld_drehen(this.aufbau, stelle_.lesen(), inkrement);
} }
else else
{ {