📜 ⬆️ ⬇️

Here it is, mutated algorithm. Or what can not "Lisp"

I suppose you will be interested to look at a real mutating algorithm, which only knows how to do what to mutate. Only a couple of functions written in the cursed language "Author".
In this article I:



To begin with, I want to say that the only fundamental difference between the “Author” language and other languages ​​is the ability of programs to visually edit their own algorithm. Not the program text, but the algorithm. Look here . In my opinion, it is this opportunity that is necessary and sufficient for the existence of self-learning programs and, of course, I’m not afraid of this word, artificial intelligence. Yes, yes, it is AI. As an informatics teacher told me: “Go to the software department, shout" artificial intelligence "and everyone will be confused." And I mov - people, let me do the AI, just explain to me, fool, how to do it. If I already understand something, I will certainly be able to teach this machine. What is considered intelligence? What is considered self-study? How to counter the intellect or benefit? Philosophical question. Give me one exhibitor of information ...

So, here is the “easiest” example of a program that is trying to learn, so much so as not to break itself:
')
 // killme.txt
 var generator (n) {
	 if (n <2) return PROGRAM ({1,5,18,3,7, "x", "y"} [#]);
	 a = (int) (n / {1.4,2} [#]);
	 if (#? 1: 0) a = na;
	 b = na;
	 operators = {"+", "-", "*", "|", "&"};
	 command = PROGRAM ("#" + operators [#] + "#");
	 command.setSub ({0}, generator (a));
	 command.setSub ({1}, generator (b));
	 return command;
 }

 void main (functionName) {
	 if (! isset (functionName)) {
		 main (getThisFunctionName ());
		 main ("generator");
		 return;
		 }
	 f = getFunction (functionName);
	 ids = f.getIDs () + {f.Root ()};
	 pos = ids [#];
	 next = f.Next (pos);
	 isElse = 0;
	 if (typeof (next) == "vector") isElse = rand ()% next.size ();
	 pos = f.insertDown (pos, isElse);
	 f.setCommand (pos, generator (5));
	 pos = f.insertDown (pos);
	 f.setIF (pos, "#? 1: 0");
 }


Of course, you will say that an example of a program that already can do everything will be even easier. But let's not build everything into an absolute.

The first function produces garbage, the second feeds itself and the first one to them. The measure of the development of the algorithm was originally defined.

This is what the algorithm will become after its fifth launch:

 // killme.code
 var generator (var n) {
	 if (n <2) return PROGRAM ({1,5,18,3,7, "x", "y"} [#]); else {
		 5-1 & (7 | 1-18);
		 if (#? 1: 0);
		 }
	 a = ((int) (n / {1.4,2} [#]));
	 if (#? 1: 0) a = na;
	 b = na;
	 7 * x | x- (x-18);
	 if (#? 1: 0);
	 operators = {"+", "-", "*", "|", "&"};
	 (5 & 3) -3- (1 | 18);
	 (3 | 7) | 18 & 3 & y;
	 7 + 18 | 7- (y & x);
	 if (#? 1: 0);
	 if (#? 1: 0);
	 if (#? 1: 0);
	 command = PROGRAM ("#" + operators [#] + "#");
	 command.setSub ({0}, generator (a));
	 command.setSub ({1}, generator (b));
	 return command;
 }

 void main (var functionName) {
	 if (! isset (functionName)) {
		 main (getThisFunctionName ());
		 (5 | 5) - (7 & x * x);
		 if (#? 1: 0);
		 main ("generator");
		 return;
		 } else {
		 7 * 5 + 7 * (18 & 7);
		 if (#? 1: 0);
		 }
	 f = getFunction (functionName);
	 ids = f.getIDs () + {f.Root ()};
	 pos = ids [#];
	 next = f.Next (pos);
	 isElse = 0;
	 if (typeof (next) == "vector") isElse = rand ()% next.size ();
	 pos = f.insertDown (pos, isElse);
	 x- (x & 3) + (18 | 5);
	 if (#? 1: 0) {
		 (3 | 7) + (x & 1 + 3);
		 if (#? 1: 0); else {
			 (y | 7-1) & (18 | x);
			 if (#? 1: 0);
			 }
		 }
	 f.setCommand (pos, generator (5));
	 pos = f.insertDown (pos);
	 f.setIF (pos, "#? 1: 0");
 }
 // killme.code: - |


Of course, you can make an even more mutated algorithm with changing the names of variables and changing the order of some commands, but it initially wakes up, only more and more complicated.

Sometimes it seems to me that I, with my own articles, produce garbage, but this can also be said about our entire banking system.

But the "transformation" can be done in the other direction. Set up a program for self-improvement. Let the program minimize itself in size, complexity and / or execution time. Here it will be something similar to AI in terms of "robot programmer."

Now I want to focus on the question "What is considered to be self-study?".
Here, on the one hand, everything is simple - there was no algorithm, and now it appeared. There was no data, and here they appeared. But on the other hand, if they were not there initially, then how can they appear. So there must be something from where this data can be extracted, something from where the algorithm can be understood?

Here you have the task of wit. Tell me, what did the author of the following code want to write?

 // smekni.txt
 void main () {
	 m = {4,6,1,78,43,59,8,12};
	 while (1) {
		 ok = 1;
		 for (i = 1; i <m.size (); ++ i) if (m [i-1]> m [i]) ok = 0;
		 if (ok) break;
		 a = rand ()% m.size ();
		 b = rand ()% m.size ();
		 X = m [a];
		 m [a] = m [b];
		 m [b] = X;
		 }
	 trace (m.export ());
	 getstring ();
 }


Well, I do not know how to sort the array. Lisp studied all his life. Understand me. Understand.

I think you will ever understand me.

I have to ask you. Send me tasks in which you can see a measure of learning, like the Tower of Henoy or the Stick. Surely the game "Stick" there is the original name, I just do not know it.

The game is as follows. A million poles are given, two players, each player can pick up one, two or three sticks for his turn, players walk in turns, who took the last stick lost. The first to go, of course, is me :). Here it is not a matter of losing or winning, but of the fact that these tasks can be presented as an algorithm from which you need to get a rule, a skill. That's what the salt is.

That is what it means to look at the terminator ass in childhood).

To be continued?

Source: https://habr.com/ru/post/277305/


All Articles