Memory PvP

In-game screen.

Program listing on 48K Spectrum.

Text Listing

1 POKE 23693,48:
 CLS :
 RANDOMIZE :
 DIM c(52):
 DIM s(2):
 FOR b=0 TO 51:
 LET p=INT (b/10):
 PRINT AT p*3+2,1+3*b-30*p;b+1:
 LET f=.5+RND*(b+1):
 LET c(b+1)=c(f):
 LET c(f)=65+INT (b/2):
 NEXT b:
 LET p=1+(p=1):
 BORDER p*(b>0):
 INK p:
 PRINT AT 18+p,1;"P";p;":";s(p):
 LET f=f=0:
 IF b THEN INPUT STR$ b+CHR$ 6 AND f;a:
 POKE (a<1 OR a>52 OR a=b*f)*23620,18:
 POKE (c(a)=0)*23620,18:
 RESTORE :
 READ q,r,w,v,y,x,m,s,c(a),c(b),s(p),b:
 PRINT INVERSE m;AT 1+w*3,v;CHR$ q;AT 1+y*3,x;CHR$ r AND m:
 BEEP f/2,24*m-12:
 FOR d=1 TO 150*f:
 NEXT d:
 PRINT OVER f=m;AT 1+w*3,v;" ";AT 1+y*3,x;" ":
 POKE 23620,14-f*s:
 DATA c(a),c(b),INT (a/10-.1),3*a-30*w-2,INT (b/10-.1),3*b-30*y-2,q=r*f,m=0,s*q,s*r,s(p)+m,a*(s(1)+s(2)<26)

Instructions

In this game there are 52 letters from two shuffled alphabets hidden in a numbered grid. Two human players battle it out to try and find the greatest number of matching pairs before the game ends. Player 1 (BLUE) and Player 2 (RED) successively take turns to input a pair of numbers, revealing a hidden pair of letters. If the selected letters match, then the player's score is increased by one, the letters also remain visible on the screen in the player's own colour (INVERSE video) and the player retains control of the game, thus allowing them to select a subsequent pair of letters. Otherwise, the selected letters do not match and so they are hidden again after a couple of seconds, then control of the game passes to the opposing player. At all times during play, the BORDER colour indicates the current player (i.e. BLUE or RED).

The game ends when all 26 matching pairs have been revealed, and the player with the highest score is declared the winner. The game is declared a draw if both players have the same score (i.e. 13 points each).

Credits

This game was developed from the single player game Memory. Modifications were made by Einar Saukas and Digital Prawn to convert that game to a two player version. This did require further optimisations from Einar to fit into the oneliner contest size limits, but overall the majority of the code remains quite similar to the single player version.

Back to documentation index