Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Perkun - die KI die einfache Programe schreibt

75 views
Skip to first unread message

Pawel Biernacki

unread,
Aug 18, 2019, 2:06:49 PM8/18/19
to
Hallo,

Ich habe ein Beispiel für mein Perkun geschrieben (Perkun ist eine KI-orientierte experimentelle Programmiersprache). Ihr könnt das Beispiel aus www.pawelbiernacki.net/programmer.zip herunterladen. Um es zu laufen braucht man Perkun (https://sourceforge.net/projects/perkun/ oder http://www.pawelbiernacki.net/perkun.msi für Windows).

Man führt es so aus:

perkun programmer_final.perkun

Stellt ihr vor eine Programmiersprache die lediglich aus zwei Anweisungen besteht: instruction_if_then und instruction_print. Unser Program besteht aus zwei Befehlen. Es gibt also vier mögliche Programe:

instruction_if_then instruction_if_then
instruction_if_then instruction_print
instruction_print instruction_print
instruction_print instruction_if_then

Als Eingabe gibt man auch noch zusätzlich den Wert der Variabel "it_works" die entweder none, false oder true ist. Ich werde euch demonstrieren wie er durch alle mögliche Programe durchläuft und probiert jeden aus.

Versuchen wir mit dem Program "instruction_if_then instruction_if_then":

perkun> instruction_if_then instruction_if_then none

Die Antwort ist:
action=execute_the_program ...

Nehmen wir an es funktioniert nicht. Wir beantworten mit:

perkun> instruction_if_then instruction_if_then false

Die Antwort ist:
action=change_instruction_to_print which_instruction_to_change=one

Er will also daß wir ändern den ersten Befehl zu "print". Tun wir es:

perkun> instruction_print instruction_if_then none

Die Antwort ist:
action=execute_the_program ...

Nehmen wir an es funktioniert wieder nicht. Geben wir "false" als "it_works":

perkun> instruction_print instruction_if_then false

Jetzt sagt er:

action=change_instruction_to_print which_instruction_to_change=two

Der Program wird also zu "instruction_print instruction_print":

perkun> instruction_print instruction_print none

Er sagt:
action=execute_the_program ...

Sagen wir:
perkun> instruction_print instruction_print false

Er sagt:
action=change_instruction_to_if_then which_instruction_to_change=one

Also wir antworten:
perkun> instruction_if_then instruction_print none

Er sagt:
action=execute_the_program ...

Nehmen wir an das ist der richtige Program. Sagen wir jetzt:

perkun> instruction_if_then instruction_print true

Die Antwort ist wieder:
action=execute_the_program ...

Er wird jetzt in einer unendliche Schleife sich wieder und wieder wünschen daß der Program ausgeführt werden soll, aber die Situation ist jetzt geändert (sein Zustand zeigt es). Jetzt nämlich WEIßT er daß der Program richtig ist.

Ich gebe zu daß es ein sehr einfaches Beispiel ist und wahrscheinlich volkommen nutzlos. Aber ich finde es interessant.

Eine solche Spezifikation für Perkun (wie programmer_final.perkun) schreibt man automatisch mit Hilfe von Prolog (schaut mal programmer.prolog). Man fängt mit programmer_initial.perkun an. Man muß programmer_initial.perkun mit perkun ausführen und dann einige zusätzliche Regeln manuell schreiben.

Pawel Biernacki



0 new messages