diff --git a/makefile b/makefile index 3b80aa9..f25f061 100644 --- a/makefile +++ b/makefile @@ -60,9 +60,9 @@ ${dir_erzeugnis}/vtm.js: \ ${dir_quelldatein}/aufbau/zustand.ts \ ${dir_quelldatein}/aufbau/figur.ts \ ${dir_quelldatein}/aufbau/aktoren/_aktor.ts \ - ${dir_quelldatein}/aufbau/aktoren/erzeuger.ts \ - ${dir_quelldatein}/aufbau/aktoren/annehmer.ts \ ${dir_quelldatein}/aufbau/aktoren/verwerfer.ts \ + ${dir_quelldatein}/aufbau/aktoren/annehmer.ts \ + ${dir_quelldatein}/aufbau/aktoren/erzeuger.ts \ ${dir_quelldatein}/aufbau/aktoren/befoerderer.ts \ ${dir_quelldatein}/aufbau/aktoren/schreiber.ts \ ${dir_quelldatein}/aufbau/aktoren/leser.ts \ @@ -77,9 +77,15 @@ ${dir_erzeugnis}/vtm.js: \ ${dir_quelldatein}/aufbau/partie.ts \ ${dir_quelldatein}/manifestation/manifestation.ts \ ${dir_quelldatein}/manifestation/position.ts \ - ${dir_quelldatein}/manifestation/svg/svg.ts \ + ${dir_quelldatein}/manifestation/svg/_svg.ts \ ${dir_quelldatein}/manifestation/svg/figur.ts \ - ${dir_quelldatein}/manifestation/svg/aktor.ts \ + ${dir_quelldatein}/manifestation/svg/aktor/_aktor.ts \ + ${dir_quelldatein}/manifestation/svg/aktor/verwerfer.ts \ + ${dir_quelldatein}/manifestation/svg/aktor/annehmer.ts \ + ${dir_quelldatein}/manifestation/svg/aktor/erzeuger.ts \ + ${dir_quelldatein}/manifestation/svg/aktor/befoerderer.ts \ + ${dir_quelldatein}/manifestation/svg/aktor/schreiber.ts \ + ${dir_quelldatein}/manifestation/svg/aktor/leser.ts \ ${dir_quelldatein}/manifestation/svg/partie.ts \ ${dir_quelldatein}/manifestation/web/partie.ts \ ${dir_quelldatein}/manifestation/speicher/partie.ts \ diff --git a/quelldatein/helfer/aufruf.ts b/quelldatein/helfer/aufruf.ts index 6193cb1..fbd8ab8 100644 --- a/quelldatein/helfer/aufruf.ts +++ b/quelldatein/helfer/aufruf.ts @@ -22,7 +22,7 @@ module lib_aufruf /** * @author kcf */ - export type typ_komplex = {art : string; angaben ?: typ_angaben;}; + export type typ_komplex = {art : string; angaben : typ_angaben;}; /** diff --git a/quelldatein/manifestation/manifestation.ts b/quelldatein/manifestation/manifestation.ts index 5b29724..5bfc53d 100644 --- a/quelldatein/manifestation/manifestation.ts +++ b/quelldatein/manifestation/manifestation.ts @@ -31,7 +31,7 @@ module mod_vtm /** * @author kcf */ - export type schnittstelle_manifestation = + export type signatur_manifestation = { darstellen : (manifestation : typ_manifestation)=>typ_ausgabe; binden : (manifestation : typ_manifestation)=>void; @@ -42,31 +42,43 @@ module mod_vtm /** * @author kcf */ - export var implementierung_manifestation : {[art : string] : schnittstelle_manifestation} = {}; + export var brauch_manifestation : lib_brauch.typ_brauch> = lib_brauch.erstellen>(); /** * @author kcf */ - export function darstellen(manifestation : typ_manifestation) : typ_ausgabe + export function darstellen + ( + manifestation : typ_manifestation + ) + : typ_ausgabe { - return implementierung_manifestation[manifestation.art].darstellen(manifestation); + return lib_brauch.anwenden(brauch_manifestation, manifestation.art)["darstellen"](manifestation); } /** * @author kcf */ - export function binden(manifestation : typ_manifestation) : void + export function binden + ( + manifestation : typ_manifestation + ) + : void { - return implementierung_manifestation[manifestation.art].binden(manifestation); + return lib_brauch.anwenden(brauch_manifestation, manifestation.art)["binden"](manifestation); } /** * @author kcf */ - export function einrichten(manifestation : typ_manifestation) : void + export function einrichten + ( + manifestation : typ_manifestation + ) + : void { darstellen(manifestation); binden(manifestation); diff --git a/quelldatein/manifestation/speicher/partie.ts b/quelldatein/manifestation/speicher/partie.ts index fd55f92..4ee98f9 100644 --- a/quelldatein/manifestation/speicher/partie.ts +++ b/quelldatein/manifestation/speicher/partie.ts @@ -151,11 +151,15 @@ module mod_vtm /** * @author kcf */ - implementierung_manifestation["speicher_partie"] = - { - "darstellen": (manifestation) => darstellen(manifestation.angaben), - "binden": (manifestation) => binden(manifestation.angaben), - } + lib_brauch.umsetzen> + ( + brauch_manifestation, + "speicher_partie", + { + "darstellen": (manifestation) => darstellen(manifestation.angaben), + "binden": (manifestation) => binden(manifestation.angaben), + } + ) ; } diff --git a/quelldatein/manifestation/svg/svg.ts b/quelldatein/manifestation/svg/_svg.ts similarity index 73% rename from quelldatein/manifestation/svg/svg.ts rename to quelldatein/manifestation/svg/_svg.ts index 3d02fea..33cddb7 100644 --- a/quelldatein/manifestation/svg/svg.ts +++ b/quelldatein/manifestation/svg/_svg.ts @@ -37,6 +37,63 @@ module mod_vtm export const form_pfeil : string = "M +4 0 L 0 +1 L 0 -1 Z"; + /** + * @author kcf + */ + export function rotation + ( + staerke : float + ) + : string + { + return ( + "rotate" + + "(" + + (staerke * 360).toFixed(float_praezission) + + ")" + ); + } + + + /** + * @author kcf + */ + export function translation + ( + x : float, + y : float + ) + : string + { + return ( + "translate" + + "(" + + x.toFixed(float_praezission) + + ", " + + y.toFixed(float_praezission) + + ")" + ); + } + + + /** + * @author kcf + */ + export function skalierung + ( + staerke : float + ) + : string + { + return ( + "scale" + + "(" + + staerke.toFixed(float_praezission) + + ")" + ); + } + + /** * @author kcf */ diff --git a/quelldatein/manifestation/svg/aktor.ts b/quelldatein/manifestation/svg/aktor.ts deleted file mode 100644 index 11830d1..0000000 --- a/quelldatein/manifestation/svg/aktor.ts +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Verrückte Turing-Maschinen — A turing complete game - * Copyright (C) 2016 Christian Fraß - * - * 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 . - */ - -module mod_vtm - { - - export module mod_manifestation - { - - export module mod_svg - { - - export module mod_aktor - { - - /** - * @author kcf - */ - export type typ_aktor = - { - aufbau : mod_vtm.mod_aufbau.mod_aktor.typ_aktor; - stelle : mod_vtm.mod_aufbau.mod_stelle.typ_stelle; - } - ; - - - /** - * @author kcf - */ - function erstellen - ( - aufbau : mod_vtm.mod_aufbau.mod_aktor.typ_aktor, - stelle : mod_vtm.mod_aufbau.mod_stelle.typ_stelle - ) - : typ_aktor - { - return { - "aufbau": aufbau, - "stelle": stelle - }; - } - - - /** - * @author kcf - */ - export function erstellen_manifestation - ( - aufbau : mod_vtm.mod_aufbau.mod_aktor.typ_aktor, - stelle : mod_vtm.mod_aufbau.mod_stelle.typ_stelle - ) - : typ_manifestation - { - return { - "art": "aktor", - "angaben": erstellen(aufbau, stelle), - }; - } - - - /** - * @author kcf - */ - 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 () : lib_xml.typ_knoten - { - return ( - pfad - ( - mod_vtm.mod_helfer.sequenz(6).map(i => lib_vektor.polar(((i+0.5)/6) * (2*Math.PI), 0.5)), - true, - { - "class": "rahmen" - } - ) - ); - } - ; - let kinder_feld : Array = []; - lib_aufruf.fallunterscheidung - ( - aktor, - { - "erzeuger": (angaben) => - { - 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 : lib_xml.typ_knoten = ( - lib_xml.erstellen_normal - ( - "path", - { - "d": form_pfeil, - "class": ( - [ - "pfeil", - "erzeuger", - ].join(" ") - ), - "transform": ( - [ - "rotate(" + ((richtung/6) * 360).toFixed(float_praezission) + ")", - "translate(-0.2, 0)", - "scale(0.12)", - ].join(" ") - ), - } - ) - ); - kinder_feld.push(knoten_pfeil); - } - , - "befoerderer": (angaben) => - { - 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 : lib_xml.typ_knoten = ( - lib_xml.erstellen_normal - ( - "path", - { - "d": form_pfeil, - "class": ( - [ - "pfeil", - "neutral", - ].join(" ") - ), - "transform": ( - [ - "rotate(" + ((richtung/6) * 360).toFixed(float_praezission) + ")", - "translate(-0.2, 0)", - "scale(0.12)", - ].join(" ") - ), - } - ) - ); - kinder_feld.push(knoten_pfeil); - } - , - "schreiber": (angaben) => - { - 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 : lib_xml.typ_knoten = ( - lib_xml.erstellen_normal - ( - "path", - { - "d": form_pfeil, - "class": ( - [ - "pfeil", - "symbol_" + symbol.toFixed(0), - ].join(" ") - ), - "transform": ( - [ - "rotate(" + ((richtung/6) * 360).toFixed(float_praezission) + ")", - "translate(-0.2, 0)", - "scale(0.12)", - ].join(" ") - ), - } - ) - ); - kinder_feld.push(knoten_pfeil); - } - , - "leser": (angaben) => - { - kinder_feld.push(knoten_rahmen()); - let richtung : mod_vtm.mod_aufbau.mod_richtung.typ_richtung = mod_vtm.mod_aufbau.mod_aktor.mod_leser.richtung_lesen(angaben); - let symbol_links : mod_vtm.mod_aufbau.mod_symbol.typ_symbol = mod_vtm.mod_aufbau.mod_aktor.mod_leser.symbol_links_lesen(angaben); - let symbol_rechts : mod_vtm.mod_aufbau.mod_symbol.typ_symbol = mod_vtm.mod_aufbau.mod_aktor.mod_leser.symbol_rechts_lesen(angaben); - let ausgaenge : Array<{summand : mod_vtm.mod_aufbau.mod_richtung.typ_richtung, symbol : lib_fehlermonade.typ_fehlermonade;}> = - [ - { - "summand": 0, - "symbol": lib_fehlermonade.erstellen_nichts(), - }, - { - "summand": +2, - "symbol": lib_fehlermonade.erstellen_schlicht(symbol_links), - }, - { - "summand": -2, - "symbol": lib_fehlermonade.erstellen_schlicht(symbol_rechts), - }, - ] - ; - ausgaenge.forEach - ( - eintrag => - { - let winkel : float = ((mod_vtm.mod_aufbau.mod_richtung.addieren(richtung, eintrag.summand) / 6) * 360); - let knoten_pfeil : lib_xml.typ_knoten = ( - lib_xml.erstellen_normal - ( - "path", - { - "d": form_pfeil, - "class": ( - [ - "pfeil", - ( - lib_fehlermonade.voll(eintrag.symbol) - ? "symbol_" + lib_fehlermonade.lesen(eintrag.symbol).toFixed(0) - : "neutral" - ), - ].join(" ") - ), - "transform": ( - [ - - "rotate(" + winkel.toFixed(float_praezission) + ")", - "translate(0.1, 0)", - "scale(0.075)", - ].join(" ") - ), - } - ) - ); - kinder_feld.push(knoten_pfeil); - } - ) - ; - } - , - "verwerfer": (angaben) => - { - kinder_feld.push(knoten_rahmen()); - let knoten_kreis : lib_xml.typ_knoten = ( - lib_xml.erstellen_normal - ( - "circle", - { - "cx": (0.0).toFixed(float_praezission), - "cy": (0.0).toFixed(float_praezission), - "r": (0.25).toFixed(float_praezission), - "class": ( - [ - "kreis", - "negativ", - ].join(" ") - ), - } - ) - ); - kinder_feld.push(knoten_kreis); - } - , - "annehmer": (angaben) => - { - kinder_feld.push(knoten_rahmen()); - let knoten_kreis : lib_xml.typ_knoten = ( - lib_xml.erstellen_normal - ( - "circle", - { - "cx": (0.0).toFixed(float_praezission), - "cy": (0.0).toFixed(float_praezission), - "r": (0.25).toFixed(float_praezission), - "class": ( - [ - "kreis", - "positiv", - ].join(" ") - ), - } - ) - ); - kinder_feld.push(knoten_kreis); - } - , - } - ) - ; - let position : mod_position.typ_position = mod_position.von_stelle(aktor_.stelle); - let knoten_feld : lib_xml.typ_knoten = ( - lib_xml.erstellen_normal - ( - "g", - { - "class": "feld", - "rel": mod_vtm.mod_aufbau.mod_stelle.hash(aktor_.stelle), - "transform": ( - "translate" - + "(" - + position.x.toFixed(float_praezission) - + ", " - + position.y.toFixed(float_praezission) - + ")" - ), - }, - kinder_feld - ) - ); - return knoten_feld; - } - - - /** - * @author kcf - */ - implementierung_manifestation["aktor"] = - { - "darstellen": (manifestation) => darstellen(manifestation.angaben), - "binden": (manifestation) => {}, - } - ; - - } - - } - - } - - } - diff --git a/quelldatein/manifestation/svg/aktor/_aktor.ts b/quelldatein/manifestation/svg/aktor/_aktor.ts new file mode 100644 index 0000000..7be98b4 --- /dev/null +++ b/quelldatein/manifestation/svg/aktor/_aktor.ts @@ -0,0 +1,161 @@ +/* + * Verrückte Turing-Maschinen — A turing complete game + * Copyright (C) 2016 Christian Fraß + * + * 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 . + */ + +module mod_vtm + { + + export module mod_manifestation + { + + export module mod_svg + { + + export module mod_aktor + { + + /** + * @author kcf + */ + export type signatur_aktor = + { + darstellen : (aktor : mod_vtm.mod_aufbau.mod_aktor.typ_aktor)=>Array; + } + ; + + + /** + * @author kcf + */ + export var brauch_aktor : lib_brauch.typ_brauch = lib_brauch.erstellen(); + + + /** + * @author kcf + */ + export type typ_aktor = + { + aufbau : mod_vtm.mod_aufbau.mod_aktor.typ_aktor; + stelle : mod_vtm.mod_aufbau.mod_stelle.typ_stelle; + } + ; + + + /** + * @author kcf + */ + function erstellen + ( + aufbau : mod_vtm.mod_aufbau.mod_aktor.typ_aktor, + stelle : mod_vtm.mod_aufbau.mod_stelle.typ_stelle + ) + : typ_aktor + { + return { + "aufbau": aufbau, + "stelle": stelle + }; + } + + + /** + * @author kcf + */ + export function erstellen_manifestation + ( + aufbau : mod_vtm.mod_aufbau.mod_aktor.typ_aktor, + stelle : mod_vtm.mod_aufbau.mod_stelle.typ_stelle + ) + : typ_manifestation + { + return { + "art": "svg_aktor", + "angaben": erstellen(aufbau, stelle), + }; + } + + + /** + * @author kcf + */ + 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 () : lib_xml.typ_knoten + { + return ( + pfad + ( + mod_vtm.mod_helfer.sequenz(6).map(i => lib_vektor.polar(((i+0.5)/6) * (2*Math.PI), 0.5)), + true, + { + "class": "rahmen" + } + ) + ); + } + ; + let position : mod_position.typ_position = mod_position.von_stelle(aktor_.stelle); + let knoten_feld : lib_xml.typ_knoten = ( + lib_xml.erstellen_normal + ( + "g", + { + "class": "feld", + "rel": mod_vtm.mod_aufbau.mod_stelle.hash(aktor_.stelle), + "transform": translation(position.x, position.y), + }, + ( + [knoten_rahmen()] + .concat(lib_brauch.anwenden(brauch_aktor, aktor.art)["darstellen"](aktor)) + ) + ) + ); + return knoten_feld; + } + + + /** + * @author kcf + */ + function binden(aktor : typ_aktor) : void + { + } + + + /** + * @author kcf + */ + lib_brauch.umsetzen> + ( + brauch_manifestation, + "svg_aktor", + { + "darstellen": (manifestation) => darstellen(manifestation.angaben), + "binden": (manifestation) => binden(manifestation.angaben), + } + ) + ; + + } + + } + + } + + } + diff --git a/quelldatein/manifestation/svg/aktor/annehmer.ts b/quelldatein/manifestation/svg/aktor/annehmer.ts new file mode 100644 index 0000000..5b59ac3 --- /dev/null +++ b/quelldatein/manifestation/svg/aktor/annehmer.ts @@ -0,0 +1,74 @@ +/* + * Verrückte Turing-Maschinen — A turing complete game + * Copyright (C) 2016 Christian Fraß + * + * 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 . + */ + +module mod_vtm + { + + export module mod_manifestation + { + + export module mod_svg + { + + export module mod_aktor + { + + /** + * @author kcf + */ + lib_brauch.umsetzen + ( + brauch_aktor, + "annehmer", + { + "darstellen": (aktor) => + { + let kinder : Array = []; + let knoten_kreis : lib_xml.typ_knoten = ( + lib_xml.erstellen_normal + ( + "circle", + { + "cx": (0.0).toFixed(float_praezission), + "cy": (0.0).toFixed(float_praezission), + "r": (0.25).toFixed(float_praezission), + "class": ( + [ + "kreis", + "positiv", + ].join(" ") + ), + } + ) + ); + kinder.push(knoten_kreis); + return kinder; + } + , + } + ) + ; + + } + + } + + } + + } + diff --git a/quelldatein/manifestation/svg/aktor/befoerderer.ts b/quelldatein/manifestation/svg/aktor/befoerderer.ts new file mode 100644 index 0000000..6c0789b --- /dev/null +++ b/quelldatein/manifestation/svg/aktor/befoerderer.ts @@ -0,0 +1,79 @@ +/* + * Verrückte Turing-Maschinen — A turing complete game + * Copyright (C) 2016 Christian Fraß + * + * 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 . + */ + +module mod_vtm + { + + export module mod_manifestation + { + + export module mod_svg + { + + export module mod_aktor + { + + /** + * @author kcf + */ + lib_brauch.umsetzen + ( + brauch_aktor, + "befoerderer", + { + "darstellen": ({"angaben": {"richtung": richtung}}) => + { + let kinder : Array = []; + let knoten_pfeil : lib_xml.typ_knoten = ( + lib_xml.erstellen_normal + ( + "path", + { + "d": form_pfeil, + "class": ( + [ + "pfeil", + "neutral", + ].join(" ") + ), + "transform": ( + [ + rotation(richtung/6), + translation(-0.2, 0), + skalierung(0.12), + ].join(" ") + ), + } + ) + ); + kinder.push(knoten_pfeil); + return kinder; + } + , + } + ) + ; + + } + + } + + } + + } + diff --git a/quelldatein/manifestation/svg/aktor/erzeuger.ts b/quelldatein/manifestation/svg/aktor/erzeuger.ts new file mode 100644 index 0000000..ca01179 --- /dev/null +++ b/quelldatein/manifestation/svg/aktor/erzeuger.ts @@ -0,0 +1,79 @@ +/* + * Verrückte Turing-Maschinen — A turing complete game + * Copyright (C) 2016 Christian Fraß + * + * 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 . + */ + +module mod_vtm + { + + export module mod_manifestation + { + + export module mod_svg + { + + export module mod_aktor + { + + /** + * @author kcf + */ + lib_brauch.umsetzen + ( + brauch_aktor, + "erzeuger", + { + "darstellen": ({"angaben": {"richtung": richtung}}) => + { + let kinder : Array = []; + let knoten_pfeil : lib_xml.typ_knoten = ( + lib_xml.erstellen_normal + ( + "path", + { + "d": form_pfeil, + "class": ( + [ + "pfeil", + "erzeuger", + ].join(" ") + ), + "transform": ( + [ + rotation(richtung/6), + translation(-0.2, 0), + skalierung(0.12), + ].join(" ") + ), + } + ) + ); + kinder.push(knoten_pfeil); + return kinder; + } + , + } + ) + ; + + } + + } + + } + + } + diff --git a/quelldatein/manifestation/svg/aktor/leser.ts b/quelldatein/manifestation/svg/aktor/leser.ts new file mode 100644 index 0000000..6d0c28d --- /dev/null +++ b/quelldatein/manifestation/svg/aktor/leser.ts @@ -0,0 +1,113 @@ +/* + * Verrückte Turing-Maschinen — A turing complete game + * Copyright (C) 2016 Christian Fraß + * + * 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 . + */ + +module mod_vtm + { + + export module mod_manifestation + { + + export module mod_svg + { + + export module mod_aktor + { + + /** + * @author kcf + */ + lib_brauch.umsetzen + ( + brauch_aktor, + "leser", + { + "darstellen": ({"angaben": {"richtung": richtung, "symbol_links": symbol_links, "symbol_rechts": symbol_rechts}}) => + { + let kinder : Array = []; + type typ_eintrag = + { + summand : mod_vtm.mod_aufbau.mod_richtung.typ_richtung; + symbol : lib_fehlermonade.typ_fehlermonade; + } + ; + let ausgaenge : Array = + [ + { + "summand": 0, + "symbol": lib_fehlermonade.erstellen_nichts(), + }, + { + "summand": +2, + "symbol": lib_fehlermonade.erstellen_schlicht(symbol_links), + }, + { + "summand": -2, + "symbol": lib_fehlermonade.erstellen_schlicht(symbol_rechts), + }, + ] + ; + ausgaenge.forEach + ( + eintrag => + { + let winkelstaerke : float = (mod_vtm.mod_aufbau.mod_richtung.addieren(richtung, eintrag.summand) / 6); + let knoten_pfeil : lib_xml.typ_knoten = ( + lib_xml.erstellen_normal + ( + "path", + { + "d": form_pfeil, + "class": ( + [ + "pfeil", + ( + lib_fehlermonade.voll(eintrag.symbol) + ? "symbol_" + lib_fehlermonade.lesen(eintrag.symbol).toFixed(0) + : "neutral" + ), + ].join(" ") + ), + "transform": ( + [ + rotation(winkelstaerke), + translation(+0.1, 0), + skalierung(0.075), + ].join(" ") + ), + } + ) + ); + kinder.push(knoten_pfeil); + } + ) + ; + return kinder; + } + , + } + ) + ; + + } + + } + + } + + } + diff --git a/quelldatein/manifestation/svg/aktor/schreiber.ts b/quelldatein/manifestation/svg/aktor/schreiber.ts new file mode 100644 index 0000000..fb21a16 --- /dev/null +++ b/quelldatein/manifestation/svg/aktor/schreiber.ts @@ -0,0 +1,79 @@ +/* + * Verrückte Turing-Maschinen — A turing complete game + * Copyright (C) 2016 Christian Fraß + * + * 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 . + */ + +module mod_vtm + { + + export module mod_manifestation + { + + export module mod_svg + { + + export module mod_aktor + { + + /** + * @author kcf + */ + lib_brauch.umsetzen + ( + brauch_aktor, + "schreiber", + { + "darstellen": ({"angaben": {"richtung": richtung, "symbol": symbol}}) => + { + let kinder : Array = []; + let knoten_pfeil : lib_xml.typ_knoten = ( + lib_xml.erstellen_normal + ( + "path", + { + "d": form_pfeil, + "class": ( + [ + "pfeil", + "symbol_" + symbol.toFixed(0), + ].join(" ") + ), + "transform": ( + [ + rotation(richtung/6), + translation(-0.2, 0), + skalierung(0.12), + ].join(" ") + ), + } + ) + ); + kinder.push(knoten_pfeil); + return kinder; + } + , + } + ) + ; + + } + + } + + } + + } + diff --git a/quelldatein/manifestation/svg/aktor/verwerfer.ts b/quelldatein/manifestation/svg/aktor/verwerfer.ts new file mode 100644 index 0000000..1ce8cd3 --- /dev/null +++ b/quelldatein/manifestation/svg/aktor/verwerfer.ts @@ -0,0 +1,74 @@ +/* + * Verrückte Turing-Maschinen — A turing complete game + * Copyright (C) 2016 Christian Fraß + * + * 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 . + */ + +module mod_vtm + { + + export module mod_manifestation + { + + export module mod_svg + { + + export module mod_aktor + { + + /** + * @author kcf + */ + lib_brauch.umsetzen + ( + brauch_aktor, + "verwerfer", + { + "darstellen": (aktor) => + { + let kinder : Array = []; + let knoten_kreis : lib_xml.typ_knoten = ( + lib_xml.erstellen_normal + ( + "circle", + { + "cx": (0.0).toFixed(float_praezission), + "cy": (0.0).toFixed(float_praezission), + "r": (0.25).toFixed(float_praezission), + "class": ( + [ + "kreis", + "negativ", + ].join(" ") + ), + } + ) + ); + kinder.push(knoten_kreis); + return kinder; + } + , + } + ) + ; + + } + + } + + } + + } + diff --git a/quelldatein/manifestation/svg/figur.ts b/quelldatein/manifestation/svg/figur.ts index b13e0c8..47aa987 100644 --- a/quelldatein/manifestation/svg/figur.ts +++ b/quelldatein/manifestation/svg/figur.ts @@ -153,14 +153,7 @@ module mod_vtm "g", { "class": "figur", - "transform": ( - "translate" - + "(" - + position.x.toFixed(float_praezission) - + "," - + position.y.toFixed(float_praezission) - + ")" - ), + "transform": translation(position.x, position.y), }, kinder_figur ) @@ -180,11 +173,15 @@ module mod_vtm /** * @author kcf */ - implementierung_manifestation["svg_figur"] = - { - "darstellen": (manifestation) => darstellen(manifestation.angaben), - "binden": (manifestation) => binden(manifestation.angaben), - } + lib_brauch.umsetzen> + ( + brauch_manifestation, + "svg_figur", + { + "darstellen": (manifestation) => darstellen(manifestation.angaben), + "binden": (manifestation) => binden(manifestation.angaben), + } + ) ; } diff --git a/quelldatein/manifestation/svg/partie.ts b/quelldatein/manifestation/svg/partie.ts index f7e6b99..239e40c 100644 --- a/quelldatein/manifestation/svg/partie.ts +++ b/quelldatein/manifestation/svg/partie.ts @@ -148,11 +148,15 @@ module mod_vtm /** * @author kcf */ - implementierung_manifestation["svg_partie"] = - { - "darstellen": (manifestation) => darstellen(manifestation.angaben), - "binden": (manifestation) => binden(manifestation.angaben), - } + lib_brauch.umsetzen> + ( + brauch_manifestation, + "svg_partie", + { + "darstellen": (manifestation) => darstellen(manifestation.angaben), + "binden": (manifestation) => binden(manifestation.angaben), + } + ) ; } diff --git a/quelldatein/manifestation/web/partie.ts b/quelldatein/manifestation/web/partie.ts index 92abb0f..76d1308 100644 --- a/quelldatein/manifestation/web/partie.ts +++ b/quelldatein/manifestation/web/partie.ts @@ -472,11 +472,15 @@ module mod_vtm /** * @author kcf */ - implementierung_manifestation["web_partie"] = - { - "darstellen": (manifestation) => darstellen(manifestation.angaben), - "binden": (manifestation) => binden(manifestation.angaben), - } + lib_brauch.umsetzen> + ( + brauch_manifestation, + "web_partie", + { + "darstellen": (manifestation) => darstellen(manifestation.angaben), + "binden": (manifestation) => binden(manifestation.angaben), + } + ) ; }