}

Memori Game (I)

1989/01/01 Arrojeria, Eustakio - Elhuyar Zientziaren Komunikazioa | Lizaso, Pili - Informatika SailaElhuyar Fundazioa Iturria: Elhuyar aldizkaria

There are many games to work memory, but this selection can be one of the most popular. The set usually consists of pieces of cardboard or wood. Each piece has an image and each image is in two pieces. What is the game?

At first all the pieces are placed down, that is, with the hidden images and mixed.

In each play you have to raise two pieces and what you have to get is that these two pieces are of the same image. If so, that is, if the raised pieces have the same image, the player who is playing will pick them up and try again until they fail.

If the selected pieces have a different image, after spending a little time to remember the images and positions will be turned around and left in the same position.

In the end wins the one that gets the most pieces. This is the game we wanted to simulate with the next program, but with the difference that it is intended for a player, because the images invented by each person are not distinguished.

The steps to follow are as follows:

  • A grid array or table will appear on the screen. You will have to select the boxes two by two, that is, first one and then the other, using for this purpose the scroll keys of the cursor (Rule, ?, Ø). When you try to exit the table, you will hear a sound and the cursor will be in the place where it was.
  • When you reach the selected box, pressing RETURN, you will see the image that hidden the box.
  • Repeat the process with another box.
  • Once two boxes are selected, two things may occur:
    1. If the two boxes have the same image, the images will be visible and one will be added to the found counter.
    2. If the images presented are different, after an instant on the screen they will hide again. Therefore, try to take into account the position of the images for another turn.
  • The game may end for two reasons:
    1. Because all couples have been found (24).
    2. Because 100 sessions have been held, although some have not been found. In this case, pressing the J key will give you the option to view the full table.
For











































example:












Economic
Statistics
(2)
Economic
Statistics
(2)


IF IND sessions 0 THEN

KUR$=LEFT$(IND–1)+MID$(SYMBOL$, IND+1,LEN$)-IND)=51.00 MES
PAINT (IC(1,3)*8–4,IK(1,2)*8–4),1,2: TAU$((IK(1,2)–2)/3,IK(1,3)/3,2)=”
530 IF TAU$((IK(2,2)–2)/3,IK(2,3)/3,2))” 1” THEN LOCATE(2,2),IK(2,3): PRINT
PAINT (IC(2,3)*8–4,IK(2,2)*8–4),1,2: PRINT “–”;:TAU$((IK(2,2)–2)/3,IK(2,3)/3,2)=”
540 IF I=2 THEN LOCATE 5,27:PRINT “Found =”;STR$(24–LEN(SIGN$))):8,27 LOCATE:
PRINT “Sessions =”; SESSIONS; ELSE 560
550 LOCATE
IK(2,2),IK(2,3)+1 560 WEND
570 WEND
580 REM RESULTS
590 LOCATE 23,2:PRINT SPC(38):LOCATE 25,2:PRINT$
PRINT! GOTO 700
610 LOCATE 23,1:PRINT “You didn’t get it. To see all of them click J
620 TE$=” “:WHILE TE$ ”J” AND TE$ ”j”:TE$=INKEY$:WEND
630 FOR=1 TO 8
640 FOR J=1 TO
650





L=(J–25,1)

Observations:

  1. When selecting the boxes, keep in mind that the boxes must be different, that is, when pressing twice in the same RETURN box will not be valid.
  2. If you want to pause longer before hiding the images, simply change the number 2500 to a larger one in FOR 510.
  3. To modify the images or symbols that appear, you can change the numbers that appear on line 630 (ASCII codes). Remember that ASCII codes must be between 1 and 256.
  4. Program that includes 100 sessions. If you want more or less sessions, modify line 220.

Parts of the program:

  • Complete table (50-130)
  • Display representation (140-190)
  • Control of key movements (260-420)
  • Show image in selected box and save information (440-460)
  • Compare the images of the two selected boxes and perform the corresponding actions in each case (470-550)
  • Deliver results at the end of the game (580-690)

Gai honi buruzko eduki gehiago

Elhuyarrek garatutako teknologia