/* * 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_aufbau { /** * @author kcf */ export type typ_test = typ_komplex; /** * @author kcf */ export function test_eingabe ( test : typ_test ) : Array { return ( fallunterscheidung> ( test, { "akzeptortest": (angaben) => akzeptortest_eingabe(angaben), "transduktortest": (angaben) => transduktortest_eingabe(angaben), } ) ); } /** * @author kcf */ export function test_pruefen ( test : typ_test, angenommen : boolean, ausgabe : Array ) : boolean { return ( fallunterscheidung ( test, { "akzeptortest": (angaben) => akzeptortest_pruefen(angaben, angenommen, ausgabe), "transduktortest": (angaben) => transduktortest_pruefen(angaben, angenommen, ausgabe), } ) ); } /** * @author kcf */ export function test_importieren ( test_roh : any ) : typ_test { switch (test_roh["art"]) { case "akzeptortest": { return { "art": "akzeptortest", "angaben": ( akzeptortest_erstellen ( test_roh["angaben"]["eingabe"], test_roh["angaben"]["annehmen"] ) ), }; break; } case "transduktortest": { return { "art": "transduktortest", "angaben": ( transduktortest_erstellen ( test_roh["angaben"]["eingabe"], test_roh["angaben"]["ausgabe"] ) ), }; break; } default: { throw (new Error("unbehandelt")); break; } } } }