verbesserungen

This commit is contained in:
Christian Fraß 2018-03-28 12:09:27 +02:00
parent 250b58aa1b
commit 6dca386ce6
16 changed files with 783 additions and 379 deletions

View file

@ -60,9 +60,9 @@ ${dir_erzeugnis}/vtm.js: \
${dir_quelldatein}/aufbau/zustand.ts \ ${dir_quelldatein}/aufbau/zustand.ts \
${dir_quelldatein}/aufbau/figur.ts \ ${dir_quelldatein}/aufbau/figur.ts \
${dir_quelldatein}/aufbau/aktoren/_aktor.ts \ ${dir_quelldatein}/aufbau/aktoren/_aktor.ts \
${dir_quelldatein}/aufbau/aktoren/erzeuger.ts \
${dir_quelldatein}/aufbau/aktoren/annehmer.ts \
${dir_quelldatein}/aufbau/aktoren/verwerfer.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/befoerderer.ts \
${dir_quelldatein}/aufbau/aktoren/schreiber.ts \ ${dir_quelldatein}/aufbau/aktoren/schreiber.ts \
${dir_quelldatein}/aufbau/aktoren/leser.ts \ ${dir_quelldatein}/aufbau/aktoren/leser.ts \
@ -77,9 +77,15 @@ ${dir_erzeugnis}/vtm.js: \
${dir_quelldatein}/aufbau/partie.ts \ ${dir_quelldatein}/aufbau/partie.ts \
${dir_quelldatein}/manifestation/manifestation.ts \ ${dir_quelldatein}/manifestation/manifestation.ts \
${dir_quelldatein}/manifestation/position.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/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/svg/partie.ts \
${dir_quelldatein}/manifestation/web/partie.ts \ ${dir_quelldatein}/manifestation/web/partie.ts \
${dir_quelldatein}/manifestation/speicher/partie.ts \ ${dir_quelldatein}/manifestation/speicher/partie.ts \

View file

