ZX Review #1-2
31 декабря 1996

reader-reader - Spectrum and expert systems.

<b>reader-reader</b> - Spectrum and expert systems.
(C) With 'Light', Serpukhov, 1996


                    SPECTRUM AND EXPERT SYSTEM


   We want to immediately respond to a question - why and why 
and where it is used? And most importantly - is it really 
possible to implement a Spectrum? Respond immediately - you 
can, even at 48K. But first, let immediately determine that 
such an expert system. Under the expert system means a computer 
system that can offer sensible advice, or make a reasonable 
solution to the problem at available some of the original data.


   An example of expert systems on the Spectrum can be used in 
the first place, strategic games, and even more chess programs. 
This assertion is based on the definition of an expert system, 
which is approved by the Board of Specialists in expert systems 
British Computer Society. 

   Of course, this article does not claim to be complete
coverage of this section, but we hope it will, at least
piqued your interest in this area, which borders on the 
artificial intelligence.


   In this paper we consider an expert system which involves
human presence in the initial decision-making process, ie, in
education system.

   Considered here an expert system may be simply represented as
the following algorithm:



                         Input

                     > Variables



                         Application

                         current

                         decisive

                         Rules



                         Assumption

                         the possible

                         outcome



   All is good, but at an early stage in such an expert system
does not contain data that the program could give the assumption
about the possible outcome. And here on the stage by a man who
acts as a teacher, entered into the computer those variables 
for which precisely known outcome, the person teaching it. Thus 
initially, ie at the training stage, the algorithm of the 
expert system might look as follows:




                         Input

                     > Variables <



                         Application

                         current

                         decisive

                         Rules



                         Assumption

                         the possible

                         outcome



                    Yes

                         This is true


                                 No


                         Modification

                         decisive

                         Rules



   As can be seen from the algorithm, simple expert system is 
easy implemented on the Spectrum. In proof of this on the 
algorithm draw up a program in BASIC, as a matter of common 
language. When want this program to easily translate into any 
language, even assembler. For simplicity, assume that there are 
only two possible outcomes: for example, tomorrow it will rain 
tomorrow and it will not rain. If you enter and to run this 
program, it asks the question about the number of involved 
variables. 


   Number of the variable variable name


        1 Pressure rises

        2 Pressure drops

        3 Wind is

        4 No wind


   Clearly, the choice of variables lies entirely on your 
knowledge and abilities. Then, in memory of the machine creates 
three arrays. Array R - must contain the rules of inference 
judgments (which is developing a computer), an array of V - 
variable values ​​represented in this particular case, array V 
$ - used to store the variable names. 

   The program asks for the names after the launch of these 
variables. She also asks for the names of variables and O $ B $ 
- two possible outcomes. Next, find out details of a specific 
example (for a given program requires answers to yes / no).


   Having collected all the necessary information, the program 
makes the assumption regarding the possible outcome. When you 
agree with the system, enter Y, or N - if not According to ". 
Then move on to another example. Thus the process of machine 
learning. It should be noted that the machine is gradually 
improving its prediction regarding the possible outcome, though 
how much better - depends on what information you have entered 
at the beginning. 

   (Ed. - Training system goes much better if you enter into it
Real case of the facts - and whether there was actually rain - 
and not the consent or disagreement with its decision).


   And now he is listing the program.


     10 CLS

     20 INPUT "Enter the number of VARIABLES"; VAR

     30 DIM V (VAR): DIM R (VAR): DIM V $ (VAR)

     40 FOR I = 1 TO VAR

     50 V (I) = 0

     60 R (I) = 0

     70 NEXT I: PRINT

     80 PRINT "Name these variables'

     90 FOR I = 1 TO VAR

    100 INPUT "variable name:"; V $ (I)

    110 NEXT I: PRINT

    120 PRINT "Name the possible outcomes:"

    130 INPUT "FIRST EXODUS:"; O $

    140 INPUT "SECOND EXODUS:"; B $

    150 PRINT

    160 FOR I = 1 TO VAR

    170 V (I) = 0

    180 PRINT "VARIABLE:"; V $ (I)

    190 INPUT "IS THIS VARIABLE <Y/N>"; A $

    200 IF A $ = "Y" OR A $ = "y" THEN LET V (I) = 1

    210 NEXT I

    220 DC = 0

    230 FOR I = 1 TO VAR

    240 DC = DC + V (I) * R (I)

    250 NEXT I

    260 PRINT "possible outcome -";

    261 IF DC> 0 THEN PRINT O $

    262 IF DC <0 THEN PRINT B $

    270 INPUT "It is true <Y/N>"; A $

    280 IF A $ = "Y" OR A $ = "y" THEN GOTO 150

    290 IF DC> 0 THEN FOR I = 1 TO VAR: R (I) = R (I)-V (I): 
