eigentlich fertig :)

This commit is contained in:
Christian Fraß 2018-03-28 11:19:46 +02:00
parent c5282e424c
commit 250b58aa1b
22 changed files with 517 additions and 615 deletions

View file

@ -46,12 +46,8 @@ ${dir_erzeugnis}/vtm.js: \
${dir_quelldatein}/helfer/typen.ts \
${dir_quelldatein}/helfer/aufruf.ts \
${dir_quelldatein}/helfer/brauch.ts \
${dir_quelldatein}/helfer/fehlermonade/_fehlermonade.ts \
${dir_quelldatein}/helfer/fehlermonade/nichts.ts \
${dir_quelldatein}/helfer/fehlermonade/schlicht.ts \
${dir_quelldatein}/helfer/xmlknoten/_xmlknoten.ts \
${dir_quelldatein}/helfer/xmlknoten/text.ts \
${dir_quelldatein}/helfer/xmlknoten/normal.ts \
${dir_quelldatein}/helfer/fehlermonade.ts \
${dir_quelldatein}/helfer/xml.ts \
${dir_quelldatein}/helfer/verschiedenes.ts \
${dir_quelldatein}/helfer/mathematik.ts \
${dir_quelldatein}/helfer/vektor.ts \

View file

@ -134,11 +134,11 @@ module mod_vtm
{
if (figur.band.length <= 0)
{
return (lib_fehlermonade.mod_nichts.erstellen<mod_symbol.typ_symbol>());
return (lib_fehlermonade.erstellen_nichts<mod_symbol.typ_symbol>());
}
else
{
return (lib_fehlermonade.mod_schlicht.erstellen<mod_symbol.typ_symbol>(figur.band[0]));
return (lib_fehlermonade.erstellen_schlicht<mod_symbol.typ_symbol>(figur.band[0]));
}
}

View file