@ -22,7 +22,7 @@ module lib_aufruf
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export type typ_komplex<typ_angaben> = {art : string; angaben ?: typ_angaben;}; export type typ_komplex<typ_angaben> = {art : string; angaben : typ_angaben;};
/** /**

View file

@ -31,7 +31,7 @@ module mod_vtm
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export type schnittstelle_manifestation<typ_aufbau, typ_ausgabe> = export type signatur_manifestation<typ_aufbau, typ_ausgabe> =
{ {
darstellen : (manifestation : typ_manifestation<typ_aufbau>)=>typ_ausgabe; darstellen : (manifestation : typ_manifestation<typ_aufbau>)=>typ_ausgabe;
binden : (manifestation : typ_manifestation<typ_aufbau>)=>void; binden : (manifestation : typ_manifestation<typ_aufbau>)=>void;
@ -42,31 +42,43 @@ module mod_vtm
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export var implementierung_manifestation : {[art : string] : schnittstelle_manifestation<any, any>} = {}; export var brauch_manifestation : lib_brauch.typ_brauch<signatur_manifestation<any, any>> = lib_brauch.erstellen<signatur_manifestation<any, any>>();
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export function darstellen<typ_aufbau, typ_ausgabe>(manifestation : typ_manifestation<typ_aufbau>) : typ_ausgabe export function darstellen<typ_aufbau, typ_ausgabe>
(
manifestation : typ_manifestation<typ_aufbau>
)
: typ_ausgabe
{ {
return implementierung_manifestation[manifestation.art].darstellen(manifestation); return lib_brauch.anwenden(brauch_manifestation, manifestation.art)["darstellen"](manifestation);
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export function binden<typ_aufbau, typ_ausgabe>(manifestation : typ_manifestation<typ_aufbau>) : void export function binden<typ_aufbau, typ_ausgabe>
(
manifestation : typ_manifestation<typ_aufbau>
)
: void
{ {
return implementierung_manifestation[manifestation.art].binden(manifestation); return lib_brauch.anwenden(brauch_manifestation, manifestation.art)["binden"](manifestation);
} }
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
export function einrichten<typ_aufbau, typ_ausgabe>(manifestation : typ_manifestation<typ_aufbau>) : void export function einrichten<typ_aufbau, typ_ausgabe>
(
manifestation : typ_manifestation<typ_aufbau>
)
: void
{ {
darstellen<typ_aufbau, typ_ausgabe>(manifestation); darstellen<typ_aufbau, typ_ausgabe>(manifestation);
binden<typ_aufbau, typ_ausgabe>(manifestation); binden<typ_aufbau, typ_ausgabe>(manifestation);

View file

@ -151,11 +151,15 @@ module mod_vtm
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
implementierung_manifestation["speicher_partie"] = lib_brauch.umsetzen<signatur_manifestation<mod_vtm.mod_aufbau.mod_partie.typ_partie, void>>
(
brauch_manifestation,
"speicher_partie",
{ {
"darstellen": (manifestation) => darstellen(manifestation.angaben), "darstellen": (manifestation) => darstellen(manifestation.angaben),
"binden": (manifestation) => binden(manifestation.angaben), "binden": (manifestation) => binden(manifestation.angaben),
} }
)
; ;
} }

View file

@ -37,6 +37,63 @@ module mod_vtm
export const form_pfeil : string = "M +4 0 L 0 +1 L 0 -1 Z"; export const form_pfeil : string = "M +4 0 L 0 +1 L 0 -1 Z";
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function rotation
(
staerke : float
)
: string
{
return (
"rotate"
+ "("
+ (staerke * 360).toFixed(float_praezission)
+ ")"
);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function translation
(
x : float,
y : float
)
: string
{
return (
"translate"
+ "("
+ x.toFixed(float_praezission)
+ ", "
+ y.toFixed(float_praezission)
+ ")"
);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function skalierung
(
staerke : float
)
: string
{
return (
"scale"
+ "("
+ staerke.toFixed(float_praezission)
+ ")"
);
}
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */

View file

