Analysis of Mendel
1987/12/01 Arrojeria, Eustakio - Elhuyar Zientziaren Komunikazioa | Lizaso, Pili - Informatika SailaElhuyar Fundazioa Iturria: Elhuyar aldizkaria
On the other hand, as the calculation is complicated, it should be known that the difficulty of the program is complicated geometrically.
This program is only an approximation to the learning dialogue of the laws of Mendel. For this purpose, a simple example will be used.
Suppose we have a specific hereditary character, such as color. We will use G to indicate the red and Z to indicate the white. In addition, it will not be indicated who has priority.
It will be considered a gene for each chromosome and, once given the genotypes of both people accurately, it is intended to know the genotype of first-generation children. Once answered, the computer will compare with the actual response and decide whether to correct or not.
The first genotypes will be created randomly by the computer and communicated to the user.
For example, if one parent is BA and the other AD, the actual result will be:
and the genotype of first-generation children:
1.- As you will see, line 400 of this program has used the function CSRLIN. This function returns as a result the line in which the cursor is located at a given time.
The goal of this line is to replace the questions that will be asked to the user on the screen by new ones in column 1. For this purpose the sentence LOCATE X, Y, where X will indicate the line and Y column.
In our case Y will be the same throughout the cycle, but X has to add each time the sentence is executed. On the other hand, this sentence is included in two FOR judgments, so it is not possible to express the line by indexes I and J. Therefore, since the INPUT sentence automatically takes the cursor to the next line, it is enough to use the CSRLIN function.
If necessary, you will have another possible solution, that is, putting blank spaces when entering the text in the INPUT sentence. However, please note that the CSRLIN function can also be used.
2.- In most dialogue programs it is necessary to introduce pauses so that the user can read the screens that are shown to him.
In many cases, these steps are usually fixed, that is, defined by the programmer and are equal every time the program is carried out.
If we take into account that each person has a different rhythm, the ideal is to express his desire to go ahead by pressing a key and is what is done in this program in lines 250-290. On the other hand, and since the INKEY function takes into account all the keys pressed, it is convenient to forget the keys that have been pressed before the message appears to press a key on the screen. If not, it would happen without time to read the screen. This is what is done in lines 270-280.
10 MENDEL REM 20 KEY OFF ANALYSIS : CLS 30 LOCATE 5,31 : PRINT "MENDEL ANALYSIS" 40 LOCATE 9,7 : PRINT "The aim of this program is to perform a simple analysis of Mendel." 50 LOCATE 12,7 : PRINT "It will analyze the genotype of first-generation children. Bes- 60 LOCATE 14.7 : PRINT "one gene will only be taken into account for each group, chromosome." 70 LOCATE 17,7 : PRINT "The characteristics will be expressed with the letters G (RED) and Z (WHITE)." 1$ THEY=160$ MONTH EXTRA 320 LOCATE 5,23 : PRINT "----------------------------" 330 LOCATE 7,30 : PRINT "FATHER" : LOCATE 7,46 : PRINT "MOTHER" 340 LOCATE 9,30 ; PRINT "Children" 370 LOCATE 14,30 380 FOR I=1 TO 2 390 FOR J=1 TO 2 400 LOCATE CSRLIN,30 : INPUT E$(I,J) 410 NEXT J 420 NEXT I 430 REM EN F440 ! Correct answer." 520 GOTO 590 530 LOCATE 19,10 : PRINT "BAD! ! ! The correct answer is as follows: "; 540 FOR I=1 TO 2 550 FOR J=1 TO 2 560 PRINT, S.A$(I,J);" 570 NEXT J 580 NEXT I 590 LOCATE 21,31 : PRINT "Program finished." 600 END 610 MENDEL AMAIA ANALYSIS REM