ZX Review #7-8-9-10
08 ноября 1997

reader-reader - With 'Light'. Spectrum and expert system.

<b>reader-reader</b> - With 'Light'. Spectrum and expert system.
     The Reader - Reader



Music by ZET

(C) Group 'Light', Serpukhov


  SPECTRUM AND EXPERT SYSTEM


   We want to immediately respond to a question - why and why
needed and where it is used? A
most importantly - is it really possible to realize on the 
Spectrum? Respond immediately - you can, even at

48K. But first, let's immediately
define what an expert
system. Under the expert system means a computer system that 
can offer reasonable advice or carry out a reasonable solution 
to the problem with some of the available source data. 

   An example of expert systems for
Spectrum can be, first and foremost, strategic games, and even 
more chess programs. This assertion is based on the definition 
of an expert system, which is endorsed by committee specialist 
group on expert systems of the British Computer Society. 

   Of course, this article does
can not claim complete coverage of this section, but
We hope that it will, at
least piqued your interest
this region, which borders
artificial intelligence.

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

   Considered here an expert system can be simplified
represented as follows
algorithm:



           Input

       > Variables


                 v


           Application

           current

           decisive

           Rules


                 v


           Assumption

           the possible

           outcome



   All is good, but at an early stage in such an expert
system does not provide data on
the program could give
assumption about the possible outcome. And here on the stage by 
a man who acts role of the teacher. Entered into the computer

those variables for which accurate
the outcome is known, teaches people
him. Thus, initially,
ie at the training stage, the algorithm
expert system might look as follows:



          Input

      > Variables <


                v


          Application

          current

          decisive

          Rules


                v


          Assumption

          the possible

          outcome


                v

     Yes

          This is true


                v No


          Modification

          decisive

          Rules



   As can be seen from the algorithm, simple expert system is 
easy to implement on the Spectrum. In proof of this on the 
algorithm composes a program in BASIC, as a matter of common 
language. If desired, this program is easy to translate into

any other language, even in assembler. For simplicity, assume 
that there are only two possible outcomes: for example, 
tomorrow it will rain tomorrow and will not be

rain. If you enter and run
this program, it asks the question about the number of 
variables involved. 

 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 created three arrays. 
Array R - must contain the rules of inference judgments (which 
is developing a computer), the array V - values ​​of the 
variables presented in this case, the array V $ - used for 
storage variable names.


   The program asks for the names after the launch of these 
variables. It also asks for the names of variables and O $ B $ 
- two possible outcomes. Further clarified details of a 
specific example (for This program requires answers to yes / 
no). 

   Having collected all the necessary information, the program 
makes assumptions about possible outcome. When you agree with 
the system, enter Y, or N - if you do not agree. Then move on 
to another example. So way the process of