@ -1,339 +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_manifestation
{
export module mod_svg
{
export module mod_aktor
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
export type typ_aktor =
{
aufbau : mod_vtm.mod_aufbau.mod_aktor.typ_aktor;
stelle : mod_vtm.mod_aufbau.mod_stelle.typ_stelle;
}
;
/**
* @author kcf <vidofnir@folksprak.org>
*/
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 <vidofnir@folksprak.org>
*/
export function erstellen_manifestation
(
aufbau : mod_vtm.mod_aufbau.mod_aktor.typ_aktor,
stelle : mod_vtm.mod_aufbau.mod_stelle.typ_stelle
)
: typ_manifestation<mod_vtm.mod_aufbau.mod_aktor.typ_aktor>
{
return {
"art": "aktor",
"angaben": erstellen(aufbau, stelle),
};
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
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_xml.typ_knoten> = [];
lib_aufruf.fallunterscheidung<void>
(
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<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>;}> =
[
{
"summand": 0,
"symbol": lib_fehlermonade.erstellen_nichts<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>(),
},
{
"summand": +2,
"symbol": lib_fehlermonade.erstellen_schlicht<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>(symbol_links),
},
{
"summand": -2,
"symbol": lib_fehlermonade.erstellen_schlicht<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>(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<mod_aufbau.mod_symbol.typ_symbol>(eintrag.symbol)
? "symbol_" + lib_fehlermonade.lesen<mod_aufbau.mod_symbol.typ_symbol>(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 <vidofnir@folksprak.org>
*/
implementierung_manifestation["aktor"] =
{
"darstellen": (manifestation) => darstellen(manifestation.angaben),
"binden": (manifestation) => {},
}
;
}
}
}
}

View file

@ -0,0 +1,161 @@
/*
* 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_manifestation
{
export module mod_svg
{
export module mod_aktor
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
export type signatur_aktor =
{
darstellen : (aktor : mod_vtm.mod_aufbau.mod_aktor.typ_aktor)=>Array<lib_xml.typ_knoten>;
}
;
/**
* @author kcf <vidofnir@folksprak.org>
*/
export var brauch_aktor : lib_brauch.typ_brauch<signatur_aktor> = lib_brauch.erstellen<signatur_aktor>();
/**
* @author kcf <vidofnir@folksprak.org>
*/
export type typ_aktor =
{
aufbau : mod_vtm.mod_aufbau.mod_aktor.typ_aktor;
stelle : mod_vtm.mod_aufbau.mod_stelle.typ_stelle;
}
;
/**
* @author kcf <vidofnir@folksprak.org>
*/
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 <vidofnir@folksprak.org>
*/
export function erstellen_manifestation
(
aufbau : mod_vtm.mod_aufbau.mod_aktor.typ_aktor,
stelle : mod_vtm.mod_aufbau.mod_stelle.typ_stelle
)
: typ_manifestation<mod_vtm.mod_aufbau.mod_aktor.typ_aktor>
{
return {
"art": "svg_aktor",
"angaben": erstellen(aufbau, stelle),
};
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
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<signatur_aktor>(brauch_aktor, aktor.art)["darstellen"](aktor))
)
)
);
return knoten_feld;
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
function binden(aktor : typ_aktor) : void
{
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
lib_brauch.umsetzen<signatur_manifestation<mod_vtm.mod_aufbau.mod_aktor.typ_aktor, lib_xml.typ_knoten>>
(
brauch_manifestation,
"svg_aktor",
{
"darstellen": (manifestation) => darstellen(manifestation.angaben),
"binden": (manifestation) => binden(manifestation.angaben),
}
)
;
}
}
}
}

View file