@ -72,7 +72,13 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function lauschen(partie : typ_partie, ereignis : string, prozedur : (angaben ?: any)=>void) : void
export function lauschen
(
partie : typ_partie,
ereignis : string,
prozedur : (angaben ?: any)=>void
)
: void
{
if (ereignis in partie.lauscher)
{
@ -89,7 +95,12 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
function benachrichtigen(partie : typ_partie, ereignis : string, angaben : any = {}) : void
function benachrichtigen
(
partie : typ_partie,
ereignis : string,
angaben : any = {}
) : void
{
if (ereignis in partie.lauscher)
{
@ -113,10 +124,15 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function zuruecksetzen(partie : typ_partie, bescheid_geben : boolean = true) : void
export function zuruecksetzen
(
partie : typ_partie,
bescheid_geben : boolean = true
)
: void
{
partie.figur = (lib_fehlermonade.mod_nichts.erstellen<mod_figur.typ_figur>());
partie.testindex = (lib_fehlermonade.mod_nichts.erstellen<int>());
partie.figur = (lib_fehlermonade.erstellen_nichts<mod_figur.typ_figur>());
partie.testindex = (lib_fehlermonade.erstellen_nichts<int>());
partie.modus = mod_modus.initial;
if (bescheid_geben)
{
@ -133,7 +149,11 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aufgabe_lesen(partie : typ_partie) : mod_aufgabe.typ_aufgabe
export function aufgabe_lesen
(
partie : typ_partie
)
: mod_aufgabe.typ_aufgabe
{
return partie.aufgabe;
}
@ -142,7 +162,11 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aufgabe_setzen(partie : typ_partie, aufgabe : mod_aufgabe.typ_aufgabe) : void
export function aufgabe_setzen
(
partie : typ_partie,
aufgabe : mod_aufgabe.typ_aufgabe
) : void
{
partie.aufgabe = aufgabe;
// partie.welt_leeren();
@ -154,7 +178,11 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function welt_lesen(partie : typ_partie) : mod_welt.typ_welt
export function welt_lesen
(
partie : typ_partie
)
: mod_welt.typ_welt
{
return partie.welt;
}
@ -163,7 +191,13 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function welt_setzen(partie : typ_partie, welt : mod_welt.typ_welt, bescheid_geben : boolean = true) : void
export function welt_setzen
(
partie : typ_partie,
welt : mod_welt.typ_welt,
bescheid_geben : boolean = true
)
: void
{
partie.welt = welt;
if (bescheid_geben)
@ -180,7 +214,12 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function welt_leeren(partie : typ_partie, bescheid_geben : boolean = true) : void
export function welt_leeren
(
partie : typ_partie,
bescheid_geben : boolean = true
)
: void
{
partie.welt = mod_welt.blanko();
if (bescheid_geben)
@ -197,7 +236,11 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function figur_lesen(partie : typ_partie) : lib_fehlermonade.typ_fehlermonade<mod_figur.typ_figur>
export function figur_lesen
(
partie : typ_partie
)
: lib_fehlermonade.typ_fehlermonade<mod_figur.typ_figur>
{
return partie.figur;
}
@ -206,7 +249,11 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function modus_lesen(partie : typ_partie) : mod_modus.typ_modus
export function modus_lesen
(
partie : typ_partie
)
: mod_modus.typ_modus
{
return partie.modus;
}
@ -215,7 +262,13 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function welt_feld_wechseln(partie : typ_partie, stelle : mod_stelle.typ_stelle, umgekehrt : boolean = false) : void
export function welt_feld_wechseln
(
partie : typ_partie,
stelle : mod_stelle.typ_stelle,
umgekehrt : boolean = false
)
: void
{
if (! (partie.modus === mod_modus.initial))
{
@ -246,7 +299,13 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function welt_feld_drehen(partie : typ_partie, stelle : mod_stelle.typ_stelle, inkrement : int = +1) : void
export function welt_feld_drehen
(
partie : typ_partie,
stelle : mod_stelle.typ_stelle,
inkrement : int = +1
)
: void
{
if (! (partie.modus === mod_modus.initial))
{
@ -263,26 +322,30 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function fortfahren(partie : typ_partie) : void
export function fortfahren
(
partie : typ_partie
)
: void
{
switch (partie.modus)
{
case mod_modus.initial:
{
partie.modus = mod_modus.ungewiss;
partie.testindex = (lib_fehlermonade.mod_schlicht.erstellen<int>(0));
partie.testindex = (lib_fehlermonade.erstellen_schlicht<int>(0));
benachrichtigen(partie, "aenderung_modus", {});
break;
}
case mod_modus.ungewiss:
{
if (! lib_fehlermonade.voll(partie.figur))
if (! lib_fehlermonade.voll<mod_figur.typ_figur>(partie.figur))
{
let test : mod_test.typ_test = mod_aufgabe.tests(partie.aufgabe)[lib_fehlermonade.lesen(partie.testindex)];
let test : mod_test.typ_test = mod_aufgabe.tests(partie.aufgabe)[lib_fehlermonade.lesen<int>(partie.testindex)];
let band : Array<mod_symbol.typ_symbol> = mod_vtm.mod_helfer.liste_kopieren<mod_symbol.typ_symbol>(mod_test.eingabe(test));
let stelle : mod_stelle.typ_stelle = mod_welt.erzeuger_finden(partie.welt);
partie.figur = (
lib_fehlermonade.mod_schlicht.erstellen<mod_figur.typ_figur>
lib_fehlermonade.erstellen_schlicht<mod_figur.typ_figur>
(
mod_figur.erstellen
(
@ -294,12 +357,12 @@ module mod_vtm
}
else
{
let figur : mod_figur.typ_figur = lib_fehlermonade.lesen(partie.figur);
let figur : mod_figur.typ_figur = lib_fehlermonade.lesen<mod_figur.typ_figur>(partie.figur);
let stelle : mod_stelle.typ_stelle = mod_figur.stelle_lesen(figur);
let aktor_ : lib_fehlermonade.typ_fehlermonade<mod_aktor.typ_aktor> = mod_welt.feld_holen(partie.welt, stelle);
let aktor : mod_aktor.typ_aktor = (
lib_fehlermonade.voll(aktor_)
? lib_fehlermonade.lesen(aktor_)
lib_fehlermonade.voll<mod_aktor.typ_aktor>(aktor_)
? lib_fehlermonade.lesen<mod_aktor.typ_aktor>(aktor_)
: mod_aktor.mod_verwerfer.erstellen_aktor()
);
mod_aktor.verwenden(aktor, figur);
@ -312,8 +375,8 @@ module mod_vtm
{
let angenommen : boolean = (zustand === mod_zustand.angenommen);
let ausgabe : Array<mod_symbol.typ_symbol> = mod_figur.band_lesen(figur);
partie.figur = (lib_fehlermonade.mod_nichts.erstellen<mod_figur.typ_figur>());
let testindex : int = lib_fehlermonade.lesen(partie.testindex);
partie.figur = (lib_fehlermonade.erstellen_nichts<mod_figur.typ_figur>());
let testindex : int = lib_fehlermonade.lesen<int>(partie.testindex);
let tests : Array<mod_test.typ_test> = mod_aufgabe.tests(partie.aufgabe);
let test : mod_test.typ_test = tests[testindex];
if (! mod_test.pruefen(test, angenommen, ausgabe))
@ -327,12 +390,12 @@ module mod_vtm
if (testindex < tests.length)
{
// nächsten Test auswählen
partie.testindex = (lib_fehlermonade.mod_schlicht.erstellen<int>(testindex));
partie.testindex = (lib_fehlermonade.erstellen_schlicht<int>(testindex));
}
else
{
// auf Modus "korrekt" wechseln
partie.testindex = (lib_fehlermonade.mod_nichts.erstellen<int>());
partie.testindex = (lib_fehlermonade.erstellen_nichts<int>());
partie.modus = mod_modus.korrekt;
benachrichtigen(partie, "aenderung_modus", {});
}

View file

@ -53,7 +53,11 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function felder_lesen(welt : typ_welt) : Array<{stelle : mod_stelle.typ_stelle; aktor : mod_aktor.typ_aktor;}>
export function felder_lesen
(
welt : typ_welt
)
: Array<{stelle : mod_stelle.typ_stelle; aktor : mod_aktor.typ_aktor;}>
{
let felder : Array<{stelle : mod_stelle.typ_stelle; aktor : mod_aktor.typ_aktor;}> = [];
lib_hashmap.iterieren
@ -69,7 +73,12 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function feld_holen(welt : typ_welt, stelle : mod_stelle.typ_stelle) : lib_fehlermonade.typ_fehlermonade<mod_aktor.typ_aktor>
export function feld_holen
(
welt : typ_welt,
stelle : mod_stelle.typ_stelle
)
: lib_fehlermonade.typ_fehlermonade<mod_aktor.typ_aktor>
{
return lib_hashmap.holen(welt.felder, stelle);
}
@ -78,7 +87,13 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function feld_setzen(welt : typ_welt, stelle : mod_stelle.typ_stelle, aktor : mod_aktor.typ_aktor) : void
export function feld_setzen
(
welt : typ_welt,
stelle : mod_stelle.typ_stelle,
aktor : mod_aktor.typ_aktor
)
: void
{
lib_hashmap.setzen(welt.felder, stelle, aktor);
}
@ -87,7 +102,13 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function feld_wechseln(welt : typ_welt, stelle : mod_stelle.typ_stelle, umgekehrt : boolean = false) : void
export function feld_wechseln
(
welt : typ_welt,
stelle : mod_stelle.typ_stelle,
umgekehrt : boolean = false
)
: void
{
let erweitert : boolean = true;
let liste : Array<{pruefer : (aktor : mod_aktor.typ_aktor)=>boolean; ersteller : ()=>mod_aktor.typ_aktor;}> = (
@ -168,7 +189,7 @@ module mod_vtm
);
let index_alt : lib_fehlermonade.typ_fehlermonade<int>;
let aktor_alt_ : lib_fehlermonade.typ_fehlermonade<mod_aktor.typ_aktor> = lib_hashmap.holen(welt.felder, stelle);
if (lib_fehlermonade.voll(aktor_alt_))
if (lib_fehlermonade.voll<mod_aktor.typ_aktor>(aktor_alt_))
{
let aktor_alt : mod_aktor.typ_aktor = lib_fehlermonade.lesen(aktor_alt_);
let gefunden : boolean = (
@ -178,7 +199,7 @@ module mod_vtm
{
if (eintrag.pruefer(aktor_alt))
{
index_alt = (lib_fehlermonade.mod_schlicht.erstellen<int>(index));
index_alt = (lib_fehlermonade.erstellen_schlicht<int>(index));
return true;
}
else
@ -190,7 +211,7 @@ module mod_vtm
);
if (! gefunden)
{
index_alt = (lib_fehlermonade.mod_nichts.erstellen<int>());
index_alt = (lib_fehlermonade.erstellen_nichts<int>());
}
else
{
@ -201,11 +222,11 @@ module mod_vtm
{
let meldung : string = "kein Aktor gesetzt";
// console.warn(meldung);
index_alt = (lib_fehlermonade.mod_schlicht.erstellen<int>(0));
index_alt = (lib_fehlermonade.erstellen_schlicht<int>(0));
}
if (lib_fehlermonade.voll(index_alt))
if (lib_fehlermonade.voll<int>(index_alt))
{
let index_neu : int = lib_mathematik.mod(lib_fehlermonade.lesen(index_alt) + (umgekehrt ? -1 : +1), liste.length);
let index_neu : int = lib_mathematik.mod(lib_fehlermonade.lesen<int>(index_alt) + (umgekehrt ? -1 : +1), liste.length);
let aktor_neu : mod_aktor.typ_aktor = liste[index_neu].ersteller();
feld_setzen(welt, stelle, aktor_neu);
}
@ -221,12 +242,18 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function feld_drehen(welt : typ_welt, stelle : mod_stelle.typ_stelle, inkrement : int = +1) : void
export function feld_drehen
(
welt : typ_welt,
stelle : mod_stelle.typ_stelle,
inkrement : int = +1
)
: void
{
let aktor_ : lib_fehlermonade.typ_fehlermonade<mod_aktor.typ_aktor> = lib_hashmap.holen(welt.felder, stelle);
if (lib_fehlermonade.voll(aktor_))
if (lib_fehlermonade.voll<mod_aktor.typ_aktor>(aktor_))
{
mod_aktor.drehen(lib_fehlermonade.lesen(aktor_), inkrement);
mod_aktor.drehen(lib_fehlermonade.lesen<mod_aktor.typ_aktor>(aktor_), inkrement);
}
else
{
@ -239,9 +266,13 @@ module mod_vtm
* @author kcf <vidofnir@folksprak.org>
* @throws {Error}
*/
export function erzeuger_finden(welt : typ_welt) : mod_stelle.typ_stelle
export function erzeuger_finden
(
welt : typ_welt
)
: mod_stelle.typ_stelle
{
let stelle : lib_fehlermonade.typ_fehlermonade<mod_stelle.typ_stelle> = (lib_fehlermonade.mod_nichts.erstellen<mod_stelle.typ_stelle>());
let stelle : lib_fehlermonade.typ_fehlermonade<mod_stelle.typ_stelle> = (lib_fehlermonade.erstellen_nichts<mod_stelle.typ_stelle>());
lib_hashmap.iterieren
(
welt.felder,
@ -249,22 +280,22 @@ module mod_vtm
{
if (aktor.art === "erzeuger")
{
if (lib_fehlermonade.voll(stelle))
if (lib_fehlermonade.voll<mod_stelle.typ_stelle>(stelle))
{
let meldung : string = "mehrere Erzeuger gefunden";
throw (new Error(meldung));
}
else
{
stelle = (lib_fehlermonade.mod_schlicht.erstellen<mod_stelle.typ_stelle>(stelle_));
stelle = (lib_fehlermonade.erstellen_schlicht<mod_stelle.typ_stelle>(stelle_));
}
}
}
)
;
if (lib_fehlermonade.voll(stelle))
if (lib_fehlermonade.voll<mod_stelle.typ_stelle>(stelle))
{
return lib_fehlermonade.lesen(stelle);
return lib_fehlermonade.lesen<mod_stelle.typ_stelle>(stelle);
}
else
{
@ -277,7 +308,11 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function blanko(groesse : int = 3) : typ_welt
export function blanko
(
groesse : int = 3
)
: typ_welt
{
let welt : typ_welt = erstellen();
for (let u : int = -groesse; u <= +groesse; u += 1)
@ -311,7 +346,11 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function exportieren(welt : typ_welt) : any
export function exportieren
(
welt : typ_welt
)
: any
{
let roh : any = {};
roh["felder"] = {};
@ -333,7 +372,11 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function importieren(roh : any) : typ_welt
export function importieren
(
roh : any
)
: typ_welt
{
let felder : lib_hashmap.typ_hashmap<mod_stelle.typ_stelle, mod_aktor.typ_aktor> = (lib_hashmap.erstellen<mod_stelle.typ_stelle, mod_aktor.typ_aktor>(mod_stelle.hash));
for (let stelle_ in roh["felder"])

View file

@ -44,11 +44,11 @@ module mod_vtm
{
if (schluessel in _speicher)
{
return (lib_fehlermonade.mod_schlicht.erstellen<any>(_speicher[schluessel]));
return (lib_fehlermonade.erstellen_schlicht<any>(_speicher[schluessel]));
}
else
{
return (lib_fehlermonade.mod_nichts.erstellen<any>());
return (lib_fehlermonade.erstellen_nichts<any>());
}
}

View file

@ -153,7 +153,7 @@ module mod_vtm
mod_aufbau.mod_stelle.null_()
)
);
let xmlknoten : mod_vtm.mod_helfer.mod_xml.typ_knoten = (
let xmlknoten : lib_xml.typ_knoten = (
mod_manifestation.mod_svg.wurzel
(
von_x, von_y,
@ -162,7 +162,7 @@ module mod_vtm
[mod_manifestation.darstellen(manifestation)]
)
);
eintrag.bereich.querySelector(".hilfe_aktoren_aktor_bild").innerHTML = mod_vtm.mod_helfer.mod_xml.darstellen(xmlknoten);
eintrag.bereich.querySelector(".hilfe_aktoren_aktor_bild").innerHTML = lib_xml.darstellen(xmlknoten);
}
)
;

View file

@ -0,0 +1,135 @@
/*
* 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 lib_fehlermonade
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
export type typ_fehlermonade<typ_wert> = lib_aufruf.typ_komplex<any>;
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function erstellen_nichts<typ_wert>
(
)
: typ_fehlermonade<typ_wert>
{
return (
lib_aufruf.einpacken<any>
(
"nichts",
{
}
)
);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function erstellen_schlicht<typ_wert>
(
wert : typ_wert
)
: typ_fehlermonade<typ_wert>
{
return (
lib_aufruf.einpacken<any>
(
"schlicht",
{
"wert": wert
}
)
);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function voll<typ_wert>
(
fehlermonade : typ_fehlermonade<typ_wert>
)
: boolean
{
return (
lib_aufruf.fallunterscheidung<any>
(
fehlermonade,
{
"nichts": ({}) => false,
"schlicht": ({"wert": wert}) => true,
}
)
);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function lesen<typ_wert>
(
fehlermonade : typ_fehlermonade<typ_wert>
)
: typ_wert
{
return (
lib_aufruf.fallunterscheidung<any>
(
fehlermonade,
{
"nichts": ({}) => {throw (new Error("lesen von nichts"));},
"schlicht": ({"wert": wert}) => wert,
}
)
);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function fortfuehren<typ_wert1, typ_wert2>
(
fehlermonade : typ_fehlermonade<typ_wert1>,
funktion : (wert1 : typ_wert1)=>typ_fehlermonade<typ_wert2>
)
: typ_fehlermonade<typ_wert2>
{
return (
lib_aufruf.fallunterscheidung<any>
(
fehlermonade,
{
"nichts": ({}) => erstellen_nichts<typ_wert2>(),
"schlicht": ({"wert": wert1}) => funktion(wert1),
}
)
);
}
}

View file

@ -1,63 +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 lib_fehlermonade
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
export type typ_fehlermonade<typ_wert> = lib_aufruf.typ_komplex<typ_wert>;
/**
* @author kcf <vidofnir@folksprak.org>
*/
export type signatur_fehlermonade<typ_wert> =
{
voll : (fehlermonade : typ_fehlermonade<typ_wert>)=>boolean;
lesen : (fehlermonade : typ_fehlermonade<typ_wert>)=>typ_wert;
}
;
/**
* @author kcf <vidofnir@folksprak.org>
*/
export var brauch_fehlermonade : lib_brauch.typ_brauch<signatur_fehlermonade<any>> = lib_brauch.erstellen<signatur_fehlermonade<any>>();
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function voll<typ_wert>(fehlermonade : typ_fehlermonade<typ_wert>) : boolean
{
return lib_brauch.anwenden(brauch_fehlermonade, fehlermonade.art)["voll"](fehlermonade);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function lesen<typ_wert>(fehlermonade : typ_fehlermonade<typ_wert>) : typ_wert
{
return lib_brauch.anwenden(brauch_fehlermonade, fehlermonade.art)["lesen"](fehlermonade);
}
}

View file

@ -1,51 +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 lib_fehlermonade
{
export module mod_nichts
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function erstellen<typ_wert>() : typ_fehlermonade<typ_wert>
{
return lib_aufruf.einpacken<any>("nichts", {});
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
lib_brauch.umsetzen<signatur_fehlermonade<any>>
(
brauch_fehlermonade,
"nichts",
{
"voll": (fehlermonade) => false,
"lesen": (fehlermonade) => {throw (new Error("lesen von nichts"));},
}
)
;
}
}

View file

@ -1,51 +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 lib_fehlermonade
{
export module mod_schlicht
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function erstellen<typ_wert>(wert : typ_wert) : typ_fehlermonade<typ_wert>
{
return lib_aufruf.einpacken<any>("schlicht", {"wert": wert});
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
lib_brauch.umsetzen<signatur_fehlermonade<any>>
(
brauch_fehlermonade,
"schlicht",
{
"voll": (fehlermonade) => true,
"lesen": (fehlermonade) => lib_aufruf.auspacken<any>(fehlermonade).wert,
}
)
;
}
}

View file

@ -76,11 +76,11 @@ module lib_hashmap
if (hashwert in hashmap.speicher)
{
let wert : typ_wert = hashmap.speicher[hashwert].wert;
return (lib_fehlermonade.mod_schlicht.erstellen<typ_wert>(wert));
return (lib_fehlermonade.erstellen_schlicht<typ_wert>(wert));
}
else
{
return (lib_fehlermonade.mod_nichts.erstellen<typ_wert>());
return (lib_fehlermonade.erstellen_nichts<typ_wert>());
}
}

View file

@ -74,20 +74,20 @@ module lib_uebersetzung
let satz : {[schluessel : string] : string} = _daten[sprache];
if (schluessel in satz)
{
return (lib_fehlermonade.mod_schlicht.erstellen<string>(satz[schluessel]));
return (lib_fehlermonade.erstellen_schlicht<string>(satz[schluessel]));
}
else
{
let meldung : string = ("keine Zeichenketten für Schlüssel '" + schluessel + "' in Sprache '" + sprache + "'");
console.warn(meldung);
return (lib_fehlermonade.mod_nichts.erstellen<string>());
return (lib_fehlermonade.erstellen_nichts<string>());
}
}
else
{
let meldung : string = ("keine Zeichenketten für Sprache '" + sprache + "'");
console.warn(meldung);
return (lib_fehlermonade.mod_nichts.erstellen<string>());
return (lib_fehlermonade.erstellen_nichts<string>());
}
}
@ -97,7 +97,7 @@ module lib_uebersetzung
*/
export function holen(schluessel : string, vars : {[name : string] : string} = {}) : string
{
let ergebnis : lib_fehlermonade.typ_fehlermonade<string> = (lib_fehlermonade.mod_nichts.erstellen<string>());
let ergebnis : lib_fehlermonade.typ_fehlermonade<string> = (lib_fehlermonade.erstellen_nichts<string>());
let gefunden : boolean = (
_sprachstapel
.some

156
quelldatein/helfer/xml.ts Normal file
View file

@ -0,0 +1,156 @@
/*
* 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 lib_xml
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
function einrueckung
(
tiefe : int,
zeichen : string = "\t"
)
: string
{
return (
(tiefe === 0)
? ""
: (zeichen + einrueckung(tiefe-1))
);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export type typ_knoten = lib_aufruf.typ_komplex<any>;
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function erstellen_text
(
inhalt : string
)
: typ_knoten
{
return (
lib_aufruf.einpacken
(
"text",
{
"inhalt": inhalt
}
)
);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function erstellen_normal
(
name : string,
attribute : {[schluessel : string] : string} = {},
kinder : Array<typ_knoten> = []
)
: typ_knoten
{
return (
lib_aufruf.einpacken
(
"normal",
{
"name": name,
"attribute": attribute,
"kinder": kinder
}
)
);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function darstellen
(
knoten : typ_knoten,
tiefe : int = 0
)
: string
{
return (
lib_aufruf.fallunterscheidung<any>
(
knoten,
{
"text": ({"inhalt": inhalt}) =>
{
return inhalt;
}
,
"normal": ({"name": name, "attribute": attribute, "kinder": kinder}) =>
{
let str : string = "";
// anfang
{
let str_anfang : string = "";
str_anfang += name;
// attribute
{
let str_attribute : string = "";
Object.keys(attribute).forEach
(
schluessel =>
{
let wert : string = attribute[schluessel];
str_attribute += (" " + schluessel + "=" + ("\"" + wert + "\""));
}
)
;
str_anfang += str_attribute;
}
str_anfang = (einrueckung(tiefe) + "<" + str_anfang + ">" + "\n");
str += str_anfang;
}
// kinder
{
kinder.forEach(kind => (str += darstellen(kind, tiefe+1)));
}
// ende
{
let str_ende : string = "";
str_ende += name;
str_ende = (einrueckung(tiefe) + "<" + "/" + str_ende + ">" + "\n");
str += str_ende;
}
return str;
}
,
}
)
);
}
}

View file

@ -1,63 +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
{
export module mod_helfer
{
export module mod_xml
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
export type typ_knoten = lib_aufruf.typ_komplex<any>;
/**
* @author kcf <vidofnir@folksprak.org>
*/
export type signatur_knoten =
{
darstellen : (knoten : typ_knoten, tiefe : int)=>string;
}
;
/**
* @author kcf <vidofnir@folksprak.org>
*/
export var brauch_knoten : lib_brauch.typ_brauch<signatur_knoten> = lib_brauch.erstellen<signatur_knoten>();
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function darstellen(knoten : typ_knoten, tiefe : int = 0) : string
{
return lib_brauch.anwenden(brauch_knoten, knoten.art)["darstellen"](knoten, tiefe);
}
}
}
}

View file

@ -1,153 +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
{
export module mod_helfer
{
export module mod_xml
{
export module mod_normal
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
function einrueckung(tiefe : int, zeichen : string = "\t") : string
{
return ((tiefe === 0) ? "" : (zeichen + einrueckung(tiefe-1)));
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export type typ_normal =
{
name : string;
attribute : {[schluessel : string] : string};
kinder : Array<typ_knoten>;
}
;
/**
* @author kcf <vidofnir@folksprak.org>
*/
function erstellen
(
name : string,
attribute : {[schluessel : string] : string} = {},
kinder : Array<typ_knoten> = []
)
: typ_normal
{
return {
"name": name,
"attribute": attribute,
"kinder": kinder
};
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function erstellen_erweitert
(
name : string,
attribute : {[schluessel : string] : string} = {},
kinder : Array<typ_knoten> = []
)
: typ_knoten
{
return lib_aufruf.einpacken("normal", erstellen(name, attribute, kinder));
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
function darstellen
(
normal : typ_normal,
tiefe : int
)
: string
{
let str : string = "";
// anfang
{
let str_anfang : string = "";
str_anfang += normal.name;
// attribute
{
let str_attribute : string = "";
Object.keys(normal.attribute).forEach
(
schluessel =>
{
let wert : string = normal.attribute[schluessel];
str_attribute += (" " + schluessel + "=" + ("\"" + wert + "\""));
}
)
;
str_anfang += str_attribute;
}
str_anfang = (einrueckung(tiefe) + "<" + str_anfang + ">" + "\n");
str += str_anfang;
}
// kinder
{
normal.kinder.forEach(kind => (str += mod_xml.darstellen(kind, tiefe+1)));
}
// ende
{
let str_ende : string = "";
str_ende += normal.name;
str_ende = (einrueckung(tiefe) + "<" + "/" + str_ende + ">" + "\n");
str += str_ende;
}
return str;
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
lib_brauch.umsetzen<signatur_knoten>
(
brauch_knoten,
"normal",
{
"darstellen": (knoten, tiefe) => darstellen(knoten.angaben, tiefe),
}
)
;
}
}
}
}

View file

@ -1,103 +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
{
export module mod_helfer
{
export module mod_xml
{
export module mod_text
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
export type typ_text =
{
inhalt : string
}
;
/**
* @author kcf <vidofnir@folksprak.org>
*/
function erstellen
(
inhalt : string
)
: typ_text
{
return {
"inhalt": inhalt
};
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function erstellen_erweitert
(
inhalt : string
)
: typ_knoten
{
return lib_aufruf.einpacken("text", erstellen(inhalt));
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
function darstellen
(
knoten : typ_text,
tiefe : int
)
: string
{
return knoten.inhalt;
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
lib_brauch.umsetzen<signatur_knoten>
(
brauch_knoten,
"text",
{
"darstellen": (knoten, tiefe) => darstellen(knoten.angaben, tiefe),
}
)
;
}
}
}
}

View file

@ -76,10 +76,10 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
function darstellen(aktor_ : typ_aktor) : mod_vtm.mod_helfer.mod_xml.typ_knoten
function darstellen(aktor_ : typ_aktor) : lib_xml.typ_knoten
{
let aktor : mod_vtm.mod_aufbau.mod_aktor.typ_aktor = aktor_.aufbau;
let knoten_rahmen = function () : mod_vtm.mod_helfer.mod_xml.typ_knoten
let knoten_rahmen = function () : lib_xml.typ_knoten
{
return (
pfad
@ -93,7 +93,7 @@ module mod_vtm
);
}
;
let kinder_feld : Array<mod_vtm.mod_helfer.mod_xml.typ_knoten> = [];
let kinder_feld : Array<lib_xml.typ_knoten> = [];
lib_aufruf.fallunterscheidung<void>
(
aktor,
@ -102,8 +102,8 @@ module mod_vtm
{
kinder_feld.push(knoten_rahmen());
let richtung : mod_vtm.mod_aufbau.mod_richtung.typ_richtung = mod_vtm.mod_aufbau.mod_aktor.mod_erzeuger.richtung_lesen(angaben);
let knoten_pfeil : mod_vtm.mod_helfer.mod_xml.typ_knoten = (
mod_vtm.mod_helfer.mod_xml.mod_normal.erstellen_erweitert
let knoten_pfeil : lib_xml.typ_knoten = (
lib_xml.erstellen_normal
(
"path",
{
@ -131,8 +131,8 @@ module mod_vtm
{
kinder_feld.push(knoten_rahmen());
let richtung : mod_vtm.mod_aufbau.mod_richtung.typ_richtung = mod_vtm.mod_aufbau.mod_aktor.mod_befoerderer.richtung_lesen(angaben);
let knoten_pfeil : mod_vtm.mod_helfer.mod_xml.typ_knoten = (
mod_vtm.mod_helfer.mod_xml.mod_normal.erstellen_erweitert
let knoten_pfeil : lib_xml.typ_knoten = (
lib_xml.erstellen_normal
(
"path",
{
@ -161,8 +161,8 @@ module mod_vtm
kinder_feld.push(knoten_rahmen());
let richtung : mod_vtm.mod_aufbau.mod_richtung.typ_richtung = mod_vtm.mod_aufbau.mod_aktor.mod_schreiber.richtung_lesen(angaben);
let symbol : mod_vtm.mod_aufbau.mod_symbol.typ_symbol = mod_vtm.mod_aufbau.mod_aktor.mod_schreiber.symbol_lesen(angaben);
let knoten_pfeil : mod_vtm.mod_helfer.mod_xml.typ_knoten = (
mod_vtm.mod_helfer.mod_xml.mod_normal.erstellen_erweitert
let knoten_pfeil : lib_xml.typ_knoten = (
lib_xml.erstellen_normal
(
"path",
{
@ -196,15 +196,15 @@ module mod_vtm
[
{
"summand": 0,
"symbol": lib_fehlermonade.mod_nichts.erstellen<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>(),
"symbol": lib_fehlermonade.erstellen_nichts<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>(),
},
{
"summand": +2,
"symbol": lib_fehlermonade.mod_schlicht.erstellen<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>(symbol_links),
"symbol": lib_fehlermonade.erstellen_schlicht<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>(symbol_links),
},
{
"summand": -2,
"symbol": lib_fehlermonade.mod_schlicht.erstellen<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>(symbol_rechts),
"symbol": lib_fehlermonade.erstellen_schlicht<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>(symbol_rechts),
},
]
;
@ -213,8 +213,8 @@ module mod_vtm
eintrag =>
{
let winkel : float = ((mod_vtm.mod_aufbau.mod_richtung.addieren(richtung, eintrag.summand) / 6) * 360);
let knoten_pfeil : mod_vtm.mod_helfer.mod_xml.typ_knoten = (
mod_vtm.mod_helfer.mod_xml.mod_normal.erstellen_erweitert
let knoten_pfeil : lib_xml.typ_knoten = (
lib_xml.erstellen_normal
(
"path",
{
@ -223,8 +223,8 @@ module mod_vtm
[
"pfeil",
(
lib_fehlermonade.voll(eintrag.symbol)
? "symbol_" + lib_fehlermonade.lesen(eintrag.symbol).toFixed(0)
lib_fehlermonade.voll<mod_aufbau.mod_symbol.typ_symbol>(eintrag.symbol)
? "symbol_" + lib_fehlermonade.lesen<mod_aufbau.mod_symbol.typ_symbol>(eintrag.symbol).toFixed(0)
: "neutral"
),
].join(" ")
@ -249,8 +249,8 @@ module mod_vtm
"verwerfer": (angaben) =>
{
kinder_feld.push(knoten_rahmen());
let knoten_kreis : mod_vtm.mod_helfer.mod_xml.typ_knoten = (
mod_vtm.mod_helfer.mod_xml.mod_normal.erstellen_erweitert
let knoten_kreis : lib_xml.typ_knoten = (
lib_xml.erstellen_normal
(
"circle",
{
@ -272,8 +272,8 @@ module mod_vtm
"annehmer": (angaben) =>
{
kinder_feld.push(knoten_rahmen());
let knoten_kreis : mod_vtm.mod_helfer.mod_xml.typ_knoten = (
mod_vtm.mod_helfer.mod_xml.mod_normal.erstellen_erweitert
let knoten_kreis : lib_xml.typ_knoten = (
lib_xml.erstellen_normal
(
"circle",
{
@ -296,8 +296,8 @@ module mod_vtm
)
;
let position : mod_position.typ_position = mod_position.von_stelle(aktor_.stelle);
let knoten_feld : mod_vtm.mod_helfer.mod_xml.typ_knoten = (
mod_vtm.mod_helfer.mod_xml.mod_normal.erstellen_erweitert
let knoten_feld : lib_xml.typ_knoten = (
lib_xml.erstellen_normal
(
"g",
{

View file

@ -76,14 +76,14 @@ module mod_vtm
(
figur_ : typ_figur
)
: mod_vtm.mod_helfer.mod_xml.typ_knoten
: lib_xml.typ_knoten
{
let figur : mod_vtm.mod_aufbau.mod_figur.typ_figur = figur_.aufbau;
let kinder_figur : Array<mod_vtm.mod_helfer.mod_xml.typ_knoten> = [];
let kinder_figur : Array<lib_xml.typ_knoten> = [];
// Stein
{
let knoten_stein : mod_vtm.mod_helfer.mod_xml.typ_knoten = (
mod_vtm.mod_helfer.mod_xml.mod_normal.erstellen_erweitert
let knoten_stein : lib_xml.typ_knoten = (
lib_xml.erstellen_normal
(
"circle",
{
@ -99,7 +99,7 @@ module mod_vtm
// Band
{
let band : Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol> = mod_vtm.mod_aufbau.mod_figur.band_lesen(figur);
let kinder_band : Array<mod_vtm.mod_helfer.mod_xml.typ_knoten> = [];
let kinder_band : Array<lib_xml.typ_knoten> = [];
band.forEach
(
(symbol, index) =>
@ -107,8 +107,8 @@ module mod_vtm
let r : float = 0.06125;
let x : float = (+0.1+(2*r*1.25)*index);
let y : float = (-0.1);
let knoten_eintrag : mod_vtm.mod_helfer.mod_xml.typ_knoten = (
mod_vtm.mod_helfer.mod_xml.mod_normal.erstellen_erweitert
let knoten_eintrag : lib_xml.typ_knoten = (
lib_xml.erstellen_normal
(
"circle",
{
@ -135,7 +135,7 @@ module mod_vtm
)
;
let knoten_band = (
mod_vtm.mod_helfer.mod_xml.mod_normal.erstellen_erweitert
lib_xml.erstellen_normal
(
"g",
{
@ -148,7 +148,7 @@ module mod_vtm
}
let position : mod_position.typ_position = mod_position.von_stelle(mod_vtm.mod_aufbau.mod_figur.stelle_lesen(figur));
let knoten_figur = (
mod_vtm.mod_helfer.mod_xml.mod_normal.erstellen_erweitert
lib_xml.erstellen_normal
(
"g",
{

View file

@ -64,27 +64,27 @@ module mod_vtm
/**
* @author kcf <vidofnir@folksprak.org>
*/
function darstellen(partie : typ_partie) : mod_vtm.mod_helfer.mod_xml.typ_knoten
function darstellen(partie : typ_partie) : lib_xml.typ_knoten
{
let kinder_partie : Array<mod_vtm.mod_helfer.mod_xml.typ_knoten> = [];
let kinder_partie : Array<lib_xml.typ_knoten> = [];
// Welt
{
let kinder_welt : Array<mod_vtm.mod_helfer.mod_xml.typ_knoten> = [];
let kinder_welt : Array<lib_xml.typ_knoten> = [];
// Felder
{
let kinder_felder : Array<mod_vtm.mod_helfer.mod_xml.typ_knoten> = [];
let kinder_felder : Array<lib_xml.typ_knoten> = [];
mod_vtm.mod_aufbau.mod_welt.felder_lesen(mod_vtm.mod_aufbau.mod_partie.welt_lesen(partie.aufbau)).forEach
(
({"stelle": stelle, "aktor": aktor}) =>
{
let manifestation_feld : typ_manifestation<mod_vtm.mod_aufbau.mod_aktor.typ_aktor> = mod_aktor.erstellen_manifestation(aktor, stelle);
let knoten_feld : mod_vtm.mod_helfer.mod_xml.typ_knoten = mod_manifestation.darstellen(manifestation_feld);
let knoten_feld : lib_xml.typ_knoten = mod_manifestation.darstellen(manifestation_feld);
kinder_felder.push(knoten_feld);
}
)
;
let knoten_felder : mod_vtm.mod_helfer.mod_xml.typ_knoten = (
mod_vtm.mod_helfer.mod_xml.mod_normal.erstellen_erweitert
let knoten_felder : lib_xml.typ_knoten = (
lib_xml.erstellen_normal
(
"g",
{
@ -96,8 +96,8 @@ module mod_vtm
);
kinder_welt.push(knoten_felder);
}
let knoten_welt : mod_vtm.mod_helfer.mod_xml.typ_knoten = (
mod_vtm.mod_helfer.mod_xml.mod_normal.erstellen_erweitert
let knoten_welt : lib_xml.typ_knoten = (
lib_xml.erstellen_normal
(
"g",
{
@ -115,7 +115,7 @@ module mod_vtm
{
let figur : mod_vtm.mod_aufbau.mod_figur.typ_figur = lib_fehlermonade.lesen(figur_);
let manifestation_figur : typ_manifestation<mod_vtm.mod_aufbau.mod_figur.typ_figur> = mod_figur.erstellen_manifestation(figur);
let knoten_figur : mod_vtm.mod_helfer.mod_xml.typ_knoten = mod_manifestation.darstellen(manifestation_figur);
let knoten_figur : lib_xml.typ_knoten = mod_manifestation.darstellen(manifestation_figur);
kinder_partie.push(knoten_figur);
}
else
@ -123,8 +123,8 @@ module mod_vtm
// nichts tun
}
}
let knoten_partie : mod_vtm.mod_helfer.mod_xml.typ_knoten = (
mod_vtm.mod_helfer.mod_xml.mod_normal.erstellen_erweitert
let knoten_partie : lib_xml.typ_knoten = (
lib_xml.erstellen_normal
(
"g",
{

View file

@ -46,7 +46,7 @@ module mod_vtm
schliessen : boolean = true,
attribute : {[schlussel : string] : string} = {},
)
: mod_vtm.mod_helfer.mod_xml.typ_knoten
: lib_xml.typ_knoten
{
let d : string = "";
vertices.forEach
@ -63,7 +63,7 @@ module mod_vtm
if (schliessen)
d += "Z";
attribute["d"] = d;
return (mod_vtm.mod_helfer.mod_xml.mod_normal.erstellen_erweitert("path", attribute));
return (lib_xml.erstellen_normal("path", attribute));
}
@ -78,12 +78,12 @@ module mod_vtm
bis_y : float,
hoehe : int = 500,
breite : int = 500,
kinder : Array<mod_vtm.mod_helfer.mod_xml.typ_knoten> = []
kinder : Array<lib_xml.typ_knoten> = []
)
: mod_vtm.mod_helfer.mod_xml.typ_knoten
: lib_xml.typ_knoten
{
return (
mod_vtm.mod_helfer.mod_xml.mod_normal.erstellen_erweitert
lib_xml.erstellen_normal
(
"svg",
{

View file

@ -63,7 +63,7 @@ module mod_vtm
return {
"aufbau": aufbau,
"bereich": bereich,
"intervall": (lib_fehlermonade.mod_nichts.erstellen<any>()),
"intervall": (lib_fehlermonade.erstellen_nichts<any>()),
};
}
@ -107,7 +107,7 @@ module mod_vtm
*/
function erneuern_welt(partie : typ_partie) : void
{
let knoten_svg : mod_vtm.mod_helfer.mod_xml.typ_knoten = mod_svg.wurzel
let knoten_svg : lib_xml.typ_knoten = mod_svg.wurzel
(
-4, -4,
+4, +4,
@ -115,7 +115,7 @@ module mod_vtm
[mod_manifestation.darstellen(mod_svg.mod_partie.erstellen_manifestation(partie.aufbau))]
)
;
partie.bereich.innerHTML = mod_vtm.mod_helfer.mod_xml.darstellen(knoten_svg);
partie.bereich.innerHTML = lib_xml.darstellen(knoten_svg);
}
@ -124,7 +124,7 @@ module mod_vtm
*/
function erneuern_figur(partie : typ_partie) : void
{
let knoten_svg : mod_vtm.mod_helfer.mod_xml.typ_knoten = mod_svg.wurzel
let knoten_svg : lib_xml.typ_knoten = mod_svg.wurzel
(
-4, -4,
+4, +4,
@ -132,7 +132,7 @@ module mod_vtm
[mod_manifestation.darstellen(mod_svg.mod_partie.erstellen_manifestation(partie.aufbau))]
)
;
partie.bereich.innerHTML = mod_vtm.mod_helfer.mod_xml.darstellen(knoten_svg);
partie.bereich.innerHTML = lib_xml.darstellen(knoten_svg);
}
@ -192,7 +192,7 @@ module mod_vtm
case mod_vtm.mod_aufbau.mod_modus.ungewiss:
{
klasse = (
lib_fehlermonade.lesen(partie.intervall)
lib_fehlermonade.voll<any>(partie.intervall)
? "ungewiss_laufend"
: "ungewiss_stehend"
);
@ -235,7 +235,7 @@ module mod_vtm
if (lib_fehlermonade.voll(partie.intervall))
{
clearInterval(lib_fehlermonade.lesen(partie.intervall));
partie.intervall = (lib_fehlermonade.mod_nichts.erstellen<any>());
partie.intervall = (lib_fehlermonade.erstellen_nichts<any>());
}
else
{
@ -271,7 +271,7 @@ module mod_vtm
function testen(partie : typ_partie) : void
{
let handle : any = setInterval(() => fortfahren(partie), 500);
partie.intervall = (lib_fehlermonade.mod_schlicht.erstellen<any>(handle));
partie.intervall = (lib_fehlermonade.erstellen_schlicht<any>(handle));
}
@ -306,12 +306,12 @@ module mod_vtm
let dom_feld : Element = target["closest"](".feld");
if (dom_feld == null)
{
stelle = (lib_fehlermonade.mod_nichts.erstellen<mod_vtm.mod_aufbau.mod_stelle.typ_stelle>());
stelle = (lib_fehlermonade.erstellen_nichts<mod_vtm.mod_aufbau.mod_stelle.typ_stelle>());
}
else
{
let rel : string = dom_feld.getAttribute("rel")
stelle = (lib_fehlermonade.mod_schlicht.erstellen<mod_vtm.mod_aufbau.mod_stelle.typ_stelle>(mod_vtm.mod_aufbau.mod_stelle.von_hash(rel)));
stelle = (lib_fehlermonade.erstellen_schlicht<mod_vtm.mod_aufbau.mod_stelle.typ_stelle>(mod_vtm.mod_aufbau.mod_stelle.von_hash(rel)));
}
return stelle;
}

View file

@ -1,7 +0,0 @@
s:mod_aktor_annehmer:mod_aktor.mod_annehmer:g
s:mod_aktor_verwerfer:mod_aktor.mod_verwerfer:g
s:mod_aktor_erzeuger:mod_aktor.mod_erzeuger:g
s:mod_aktor_schreiber:mod_aktor.mod_schreiber:g
s:mod_aktor_leser:mod_aktor.mod_leser:g
s:mod_aktor_befoerderer:mod_aktor.mod_befoerderer:g