vtm/quelldatein/aufbau/aktoren/annehmer.ts
Christian Fraß 74a9792bbf fast fertig
2018-03-26 00:41:10 +02:00

144 lines
2.7 KiB
TypeScript

/*
* 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_annehmer =
{
}
;
/**
* @author kcf <vidofnir@folksprak.org>
*/
function annehmer_erstellen
(
)
: typ_annehmer
{
return {
};
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function annehmer_erstellen_aktor
(
)
: typ_aktor
{
return {"art": "annehmer", "angaben": annehmer_erstellen()};
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
function annehmer_beispiel
(
)
: typ_annehmer
{
return annehmer_erstellen();
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
function annehmer_drehen
(
annehmer : typ_annehmer,
inkrement ?: int
)
: void
{
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
function annehmer_verwenden
(
annehmer : typ_annehmer,
figur : typ_figur
)
: void
{
figur_annehmen(figur);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
function annehmer_exportieren
(
annehmer : typ_annehmer
)
: any
{
return {
};
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
function annehmer_importieren
(
roh : any
)
: typ_annehmer
{
return (
annehmer_erstellen
(
)
);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
let wrap = (angaben => ({"art": "annehmer", "angaben": angaben}));
let unwrap = (aktor => aktor.angaben);
implementierung_aktor["annehmer"] =
{
"beispiel": () => wrap(annehmer_beispiel()),
"drehen": (aktor, inkrement) => annehmer_drehen(unwrap(aktor), inkrement),
"verwenden": (aktor, figur) => annehmer_verwenden(unwrap(aktor), figur),
"exportieren": (aktor) => ({"art": "annehmer_", "angaben": annehmer_exportieren(aktor.angaben)}),
"importieren": (roh) => wrap(annehmer_importieren(roh)),
}
;
}