Introduction: How to Make Clever Machines

Computers are rather powerful now, but more computing power doesn't mean that they automatically become more intelligent. Need to implement this yet. We will use the example of a robot playing a ball and create it using Robotics Sandbox in WinNB.

Step 1: Understand Stupidity.

To begin with, let's define what we don't want. What is a stupid machine?
The manipulator must throw the ball, then catch it back.

catch ball.mp4

Here the actions are correct and we can repeat, but now the ball is already in the hand. The circumstances have changed and the program doesn't work.

stupid1.mp4

This is a common woe of algorithmic software based on predetermined sequences of actions.

@InfLevel := 1;

take ball;

remember: _operator(1,"prepare throw");

remember: _operator(1,"begin throw");

remember: _operator(1,"end throw");

remember: _operator(1,"catch")

so as to play ball.

Step 2: Understand Conditional Reflex.

Attempts to discover the material basics of the psyche and behavior lead to the concept of a reflex. The term was introduced by Rene Descartes. In programming it is represented by a single rule.

@InfLevel := @InfLevel + 1;

move to @att1Attr @Obj;

remember: _operator(@InfLevel,"grasp");

remember: _operator(@InfLevel,"move to i p")

so as to take @att1Attr @Obj.

Ivan Pavlov made an upgrade. A conditional reflex means that the reaction to a stimulus depends upon context. That's exactly what we need. Let's add yet another operator which checks for different conditions.

_grip("ellipse",1);

_first_operator;

#cut

so as to take ball.

take it

so as to take ball.

Note that it is implemented using already 2 rules. The first does nothing when the ball is already gripped. The second proceeds as previously.

Step 3: Different Initial Conditions.

Next, let's try from a different position.

catch ball low.mp4

Obviously, the robot needs to take the ball again but can't.

stupid2.mp4

Why? Because the hand is turned horizontally. We can easily fix this by adding yet another step.

_grip("ellipse",1);

_first_operator;

#cut

so as to take ball.

@InfLevel := @InfLevel + 1;

turn into vertical position;

remember: _operator(@InfLevel,"take")

so as to take ball.

It is also conditional.

turn into vertical position if

@InfLevel := @InfLevel + 1;

_check_horizontal;

_get_curr_coord(@X0,@Y0);

@DY=80-@Y0;

@NY=#trunc(@DY);

_move_y(@NY);

remember: _instruction(@InfLevel,90,-1,1);

#cut().

turn into vertical position if

_first_operator.

Implemented using 2 rules. The first turns the manipulator 90 degrees clockwise. The second is used if _check_horizontal fails and does nothing.

Step 4: Play More.

Search for other situations when the basic algorithm doesn't work. Say, this.
stupid3.mp4

Step 5: Correct Them.

In this case, just expand fingers. If they are already expanded, the program will do some internal operations without visible effects.
@InfLevel := @InfLevel + 1;

turn into vertical position;

remember: _operator(@InfLevel,"release");

remember: _operator(@InfLevel,"take")

so as to take ball.

catch ball1.mp4

Step 6: Draw Conclusions.

Play with the improved version of the program and you will see that it has become quite intelligent. A conditional reflex is not the human-grade psyche yet, but it efficiently removes stupidity of primitive automatons.
You can write such programs yourself using free WinNB or buy them in Robotics Sandbox. https://nbsite.000webhostapp.com/buy.htm