@ -0,0 +1,74 @@
/*
* 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_manifestation
{
export module mod_svg
{
export module mod_aktor
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
lib_brauch.umsetzen
(
brauch_aktor,
"annehmer",
{
"darstellen": (aktor) =>
{
let kinder : Array<lib_xml.typ_knoten> = [];
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;
}
,
}
)
;
}
}
}
}

View file

@ -0,0 +1,79 @@
/*
* 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_manifestation
{
export module mod_svg
{
export module mod_aktor
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
lib_brauch.umsetzen
(
brauch_aktor,
"befoerderer",
{
"darstellen": ({"angaben": {"richtung": richtung}}) =>
{
let kinder : Array<lib_xml.typ_knoten> = [];
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;
}
,
}
)
;
}
}
}
}

View file

@ -0,0 +1,79 @@
/*
* 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_manifestation
{
export module mod_svg
{
export module mod_aktor
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
lib_brauch.umsetzen
(
brauch_aktor,
"erzeuger",
{
"darstellen": ({"angaben": {"richtung": richtung}}) =>
{
let kinder : Array<lib_xml.typ_knoten> = [];
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;
}
,
}
)
;
}
}
}
}

View file

@ -0,0 +1,113 @@
/*
* 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_manifestation
{
export module mod_svg
{
export module mod_aktor
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
lib_brauch.umsetzen
(
brauch_aktor,
"leser",
{
"darstellen": ({"angaben": {"richtung": richtung, "symbol_links": symbol_links, "symbol_rechts": symbol_rechts}}) =>
{
let kinder : Array<lib_xml.typ_knoten> = [];
type typ_eintrag =
{
summand : mod_vtm.mod_aufbau.mod_richtung.typ_richtung;
symbol : lib_fehlermonade.typ_fehlermonade<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>;
}
;
let ausgaenge : Array<typ_eintrag> =
[
{
"summand": 0,
"symbol": lib_fehlermonade.erstellen_nichts<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>(),
},
{
"summand": +2,
"symbol": lib_fehlermonade.erstellen_schlicht<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>(symbol_links),
},
{
"summand": -2,
"symbol": lib_fehlermonade.erstellen_schlicht<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>(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<mod_aufbau.mod_symbol.typ_symbol>(eintrag.symbol)
? "symbol_" + lib_fehlermonade.lesen<mod_aufbau.mod_symbol.typ_symbol>(eintrag.symbol).toFixed(0)
: "neutral"
),
].join(" ")
),
"transform": (
[
rotation(winkelstaerke),
translation(+0.1, 0),
skalierung(0.075),
].join(" ")
),
}
)
);
kinder.push(knoten_pfeil);
}
)
;
return kinder;
}
,
}
)
;
}
}
}
}

View file

@ -0,0 +1,79 @@
/*
* 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_manifestation
{
export module mod_svg
{
export module mod_aktor
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
lib_brauch.umsetzen
(
brauch_aktor,
"schreiber",
{
"darstellen": ({"angaben": {"richtung": richtung, "symbol": symbol}}) =>
{
let kinder : Array<lib_xml.typ_knoten> = [];
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;
}
,
}
)
;
}
}
}
}

View file

@ -0,0 +1,74 @@
/*
* 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_manifestation
{
export module mod_svg
{
export module mod_aktor
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
lib_brauch.umsetzen
(
brauch_aktor,
"verwerfer",
{
"darstellen": (aktor) =>
{
let kinder : Array<lib_xml.typ_knoten> = [];
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;
}
,
}
)
;
}
}
}
}

View file

@ -153,14 +153,7 @@ module mod_vtm
"g", "g",
{ {
"class": "figur", "class": "figur",
"transform": ( "transform": translation(position.x, position.y),
"translate"
+ "("
+ position.x.toFixed(float_praezission)
+ ","
+ position.y.toFixed(float_praezission)
+ ")"
),
}, },
kinder_figur kinder_figur
) )
@ -180,11 +173,15 @@ module mod_vtm
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
implementierung_manifestation["svg_figur"] = lib_brauch.umsetzen<signatur_manifestation<mod_vtm.mod_aufbau.mod_figur.typ_figur, lib_xml.typ_knoten>>
(
brauch_manifestation,
"svg_figur",
{ {
"darstellen": (manifestation) => darstellen(manifestation.angaben), "darstellen": (manifestation) => darstellen(manifestation.angaben),
"binden": (manifestation) => binden(manifestation.angaben), "binden": (manifestation) => binden(manifestation.angaben),
} }
)
; ;
} }

View file

@ -148,11 +148,15 @@ module mod_vtm
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
implementierung_manifestation["svg_partie"] = lib_brauch.umsetzen<signatur_manifestation<mod_vtm.mod_aufbau.mod_partie.typ_partie, lib_xml.typ_knoten>>
(
brauch_manifestation,
"svg_partie",
{ {
"darstellen": (manifestation) => darstellen(manifestation.angaben), "darstellen": (manifestation) => darstellen(manifestation.angaben),
"binden": (manifestation) => binden(manifestation.angaben), "binden": (manifestation) => binden(manifestation.angaben),
} }
)
; ;
} }

View file

@ -472,11 +472,15 @@ module mod_vtm
/** /**
* @author kcf <vidofnir@folksprak.org> * @author kcf <vidofnir@folksprak.org>
*/ */
implementierung_manifestation["web_partie"] = lib_brauch.umsetzen<signatur_manifestation<mod_vtm.mod_aufbau.mod_partie.typ_partie, void>>
(
brauch_manifestation,
"web_partie",
{ {
"darstellen": (manifestation) => darstellen(manifestation.angaben), "darstellen": (manifestation) => darstellen(manifestation.angaben),
"binden": (manifestation) => binden(manifestation.angaben), "binden": (manifestation) => binden(manifestation.angaben),
} }
)
; ;
} }