sicherung
This commit is contained in:
parent
880d5dc708
commit
da3cf639bd
BIN
dokumente/bildschirmfoto.png
Normal file
BIN
dokumente/bildschirmfoto.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
2
makefile
2
makefile
|
|
@ -45,6 +45,7 @@ erzeugnis/vtm.js: \
|
|||
quelldatein/aufbau/akzeptoraufgabe.ts \
|
||||
quelldatein/aufbau/transduktoraufgabe.ts \
|
||||
quelldatein/aufbau/aufgabe_.ts \
|
||||
quelldatein/aufbau/modus.ts \
|
||||
quelldatein/aufbau/partie.ts \
|
||||
quelldatein/manifestation/manifestation.ts \
|
||||
quelldatein/manifestation/position.ts \
|
||||
|
|
@ -86,6 +87,7 @@ erzeugnis/vtm.js: \
|
|||
quelldatein/aufbau/akzeptoraufgabe.ts \
|
||||
quelldatein/aufbau/transduktoraufgabe.ts \
|
||||
quelldatein/aufbau/aufgabe_.ts \
|
||||
quelldatein/aufbau/modus.ts \
|
||||
quelldatein/aufbau/partie.ts \
|
||||
quelldatein/manifestation/manifestation.ts \
|
||||
quelldatein/manifestation/position.ts \
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ module mod_vtm_aufbau
|
|||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
drehen() : void;
|
||||
drehen(inkrement ?: int) : void;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ module mod_vtm_aufbau
|
|||
* @author kcf <vidofnir@folksprak.org>
|
||||
* @implementation
|
||||
*/
|
||||
public drehen() : void
|
||||
public drehen(inkrement ?: int) : void
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,9 +54,9 @@ module mod_vtm_aufbau
|
|||
* @author kcf <vidofnir@folksprak.org>
|
||||
* @implementation
|
||||
*/
|
||||
public drehen() : void
|
||||
public drehen(inkrement : int = +1) : void
|
||||
{
|
||||
this.richtung = richtung_addieren(this.richtung, +1);
|
||||
this.richtung = richtung_addieren(this.richtung, inkrement);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -54,9 +54,9 @@ module mod_vtm_aufbau
|
|||
* @author kcf <vidofnir@folksprak.org>
|
||||
* @implementation
|
||||
*/
|
||||
public drehen() : void
|
||||
public drehen(inkrement : int = +1) : void
|
||||
{
|
||||
this.richtung = richtung_addieren(this.richtung, +1);
|
||||
this.richtung = richtung_addieren(this.richtung, inkrement);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -86,9 +86,9 @@ module mod_vtm_aufbau
|
|||
* @author kcf <vidofnir@folksprak.org>
|
||||
* @implementation
|
||||
*/
|
||||
public drehen() : void
|
||||
public drehen(inkrement : int = +1) : void
|
||||
{
|
||||
this.richtung = richtung_addieren(this.richtung, +1);
|
||||
this.richtung = richtung_addieren(this.richtung, inkrement);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
37
quelldatein/aufbau/modus.ts
Normal file
37
quelldatein/aufbau/modus.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* 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 type typ_modus = int;
|
||||
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
export const modus_initial = 0;
|
||||
export const modus_ungewiss = 1;
|
||||
export const modus_fehlerhaft = 2;
|
||||
export const modus_korrekt = 3;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -19,21 +19,6 @@
|
|||
module mod_vtm_aufbau
|
||||
{
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
export type typ_modus = int;
|
||||
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
export const modus_initial = 0;
|
||||
export const modus_ungewiss = 1;
|
||||
export const modus_fehlerhaft = 2;
|
||||
export const modus_korrekt = 3;
|
||||
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
|
|
@ -70,6 +55,12 @@ module mod_vtm_aufbau
|
|||
private modus : typ_modus;
|
||||
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
private lauscher : {[ereignis : string] : Array<(angaben ?: any)=>void>};
|
||||
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
|
|
@ -84,6 +75,62 @@ module mod_vtm_aufbau
|
|||
this.figur = (new klasse_nichts<klasse_figur>());
|
||||
this.testindex = (new klasse_nichts<int>());
|
||||
this.modus = modus_initial;
|
||||
this.lauscher = {
|
||||
"aenderung_aufgabe": [],
|
||||
"aenderung_welt": [],
|
||||
"aenderung_figur": [],
|
||||
"aenderung_modus": [],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
public lauschen(ereignis : string, prozedur : (angaben ?: any)=>void) : void
|
||||
{
|
||||
if (ereignis in this.lauscher)
|
||||
{
|
||||
this.lauscher[ereignis].push(prozedur);
|
||||
}
|
||||
else
|
||||
{
|
||||
let meldung : string = "kein Ereignis mit diesem Name";
|
||||
throw (new Error(meldung));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
private benachrichtigen(ereignis : string, angaben : any = {}) : void
|
||||
{
|
||||
if (ereignis in this.lauscher)
|
||||
{
|
||||
this.lauscher[ereignis].forEach
|
||||
(
|
||||
prozedur =>
|
||||
{
|
||||
prozedur(angaben);
|
||||
}
|
||||
)
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
let meldung : string = "kein Ereignis mit diesem Name";
|
||||
throw (new Error(meldung));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
public aufgabe_lesen() : schnittstelle_aufgabe
|
||||
{
|
||||
return this.aufgabe;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -122,6 +169,42 @@ module mod_vtm_aufbau
|
|||
this.figur = (new klasse_nichts<klasse_figur>());
|
||||
this.testindex = (new klasse_nichts<int>());
|
||||
this.modus = modus_initial;
|
||||
this.benachrichtigen("aenderung_figur", {});
|
||||
this.benachrichtigen("aenderung_modus", {});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
public welt_feld_wechseln(stelle : typ_stelle, umgekehrt : boolean = false) : void
|
||||
{
|
||||
if (! (this.modus === mod_vtm_aufbau.modus_initial))
|
||||
{
|
||||
let meldung : string = "gesperrt";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.welt.feld_wechseln(stelle, umgekehrt);
|
||||
this.benachrichtigen("aenderung_welt", {});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
public welt_feld_drehen(stelle : typ_stelle, inkrement : int = +1) : void
|
||||
{
|
||||
if (! (this.modus === mod_vtm_aufbau.modus_initial))
|
||||
{
|
||||
let meldung : string = "gesperrt";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.welt.feld_drehen(stelle, inkrement);
|
||||
this.benachrichtigen("aenderung_welt", {});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -136,6 +219,7 @@ module mod_vtm_aufbau
|
|||
{
|
||||
this.modus = modus_ungewiss;
|
||||
this.testindex = (new klasse_schlicht<int>(0));
|
||||
this.benachrichtigen("aenderung_modus", {});
|
||||
break;
|
||||
}
|
||||
case modus_ungewiss:
|
||||
|
|
@ -146,7 +230,17 @@ module mod_vtm_aufbau
|
|||
let testindex : int = this.testindex.lesen();
|
||||
let test : schnittstelle_test = tests[testindex];
|
||||
let stelle : typ_stelle = this.welt.erzeuger_finden();
|
||||
this.figur = (new klasse_schlicht<klasse_figur>(new klasse_figur(test.eingabe(), stelle)));
|
||||
this.figur = (
|
||||
new klasse_schlicht<klasse_figur>
|
||||
(
|
||||
new klasse_figur
|
||||
(
|
||||
mod_vtm_helfer.liste_kopieren<typ_symbol>(test.eingabe()),
|
||||
stelle
|
||||
)
|
||||
)
|
||||
);
|
||||
this.benachrichtigen("aenderung_figur", {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -171,6 +265,7 @@ module mod_vtm_aufbau
|
|||
if (! test.pruefen(angenommen, ausgabe))
|
||||
{
|
||||
this.modus = modus_fehlerhaft;
|
||||
this.benachrichtigen("aenderung_modus", {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -180,6 +275,7 @@ module mod_vtm_aufbau
|
|||
// auf Modus "korrekt" wechseln
|
||||
this.testindex = (new klasse_nichts<int>());
|
||||
this.modus = modus_korrekt;
|
||||
this.benachrichtigen("aenderung_modus", {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -193,6 +289,7 @@ module mod_vtm_aufbau
|
|||
let meldung : string = "unbehandelter Zustand";
|
||||
throw (new Error(meldung));
|
||||
}
|
||||
this.benachrichtigen("aenderung_figur", {});
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,9 +70,9 @@ module mod_vtm_aufbau
|
|||
* @author kcf <vidofnir@folksprak.org>
|
||||
* @implementation
|
||||
*/
|
||||
public drehen() : void
|
||||
public drehen(inkrement : int = +1) : void
|
||||
{
|
||||
this.richtung = richtung_addieren(this.richtung, +1);
|
||||
this.richtung = richtung_addieren(this.richtung, inkrement);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -64,8 +64,6 @@ module mod_vtm_aufbau
|
|||
*/
|
||||
public pruefen(angenommen : boolean, ausgabe : Array<typ_symbol>) : boolean
|
||||
{
|
||||
console.info(this.ausgabe);
|
||||
console.info(ausgabe);
|
||||
if (this.ausgabe.length !== ausgabe.length)
|
||||
{
|
||||
return false;
|
||||
|
|
@ -77,7 +75,6 @@ console.info(ausgabe);
|
|||
{
|
||||
if (! symbol_vergleichen(this.ausgabe[index], ausgabe[index]))
|
||||
{
|
||||
console.info("ungleichheit bei Index " + index.toFixed(0));
|
||||
gleich = false;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ module mod_vtm_aufbau
|
|||
* @author kcf <vidofnir@folksprak.org>
|
||||
* @implementation
|
||||
*/
|
||||
public drehen() : void
|
||||
public drehen(inkrement ?: int) : void
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ module mod_vtm_aufbau
|
|||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
public feld_wechseln(stelle : typ_stelle) : void
|
||||
public feld_wechseln(stelle : typ_stelle, umgekehrt : boolean = false) : void
|
||||
{
|
||||
let erweitert : boolean = true;
|
||||
let liste : Array<{pruefer : (aktor : schnittstelle_aktor)=>boolean; ersteller : ()=>schnittstelle_aktor;}> = (
|
||||
|
|
@ -198,7 +198,7 @@ module mod_vtm_aufbau
|
|||
// console.warn(meldung);
|
||||
index = 0;
|
||||
}
|
||||
let aktor_neu : schnittstelle_aktor = liste[mod_vtm_helfer.mod(index+1, liste.length)].ersteller();
|
||||
let aktor_neu : schnittstelle_aktor = liste[mod_vtm_helfer.mod(index + (umgekehrt ? -1 : +1), liste.length)].ersteller();
|
||||
this.feld_setzen(stelle, aktor_neu);
|
||||
}
|
||||
|
||||
|
|
@ -206,12 +206,12 @@ module mod_vtm_aufbau
|
|||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
public feld_drehen(stelle : typ_stelle) : void
|
||||
public feld_drehen(stelle : typ_stelle, inkrement : int = +1) : void
|
||||
{
|
||||
let aktor_ : schnittstelle_fehlermonade<schnittstelle_aktor> = this.felder.holen(stelle);
|
||||
if (aktor_.ist_schlicht)
|
||||
{
|
||||
aktor_.lesen().drehen();
|
||||
aktor_.lesen().drehen(inkrement);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -110,24 +110,37 @@ jsonp_behandlung(
|
|||
{
|
||||
"art": "transduktor",
|
||||
"parameter": {
|
||||
"titel": "Filter",
|
||||
"text": "aus der Eingabe alle ${s0} beibehalten und alle ${s1} entfernen",
|
||||
"titel": "An den Anfang",
|
||||
"text": "die Eingabe, aber mit dem letzten Symbol am Anfang",
|
||||
"tests": [
|
||||
{
|
||||
"eingabe": [0,0,1,1,1,0,1,0,1,1,1,0,1],
|
||||
"ausgabe": [1,0,0,1,1,1,0,1,0,1,1,1,0]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"art": "transduktor",
|
||||
"parameter": {
|
||||
"titel": "Wählerisch",
|
||||
"text": "aus der Eingabe alle ${s0} entfernen und alle ${s1} beibehalten",
|
||||
"tests": [
|
||||
{
|
||||
"eingabe": [0,0,0,1,0],
|
||||
"ausgabe": [0,0,0,0]
|
||||
"ausgabe": [1]
|
||||
},
|
||||
{
|
||||
"eingabe": [1,0,1,0,1],
|
||||
"ausgabe": [0,0,0]
|
||||
"ausgabe": [1,1,1]
|
||||
},
|
||||
{
|
||||
"eingabe": [1,1,1,1,0],
|
||||
"ausgabe": [0]
|
||||
"ausgabe": [1,1,1,1]
|
||||
},
|
||||
{
|
||||
"eingabe": [0,1,1,0,0,1,0,1,1,1,0,1,0,0,1,1,1,1,1,1,0,1,0,1],
|
||||
"ausgabe": [0,0,0,0,0,0,0,0,0]
|
||||
"ausgabe": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -148,6 +161,60 @@ jsonp_behandlung(
|
|||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"art": "akzeptor",
|
||||
"parameter": {
|
||||
"titel": "ungerade Zahlen",
|
||||
"text": "Mit ${s0} als 0 und ${s1} als 1, nur ungerade Zahlen",
|
||||
"tests": [
|
||||
{
|
||||
"eingabe": [],
|
||||
"annehmen": false
|
||||
},
|
||||
{
|
||||
"eingabe": [],
|
||||
"annehmen": false
|
||||
},
|
||||
{
|
||||
"eingabe": [],
|
||||
"annehmen": false
|
||||
},
|
||||
{
|
||||
"eingabe": [],
|
||||
"annehmen": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"art": "akzeptor",
|
||||
"parameter": {
|
||||
"titel": "a^n b^n",
|
||||
"text": "Jaja, die berühmt berüchtige Sprache, die sich mit einem endlichen Automaten nicht erkennen lässt … Das ist deine Chance zu zeigen, dass dieses Ding hier mehr ist als so ein kümmerlicher DEA … und das ganz ohne Kellerspeicher! Also: Eine beliebige Anzahl an ${s0}, dann die gleiche Anzahl an ${s1}!",
|
||||
"tests": [
|
||||
{
|
||||
"eingabe": [],
|
||||
"annehmen": true
|
||||
},
|
||||
{
|
||||
"eingabe": [0],
|
||||
"annehmen": false
|
||||
},
|
||||
{
|
||||
"eingabe": [0,0,1,1],
|
||||
"annehmen": true
|
||||
},
|
||||
{
|
||||
"eingabe": [0,0,0,1,1],
|
||||
"annehmen": false
|
||||
},
|
||||
{
|
||||
"eingabe": [0,0,0,0,0,0,0,1,1,1,1,1,1,1],
|
||||
"annehmen": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,13 @@ function aufgaben_eintragen(behandler : (aufgabe : mod_vtm_aufbau.schnittstelle_
|
|||
}
|
||||
// Option eintragen
|
||||
{
|
||||
let titel : string = aufgabe_roh["parameter"]["titel"];
|
||||
let praefix : string = (
|
||||
{
|
||||
"akzeptor": "AKZ",
|
||||
"transduktor": "TRA",
|
||||
}[aufgabe_roh["art"]]
|
||||
);
|
||||
let titel : string = ("[" + praefix + "]" + " " + aufgabe_roh["parameter"]["titel"]);
|
||||
let value : string = index.toFixed(0);
|
||||
let dom_option : Element = document.createElement("option");
|
||||
dom_option.setAttribute("value", value);
|
||||
|
|
@ -75,7 +81,6 @@ function haupt() : void
|
|||
let aufbau : mod_vtm_aufbau.klasse_partie;
|
||||
let aufgabe_laden = function (aufgabe : mod_vtm_aufbau.schnittstelle_aufgabe) : void
|
||||
{
|
||||
document.querySelector("#aufgabe_text").textContent = aufgabe.text();
|
||||
aufbau = (new mod_vtm_aufbau.klasse_partie(aufgabe));
|
||||
let manifestation : mod_vtm_manifestation.klasse_manifestation<mod_vtm_aufbau.klasse_partie, void> = (
|
||||
new mod_vtm_manifestation.klasse_web_partie(aufbau, document.querySelector("#bereich_mitte"))
|
||||
|
|
|
|||
|
|
@ -27,5 +27,24 @@ module mod_vtm_helfer
|
|||
return ((laenge <= 0) ? [] : sequenz(laenge-1).concat([laenge-1]));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
export function liste_kopieren<type_element>(liste : Array<type_element>, element_kopieren : (element : type_element)=>type_element = (x => x)) : Array<type_element>
|
||||
{
|
||||
let liste_ : Array<type_element> = [];
|
||||
liste.forEach
|
||||
(
|
||||
element =>
|
||||
{
|
||||
let element_ : type_element = element_kopieren(element);
|
||||
liste_.push(element);
|
||||
}
|
||||
)
|
||||
;
|
||||
return liste_;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -198,8 +198,8 @@ module mod_vtm_manifestation
|
|||
[
|
||||
|
||||
"rotate(" + winkel.toFixed(svg_float_praezission) + ")",
|
||||
"translate(0, 0)",
|
||||
"scale(0.1)",
|
||||
"translate(0.1, 0)",
|
||||
"scale(0.075)",
|
||||
].join(" ")
|
||||
),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,21 +28,25 @@
|
|||
.symbol_0
|
||||
{
|
||||
fill: hsl(000.0000000000000, 50%, 50%);
|
||||
background-color: hsl(000.0000000000000, 50%, 50%);
|
||||
}
|
||||
|
||||
.symbol_1
|
||||
{
|
||||
fill: hsl(222.4922359499621, 50%, 50%);
|
||||
background-color: hsl(222.4922359499621, 50%, 50%);
|
||||
}
|
||||
|
||||
.symbol_2
|
||||
{
|
||||
fill: hsl(084.9844718999243, 50%, 50%);
|
||||
background-color: hsl(084.9844718999243, 50%, 50%);
|
||||
}
|
||||
|
||||
.symbol_3
|
||||
{
|
||||
fill: hsl(307.4767078498864, 50%, 50%);
|
||||
background-color: hsl(307.4767078498864, 50%, 50%);
|
||||
}
|
||||
|
||||
.kreis
|
||||
|
|
|
|||
|
|
@ -19,6 +19,16 @@
|
|||
module mod_vtm_manifestation
|
||||
{
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
function text_nachbearbeiten(text : string) : string
|
||||
{
|
||||
let regexp : RegExp = (new RegExp("\\$\{s(\\d*)\}", "g"));
|
||||
return text.replace(regexp, "<span class=\"symbol_$1\"> </span>");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
|
|
@ -46,61 +56,152 @@ module mod_vtm_manifestation
|
|||
super(aufbau);
|
||||
this.bereich = bereich;
|
||||
this.intervall = (new klasse_nichts<any>());
|
||||
this.aufbau.lauschen
|
||||
(
|
||||
"aenderung_welt",
|
||||
(angaben) =>
|
||||
{
|
||||
this.erneuern_welt();
|
||||
}
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
* @implementation
|
||||
* @override
|
||||
*/
|
||||
public darstellen() : void
|
||||
public einrichten() : void
|
||||
{
|
||||
this.aufbau.lauschen
|
||||
(
|
||||
"aenderung_aufgabe",
|
||||
(angaben) =>
|
||||
{
|
||||
this.erneuern_aufgabe();
|
||||
}
|
||||
)
|
||||
;
|
||||
this.aufbau.lauschen
|
||||
(
|
||||
"aenderung_welt",
|
||||
(angaben) =>
|
||||
{
|
||||
this.erneuern_welt();
|
||||
}
|
||||
)
|
||||
;
|
||||
this.aufbau.lauschen
|
||||
(
|
||||
"aenderung_figur",
|
||||
(angaben) =>
|
||||
{
|
||||
this.erneuern_figur();
|
||||
}
|
||||
)
|
||||
;
|
||||
this.aufbau.lauschen
|
||||
(
|
||||
"aenderung_modus",
|
||||
(angaben) =>
|
||||
{
|
||||
this.erneuern_modus();
|
||||
}
|
||||
)
|
||||
;
|
||||
this.darstellen();
|
||||
this.binden();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
private erneuern_aufgabe() : void
|
||||
{
|
||||
document.querySelector("#aufgabe_text").innerHTML = text_nachbearbeiten(this.aufbau.aufgabe_lesen().text());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
private erneuern_welt() : void
|
||||
{
|
||||
let knoten_svg : mod_vtm_helfer.schnittstelle_xmlknoten = mod_vtm_manifestation.svg_wurzel
|
||||
(
|
||||
-4, -4,
|
||||
+4, +4,
|
||||
800, 800,
|
||||
[new klasse_svg_partie(this.aufbau).darstellen()]
|
||||
)
|
||||
;
|
||||
this.bereich.innerHTML = knoten_svg.darstellen();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
private erneuern_figur() : void
|
||||
{
|
||||
let knoten_svg : mod_vtm_helfer.schnittstelle_xmlknoten = mod_vtm_manifestation.svg_wurzel
|
||||
(
|
||||
-4, -4,
|
||||
+4, +4,
|
||||
800, 800,
|
||||
[new klasse_svg_partie(this.aufbau).darstellen()]
|
||||
)
|
||||
;
|
||||
this.bereich.innerHTML = knoten_svg.darstellen();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
private erneuern_modus() : void
|
||||
{
|
||||
let status : string;
|
||||
switch (this.aufbau.modus_lesen())
|
||||
{
|
||||
case mod_vtm_aufbau.modus_initial:
|
||||
{
|
||||
status = "Maschine aufbauen";
|
||||
break;
|
||||
}
|
||||
case mod_vtm_aufbau.modus_ungewiss:
|
||||
{
|
||||
status = "wird geprüft …";
|
||||
break;
|
||||
}
|
||||
case mod_vtm_aufbau.modus_fehlerhaft:
|
||||
{
|
||||
status = "fehlerhaft :/";
|
||||
break;
|
||||
}
|
||||
case mod_vtm_aufbau.modus_korrekt:
|
||||
{
|
||||
status = "scheinbar korrekt :)";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
let meldung : string = "unbehandelter Modus";
|
||||
throw (new Error(meldung));
|
||||
break;
|
||||
}
|
||||
}
|
||||
document.querySelector("#aufgabe_status").textContent = status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
*/
|
||||
public erneuern_knoepfe() : void
|
||||
{
|
||||
// Zeichnung aktualisieren
|
||||
{
|
||||
let knoten_svg : mod_vtm_helfer.schnittstelle_xmlknoten = mod_vtm_manifestation.svg_wurzel
|
||||
(
|
||||
-4, -4,
|
||||
+4, +4,
|
||||
800, 800,
|
||||
[new klasse_svg_partie(this.aufbau).darstellen()]
|
||||
)
|
||||
;
|
||||
this.bereich.innerHTML = knoten_svg.darstellen();
|
||||
}
|
||||
// Status
|
||||
{
|
||||
let status : string;
|
||||
switch (this.aufbau.modus_lesen())
|
||||
{
|
||||
case mod_vtm_aufbau.modus_initial:
|
||||
{
|
||||
status = "Rechts 'Testen' drücken zum Prüfen der Maschine";
|
||||
break;
|
||||
}
|
||||
case mod_vtm_aufbau.modus_ungewiss:
|
||||
{
|
||||
status = "wird geprüft …";
|
||||
break;
|
||||
}
|
||||
case mod_vtm_aufbau.modus_fehlerhaft:
|
||||
{
|
||||
status = "fehlerhaft :/";
|
||||
break;
|
||||
}
|
||||
case mod_vtm_aufbau.modus_korrekt:
|
||||
{
|
||||
status = "scheinbar korrekt :)";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
let meldung : string = "unbehandelter Modus";
|
||||
throw (new Error(meldung));
|
||||
break;
|
||||
}
|
||||
}
|
||||
document.querySelector("#aufgabe_status").textContent = status;
|
||||
}
|
||||
// Knöpfe anzeigen/ausblenden
|
||||
{
|
||||
document.querySelector("#knoepfe").setAttribute
|
||||
|
|
@ -121,12 +222,42 @@ module mod_vtm_manifestation
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
* @implementation
|
||||
*/
|
||||
public darstellen() : void
|
||||
{
|
||||
this.erneuern_aufgabe();
|
||||
this.erneuern_welt();
|
||||
this.erneuern_figur();
|
||||
this.erneuern_modus();
|
||||
this.erneuern_knoepfe();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author kcf <vidofnir@folksprak.org>
|
||||
* @implementation
|
||||
*/
|
||||
public binden() : void
|
||||
{
|
||||
let stelle_ermitteln = (target : EventTarget) =>
|
||||
{
|
||||
let stelle : schnittstelle_fehlermonade<mod_vtm_aufbau.typ_stelle>;
|
||||
let dom_feld : Element = target["closest"](".feld");
|
||||
if (dom_feld == null)
|
||||
{
|
||||
stelle = (new klasse_nichts<mod_vtm_aufbau.typ_stelle>());
|
||||
}
|
||||
else
|
||||
{
|
||||
let rel : string = dom_feld.getAttribute("rel")
|
||||
stelle = (new klasse_schlicht<mod_vtm_aufbau.typ_stelle>(mod_vtm_aufbau.stelle_von_hash(rel)));
|
||||
}
|
||||
return stelle;
|
||||
}
|
||||
;
|
||||
// Links-Klick
|
||||
this.bereich.addEventListener
|
||||
(
|
||||
|
|
@ -134,24 +265,14 @@ module mod_vtm_manifestation
|
|||
event =>
|
||||
{
|
||||
event.preventDefault();
|
||||
if (this.aufbau.modus_lesen() === mod_vtm_aufbau.modus_initial)
|
||||
let stelle_ : schnittstelle_fehlermonade<mod_vtm_aufbau.typ_stelle> = stelle_ermitteln(event.target);
|
||||
if (stelle_.ist_schlicht())
|
||||
{
|
||||
let dom_feld : Element = event.target["closest"](".feld");
|
||||
if (dom_feld == null)
|
||||
{
|
||||
console.info("-- kein Feld");
|
||||
}
|
||||
else
|
||||
{
|
||||
let rel : string = dom_feld.getAttribute("rel")
|
||||
let stelle : mod_vtm_aufbau.typ_stelle = mod_vtm_aufbau.stelle_von_hash(rel);
|
||||
this.aufbau.welt_lesen().feld_wechseln(stelle);
|
||||
this.darstellen();
|
||||
}
|
||||
this.aufbau.welt_feld_wechseln(stelle_.lesen(), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.info("-- nicht zur Bearbeitung freigegeben");
|
||||
console.info("-- kein Feld");
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
@ -163,24 +284,34 @@ module mod_vtm_manifestation
|
|||
event =>
|
||||
{
|
||||
event.preventDefault();
|
||||
if (this.aufbau.modus_lesen() === mod_vtm_aufbau.modus_initial)
|
||||
let stelle_ : schnittstelle_fehlermonade<mod_vtm_aufbau.typ_stelle> = stelle_ermitteln(event.target);
|
||||
if (stelle_.ist_schlicht())
|
||||
{
|
||||
let dom_feld : Element = event.target["closest"](".feld");
|
||||
if (dom_feld == null)
|
||||
{
|
||||
console.info("-- kein Feld");
|
||||
}
|
||||
else
|
||||
{
|
||||
let rel : string = dom_feld.getAttribute("rel")
|
||||
let stelle : mod_vtm_aufbau.typ_stelle = mod_vtm_aufbau.stelle_von_hash(rel);
|
||||
this.aufbau.welt_lesen().feld_drehen(stelle);
|
||||
this.darstellen();
|
||||
}
|
||||
this.aufbau.welt_feld_wechseln(stelle_.lesen(), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.info("-- nicht zur Bearbeitung freigegeben");
|
||||
console.info("-- kein Feld");
|
||||
}
|
||||
}
|
||||
)
|
||||
;
|
||||
// Mausrad
|
||||
this.bereich.addEventListener
|
||||
(
|
||||
"wheel",
|
||||
event =>
|
||||
{
|
||||
event.preventDefault();
|
||||
let stelle_ : schnittstelle_fehlermonade<mod_vtm_aufbau.typ_stelle> = stelle_ermitteln(event.target);
|
||||
if (stelle_.ist_schlicht())
|
||||
{
|
||||
let inkrement : int = ((event["deltaY"] < 0) ? -1 : +1);
|
||||
this.aufbau.welt_feld_drehen(stelle_.lesen(), inkrement);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.info("-- kein Feld");
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
@ -210,7 +341,6 @@ module mod_vtm_manifestation
|
|||
{
|
||||
clearInterval(this.intervall.lesen());
|
||||
this.intervall = (new klasse_nichts<int>());
|
||||
this.darstellen();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -218,7 +348,7 @@ module mod_vtm_manifestation
|
|||
console.warn(meldung);
|
||||
}
|
||||
}
|
||||
this.darstellen();
|
||||
this.erneuern_knoepfe();
|
||||
}
|
||||
,
|
||||
500
|
||||
|
|
@ -238,13 +368,13 @@ module mod_vtm_manifestation
|
|||
{
|
||||
clearInterval(this.intervall.lesen());
|
||||
this.intervall = (new klasse_nichts<int>());
|
||||
this.darstellen();
|
||||
}
|
||||
else
|
||||
{
|
||||
let meldung : string = "kein Intervall gesetzt";
|
||||
console.warn(meldung);
|
||||
}
|
||||
this.erneuern_knoepfe();
|
||||
}
|
||||
)
|
||||
;
|
||||
|
|
@ -264,7 +394,7 @@ module mod_vtm_manifestation
|
|||
// nichts tun
|
||||
}
|
||||
this.aufbau.zuruecksetzen();
|
||||
this.darstellen();
|
||||
this.erneuern_knoepfe();
|
||||
}
|
||||
)
|
||||
;
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@
|
|||
<label for="aufgabe_auswahl">Aufgabe auswählen</label>
|
||||
<select id="aufgabe_auswahl"></select>
|
||||
<p id="aufgabe_text"></p>
|
||||
<span id="aufgabe_status"></span>
|
||||
</div>
|
||||
<div class="bereich" id="bereich_mitte">
|
||||
</div>
|
||||
<div class="bereich" id="bereich_rechts">
|
||||
<span id="aufgabe_status"></span>
|
||||
<div id="knoepfe">
|
||||
<button id="knopf_testen">Testen</button>
|
||||
<button id="knopf_anhalten">Anhalten</button>
|
||||
|
|
@ -30,12 +30,12 @@
|
|||
</div>
|
||||
</div>
|
||||
<div id="hilfe">
|
||||
<p>Dieses Spiel ist inspiriert von <a href="http://www.kongregate.com/games/PleasingFungus/manufactoria">Manufacturia</a> und <a href="http://www.crazy-machines.com/">Crazy Machines</a>.</p>
|
||||
<p>Dieses Spiel ist inspiriert von <a href="http://www.kongregate.com/games/PleasingFungus/manufactoria">Manufacturia</a>, <a href="http://www.crazy-machines.com/">Crazy Machines</a>, <a href="http://worldofgoo.com/">World of Goo</a> … und auch von unvergessenen Stunden Hardware-Praktikum im Informatik-Studium :P</p>
|
||||
<section>
|
||||
<header>Steuerung</header>
|
||||
<ul>
|
||||
<li>Links-Klick: Feldtyp wechseln</li>
|
||||
<li>Rechts-Klick: Feld drehen</li>
|
||||
<li>Links-Klick/Rechts-Klick: Feldtyp wechseln</li>
|
||||
<li>Mausrad-Drehen: Feld drehen</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section>
|
||||
|
|
|
|||
Loading…
Reference in a new issue