Morra

Type
Game
Category
Finger-guessing game vs. the computer
Author
L. Zvolensky
Published in
Flop (Czech disk magazine for 8-bit Atari), issue 8
Language
Atari BASIC
Requirements
Any 8-bit Atari with Atari BASIC; keyboard
Green title screen with large 'HRA MORRA BY L. ZVOLENSKY' text above the Slovak rules

About the program

Morra is a hand game that goes back to antiquity. Both players show one or more fingers at the same moment and call out a guess of what the other player is showing. This version, by L. Zvolenský of Bratislava (the name is in the REM box in lines 1–7), is cut down to one or two fingers and played against the computer. It appeared on the Czech disk magazine Flop 8, though the program's text is in Slovak.

The rules (translated from the title screen)

Morra is for two players and is played like this. The players each show one or two fingers at the same time, and at the same time guess how many fingers the opponent showed. If both guess what the other showed, the round is a draw. If both are wrong, the round is also a draw. If one player wins, he scores as many points as the sum of the fingers shown.

Note: in the code, the winner actually scores the sum of both players' fingers and both guesses (lines 200–210), not just the fingers shown. Play by whichever rule you prefer.

Prompts in English

Slovak English
Stlac START pre zacatie hry Press START to begin
Stav je V:M The score is you:me
Kolko ukazete prstov? How many fingers are you showing? (1/2)
Kolko hadate prstov? How many fingers do you guess? (1/2)
Ja ukazujem / Ja hadam I show / I guess
Vysledok tohoto kola je nerozhodny This round is a draw
Vyhral ste … body(ov) / Vyhral som … You won … points / I won …
Hrali sme (kol) Rounds played
Stlac niektoru klavesu … alebo ESC pre ukoncenie Press any key for the next round, or ESC to quit

Typing it in

  • The REM box in lines 1–7 is drawn with CTRL-Q/R/E/A/D/Z/C line characters. It's decorative.
  • {inverse}…{/inverse} marks inverse-video words: the author's name and "MORRA" in the title, "START", "ESC". {CLEAR} in line 100 is ESC then SHIFT-CLEAR.
  • The title text hra morra BY l.zvolensky is deliberately in lower case. Lines 20–30 change rows 1 and 2 of the display list to ANTIC modes 7 and 6, the big GRAPHICS 2 and 1 style text. In those modes lower-case codes appear as capitals in a different colour.

How it works

  • Line 20 finds the display list (PEEK(560)+256*PEEK(561)) and pokes two instructions to enlarge the title rows, then sets the left margin to 2.
  • INPUT #16,K is a well-known Atari BASIC shortcut that reads from the keyboard without printing the ? prompt.
  • Line 130 picks one of four equally likely computer moves, (show, guess) = (1,2), (2,1), (1,1) or (2,2), with ON X GOTO.
  • Key code 28 (ESC) read from location 764 ends the game.

Listing

1 REM {CTRL-Q}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-E}
2 REM | |
3 REM | HRA MORRA |
4 REM {CTRL-A}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-D}
5 REM | |
6 REM | L. Zvolensky, Bratislava |
7 REM {CTRL-Z}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-C}
20 GRAPHICS 0:SETCOLOR 2,12,2:SETCOLOR 4,12,2:DL=PEEK(560)+256*PEEK(561):POKE DL+6,7:POKE DL+7,6:POKE 82,2
30 POSITION 5,1:PRINT "hra morra BY {inverse}l{/inverse}.{inverse}zvolensky{/inverse}"
40 PRINT:PRINT "Hra {inverse}MORRA{/inverse} je pre dvoch hracov, a hra sa takto:":PRINT "Hraci ukazu naraz jeden, alebo dva"
50 PRINT "prsty na ruke, a zaroven hadaju, kolko prstov ukazal super. Ak obaja uhadnu, ake cislo hadal super,";
60 PRINT "tak potom kolo":PRINT "konci nerozhodne.Ak sa obidvaja mylia, tak potom tiez kolo konci nerozhodne."
70 PRINT "Ak vyhra jeden z hracov, ziska tolko bodov, kolko je sucet ukazanych prstov":PRINT
80 PRINT "Stlac {inverse} START {/inverse} pre zacatie hry........":POKE 752,1:PRINT
90 IF PEEK(53279)<>6 THEN 90
100 PRINT "{CLEAR}"
105 POSITION 5,1:PRINT "hra morra BY {inverse}l{/inverse}.{inverse}zvolensky{/inverse}":POKE 752,0:TRAP 100:PRINT:PRINT "Stav je ";V;":";M
110 PRINT:PRINT:PRINT "Kolko ukazete prstov : ";:INPUT #16,K:IF K<>1 AND K<>2 THEN 100
120 PRINT "Kolko hadate prstov : ";:INPUT #16,H:IF H<>1 AND H<>2 THEN 100
130 PRINT:X=INT(RND(0)*4)+1:ON X GOTO 140,150,160,170
140 Y=1:Z=2:GOTO 180
150 Y=2:Z=1:GOTO 180
160 Y=1:Z=1:GOTO 180
170 Y=2:Z=2
180 PRINT "Ja ukazujem : ";Y;" prst(y).":PRINT "Ja hadam : ";Z;" prst(y).":PRINT
190 IF H=Y AND Z=K OR H<>Y AND K<>Z THEN PRINT "Vysledok tohoto kola je nerozhodny.":GOTO 220
200 IF H=Y THEN V=V+Y+K+Z+H:PRINT "Vyhral ste : ";Y+K+Z+H;" body (ov)."
210 IF Z=K THEN ? "Vyhral som : ";Z+H+Y+K;" body(ov).":M=M+Z+H+Y+K
220 PRINT:PRINT "Hrali sme (kol) : ";PK+1;" | STAV - ";V;":";M
230 PRINT:?:PRINT "Stlac niektoru klavesu pre hranie dal-sieho kola, alebo {inverse}ESC{/inverse} pre ukoncenie."
240 POKE 764,255
250 IF PEEK(764)=255 THEN 250
260 IF PEEK(764)=28 THEN GRAPHICS 0:END
265 POKE 764,255:PK=PK+1
270 GOTO 100

Credits