NEXT I 

    291 IF DC <0 THEN FOR I = 1 TO VAR: R (I) = R (I) + V (I): 
NEXT I 

    300 GOTO 150


   Once you decide that you have trained their expertise 
throughout the system in the world, can be safely deleted from 
the program training unit (not Remember only to keep the arrays 
with data) and include the program of what else the program, or 
use it independently (eg for the prediction of rain for days to 
come). 

   We represent, however, that we have incorporated this expert 
system in strategic game, and the computer on the basis of this 
system operates a kind of fighting robots having very little 
protection and the most weak means of attack. We also assume 
that our system embedded rule to destroy all enemy objects 
within sight. And here may come a time when this robot is very 
weak heroically climb into your rocket launcher, and as a 
result, about it will remain so. Here we have two options: 
first - to describe it all possible situation (which is not 
very realistic) and the second - to enter into ability to 
navigate the system with minimum and maximum variable values. 
In simple terms - to make sure that our hypothetical robot say 
to the protection of 1 unit is not useful in a fight with robot 
having protection in 20 units. Then a block diagram of the 
expert system will be as follows:




                         Home

                                        <



                         Request


                       variables



                       Selecting the most

                     > Probable

                           outcome



                   Yes

                       Can set
                       nye minimal
                       nye and maxi
                       mum value
                       of influence

                       the choice of excitation
                       ble

                       outcomes


                               No



                          DECISION



   I must say that this block diagram is not perfect, but
due to the fact that the minimum and maximum values ​​of the 
variables checked only when necessary - the algorithm is 
obtained pretty quick.


   I must say that speed is not the last role.
Of course, when you build an expert system that puts
medical diagnoses, then there performance is not very crucial.
Another thing - computer games. Here you can even donate some
intelligence for speed program.

   But the point here is this: There are two types of production
solutions - parallel and serial. Here's their flowcharts:



          Variable Request variable <



                            Can I predict

                            some initial NO


                                        YES


           The outcome of a possible outcome



        Parallel Sequential

        solution solution


   Undoubtedly, the sequential solution is faster, so
as a parallel solution requires the input of all the known 
variables, and consistently unable to conclude that using only 
part of them. By the way, there is speculation that this is how 
the human brain works in decision-making.


   There is no doubt that in general the parallel procedure to
get a more accurate solution than consistent.
However, in this case agree that we are interested
higher speed of calculation than the correctness of the 
decision. Calculation algorithm in this case is as follows:



                         Home

                                        <



                         Request


                        variable



                       Selecting the most

                     > Probable

                           outcome



                   Yes

                       Can set
                       nye minimal
                       nye and maxi
                       mum value
                       expressions for the remaining
                       variables

                       affect

                       choice of excitation
                       can proceed


                               No



                          DECISION



   Thus, we have a fast algorithm that describes
effect of expert system in reaching a decision.

   Naturally, the material in this article does not describe 
all possible solutions and algorithms on this issue, because 
the problem of artificial intelligence has not been solved so 
far. However, simple algorithms may apply even when programming 
on the Spectrum. A realization of these Algorithms for you. So 
what? you undertake to create intelligent Speccy program?


      Those who liked this idea can write their thoughts on the 
following address: 142214 Serpukhov, st. Podolsky, D., 107 
square meters. 57. 





Other articles:

Business Card - an overview of electronic journals for the ZX Spectrum.

Computer novella - In the game "The Saga"

Computers, we choose - Finalization of the computer "ATM-TURBO".

Spectrum in School - an article on numerical methods, "Seidel method for solving the linear.

Entry - greetings from the Editor.

New Programs - copier ABCDcopy and utility for formatting floppy disks Floppy Format.

Forum - questions and answers on games: Jungle Warrior, Buratino, Streaker, Paris Dakar, Bloodwych, Hero Quest, Apollo, Cliff Hanger, Cyber Hordes, Paradise Valley, Star Drive, Laser Platoon, Movie, Where Time Stood Still, The Sceptre, Carrier Command, etc.

Expert Tips - the strategic game Wellingsto at Waterloo.

Expert Tips - the strategic game of Napoleon.

Expert Tips - for the game Star Fox.

Crossing Dragon - Dungeons & Dragons (the first chapter of a book on adventyurnyh games).

TR-DOS for beginners - 5 th chapter of the book "General information on the disk system TP DOS.

Returning to the printed - the last file dizzasemblera TR-DOS.

reader-reader - On the hardware, software and Other Computer Profi ...

reader-reader - Recover lost data.

reader-reader - Spectrum and expert systems.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Studies - The procedure for searching text files.
Stories - Pusher.
From the authors - "ZX NEWS 2" to be released.
Fun Top'98 - Information about the festival of computer art.

В этот день...   28 April