111 lines
2.8 KiB
TypeScript
111 lines
2.8 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 export function aktor_schreiber_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 export function aktor_schreiber_License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General export function aktor_schreiber_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_aktor_schreiber =
|
|
{
|
|
richtung : typ_richtung;
|
|
symbol : typ_symbol;
|
|
}
|
|
;
|
|
|
|
|
|
/**
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
*/
|
|
export function aktor_schreiber_erstellen(richtung : typ_richtung = 0, symbol : typ_symbol = 0) : typ_aktor_schreiber
|
|
{
|
|
return {
|
|
"richtung": richtung,
|
|
"symbol": symbol,
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
*/
|
|
export function aktor_schreiber_richtung_lesen(aktor_schreiber : typ_aktor_schreiber) : typ_richtung
|
|
{
|
|
return aktor_schreiber.richtung;
|
|
}
|
|
|
|
|
|
/**
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
*/
|
|
export function aktor_schreiber_symbol_lesen(aktor_schreiber : typ_aktor_schreiber) : typ_symbol
|
|
{
|
|
return aktor_schreiber.symbol;
|
|
}
|
|
|
|
|
|
/**
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
*/
|
|
export function aktor_schreiber_drehen(aktor_schreiber : typ_aktor_schreiber, inkrement : int = +1) : void
|
|
{
|
|
aktor_schreiber.richtung = richtung_addieren(aktor_schreiber.richtung, inkrement);
|
|
}
|
|
|
|
|
|
/**
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
*/
|
|
export function aktor_schreiber_verwenden(aktor_schreiber : typ_aktor_schreiber, figur : typ_figur) : void
|
|
{
|
|
figur_schreiben(figur, aktor_schreiber.symbol);
|
|
figur_bewegen(figur, aktor_schreiber.richtung);
|
|
}
|
|
|
|
|
|
/**
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
*/
|
|
export function aktor_schreiber_exportieren(aktor_schreiber : typ_aktor_schreiber) : any
|
|
{
|
|
return {
|
|
"richtung": richtung_exportieren(aktor_schreiber.richtung),
|
|
"symbol": symbol_exportieren(aktor_schreiber.symbol),
|
|
};
|
|
}
|
|
|
|
|
|
/**
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
*/
|
|
export function aktor_schreiber_importieren(roh : any) : typ_aktor_schreiber
|
|
{
|
|
return (
|
|
aktor_schreiber_erstellen
|
|
(
|
|
richtung_importieren(roh["richtung"]),
|
|
symbol_importieren(roh["symbol"])
|
|
)
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
|