machine learning. It should be noted that the machine is 
gradually improve their predictions about the possible outcome, 
though how much better - depends on what information you have 
entered at the beginning.



   (Editor's note. - Training System will
much better if we introduce it REALLY
facts have occurred - and whether there was actually rain - and 
not their agreement 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 have trained their expert system around the world, can be 
safely deleted from the program training block (do not forget

only to keep the arrays with data) and to include this program 
in part any more programs, or use it independently (eg for the 
prediction of rain for days to come). 

   Imagine, however, that we
included the expert system into a strategic game, and
computer on the basis of this system manages a kind of fighting 
robots having very little protection and the weakest means of 
attack. We also assume that in our system is embedded rule

destroy all enemy targets within sight. And now
may come a time when
This weak robot heroically climb into your rocket launcher, and 
as a consequence, about her and left. Here we have two choices: 
the first - is to describe all possible situations (that not 
very realistic) and the second - entered into the system the 
opportunity oriented with minimal and

maximum values ​​of the variables. In simple terms -
make sure that our hypothetical robot with the protection of, 
say, in 1 unit is not useful in a fight

with the robot, with protection in 20
units. Then a block diagram of the
expert system will be as follows:



              Home

                          <


                v



             Request

           variables



                v


         Selecting the most

       > Probable

             outcome


                v

     Yes

         Can set
         nye minimal
         nye and maxi
         mum value
         of influence

         the choice of excitation
         ble

         outcomes


                v No



             DECISION



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

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

   But the point here is this: There are two types of 
decision-making - a parallel and consistent. Here's their 
blokshemy: 


           Variables


           v v v



                v


             Outcome



       Parallel solution



    Request variable <


              v


    Can I predict

    some initial NO


              v YES


    Possible outcome



    Consistent solution


   Certainly consistent
solution is faster,
as the parallel solution
requires the input of all known
variables, and consistent
can conclude, using
only part of them. By the way,
there is speculation that it is
acts as the human brain
in decision-making.

   There is no doubt that in general the parallel procedure to 
obtain a more accurate solution than consistent. However, in 
this case agree that we are more interested in speed of 
calculation than correctness of the decision. Algorithm

calculation in this case is
as follows:



            Home <


               v



            Request

          variable



               v


        Selecting the most

      > Probable

            outcome


               v

    Yes

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

        affect

        choice of excitation
        can proceed


               v No



            DECISION



   Thus, we have
fast algorithm, describing the action of an expert system in 
reaching a decision. 

   Naturally, the material
This article does not describe all
possible solutions and algorithms for
this issue, because the problem of artificial intelligence has 
not been solved until now. However, the simplest

algorithms can be applied even when programming on the 
Spectrum. But implementation of these algorithms for you. So 
what? You undertake Speccy create intelligent programs?



   Those who liked this
idea, can write their thoughts on the following address:


  142214 Serpukhov, ul.Podolskaya, d.107, kv.57


           *







Other articles:

TR-DOS for beginners - The end.

Computer novella - Prince of Persia.

Computer novella - Laser team (the game Laser Squad).

Crossing Dragon - Game Rapscallion.

Crossing Dragon - Playing The Runes of Zendos.

Crossing Dragon - Playing The Saga.

Crossing Dragon - Game Witch's Cauldron.

Crossing Dragon - Create Adventyuru. Review of the editors.

Crossing Dragon - Create a dictionary to Adventyurnoy game.

Program, which we choose - The possible consequences of using undocumented commands.

Program, which we choose - About noticed irregularities in some programs and suggestions for future versions.

Program, which we choose - A proposal to all the authors of software, printers, memory dump. Programmers protect discs from being copied.

Program, which we choose - A few suggestions to improve the assembly.

Program, which we choose - Suggestions for refining ZX Word v2.5.

Program, which we choose - The "Spectrum emulator" v1.2.

Program, which we choose - What could want in a perfect assembly.

Retro - 40 best procedures: Copying data in memory.

Retro - 40 best procedures: Exchange token.

Retro - 40 best procedures: Determination addresses BASIC string.

Retro - 40 best procedures: Determination of the length of BASIC programs.

Retro - 40 best procedures: Determination of the amount of free memory.

Retro - 40 best procedures for: Search and replace strings.

Retro - 40 best procedure: Find the string.

Retro - 40 best procedures: Search for the string.

Retro - 40 best procedures: the list of variables.

Retro - 40 best procedures: an increase and up the screen.

Retro - 40 best treatments: Removal of REM-strings.

Retro - 40 best procedures: Remove the block of the program.

Expert Tips - Game Fredloader.

Expert Tips - Game Robin of Sherwood: The Touchstones of Rhianon.

Expert Tips - Game Scorpions: Die Machines.

Expert Tips - Game Terropods.

page iS-DOS - Description of system restarts IS DOS.

Forum - An algorithm for recognizing characters.

Forum - Time undocumented command processor Z80.

Forum - The concept of a high-color screen resolution.

Forum - A few Pokes to a game. Program Hacman96.

Forum - As for the new DOS and BIOS settings for the Spectrum.

Forum - Multicolor program on any computer model. Using the 2 nd screen Multicolor'a. Demonstration of the text. Electronic journals.

Forum - Project ZX Config.

Forum - Improve Art Studio. Ideas on file compression.

Forum - ZX Spectrum emulator for IBM. About the hexadecimal system. Program ZX-Stars. Oddities in the Elita

Forum - The effects on the curb and Multicolor.

reader-reader - ZX Spectrum 128 - new opportunities, new challenges.

reader-reader - With 'Light'. Spectrum and expert system.

reader-reader - The printer driver for the Scorpion.

reader-reader - Print numbers in different number systems.

reader-reader - Programming arcade game with scrolling screen.

reader-reader - The procedure for printing labels assembler XAS to monitor debugger STS 4.3.

Studies - attribute scrolling text. "Gasilka" screen. A simplified version of the procedure, "Curtain". Procedure is enriched with pictures. Procedure display images on the points.

Studies - Graphic effect "color bars".

Studies - Driver screen printing 64 characters per line.

Studies - Set of protective boot.

Studies - Address to the drive mode IM 2. Working with non-standard disc format.

Studies - Print the character, magnified by 8 times. The program "pouring" screen. The procedure for screen-saver on the points. Clear screen in Terminator'e. Search strings in memory. System character set conversion.

Studies - Program - cataloger of disks.

Studies - Program the output values of the amplitude channel music. coprocessor on the curb.

Studies - Program the output image.

Studies - The program plugs sprite.

Studies - Cleanup of the specified window screen.

Studies - The program sort the array in ascending order. The procedure for filling the screen specified attribute. Procedure display pictures. The effect of moving towards the stars. "Shower", coming from the upper left corner of the screen. The procedure of "shedding" pictures on the pixel lines. The program of "pulling" the picture at an angle of 45 degrees. Three procedures "Scroll".

Studies - The printing of numbers.

Studies - The procedure for drawing a character with attributes.

Studies - The procedure for display pictures. Fade-OUT effect (picture goes beyond the edge of the screen). Visual effect "Fountain." Fade-OUT effect, mimicking the TV off. Procedure "Ignition" pictures. The program continuously drawing a picture.

Studies - The procedure for drawing a line.

Studies - The procedure for making optimal symbol table.

Studies - scrolling lines of text in the specified window. Attribute scroller. Diagonal scrolling.

Studies - sprite scroller. Procedure display screen.

Studies - Short procedure indicating the amplitude channel music. coprocessor. Way to subtract a constant from a register pair HL.

Studies - The formula for calculating the day of the week.


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

Similar articles:
Ferrum! - The controller Kempston-mouse.
Entry - The third issue was not long in coming.

В этот день...   21 November