© serviceprofessionalgmbh

What makes this variation interesting is the easy processing logic and the performance. If we assume that the game is to be run any number of time, the tables of objects and results only need to be built once.

In the processing part itself is nothing left to do but to retrieve the result from the table using the right coordinates (row R, column S). No logic, no questions, no boolean expressions.

Surely you will agree that nothing can be answered more quickly than no question at all.

//* REXX
*/
OBJ.1  ="STEIN  "
OBJ.2  ="SCHERE "
OBJ.3  ="PAPIER "
OBJ.4  ="BRUNNEN"
OBJ.5  =""
OBJ.6  =""
OBJ.7  ="TRIFF DEINE AUSWAHL (E = ENDE)"
ERG.   ="ICH HABE GEWONNEN"
ERG.1.1="UNENTSCHIEDEN"
ERG.2.2="UNENTSCHIEDEN"
ERG.3.3="UNENTSCHIEDEN"
ERG.4.4="UNENTSCHIEDEN"
ERG.1.3="DU HAST GEWONNEN"
ERG.1.4="DU HAST GEWONNEN"
ERG.2.1="DU HAST GEWONNEN"
ERG.2.4="DU HAST GEWONNEN"
ERG.3.2="DU HAST GEWONNEN"
ERG.4.3="DU HAST GEWONNEN"
DO TMP = 1
   SAY CENTER("< DIE KLEINE KNOBELEI >",79,'-')
   DO CNT = 1 TO 7
      IF CNT <= 4 THEN DMY = CNT "="
      ELSE DMY = ""
      SAY CENTER(DMY OBJ.CNT,79)
   END
   DO UNTIL S >= 1 & S <= 4
      PARSE UPPER EXTERNAL S
      IF S = "E" THEN LEAVE TMP
   END
   R=RANDOM(1,4)
   SAY;SAY
   SAY "DU HAST" OBJ.S", ICH HABE" OBJ.R"," ERG.R.S
END
SAY "BYE, BYE..."
EXIT
back to Fun & More