RosettaCodeData/Task/Pig-the-dice-game/MSX-Basic/pig-the-dice-game.basic
2023-12-16 21:33:55 -08:00

36 lines
1.2 KiB
Text

100 NJ = 2
110 MP = 100
120 DIM APT(3)
130 APT(1) = 1
140 APT(2) = 1
150 CLS
160 PRINT "The game of PIG"
170 PRINT "===============";CHR$(13);CHR$(10)
180 PRINT "Si jugador saca un 1, no anota nada y se convierte en el turno del oponente."
190 PRINT "Si jugador saca 2-6, se agrega al total del turno y su turno continua."
200 PRINT "Si jugador elige 'mantener', su total de puntos se anade a su puntuacion,";
210 PRINT " y se convierte en el turno del siguiente jugador.";CHR$(10)
220 PRINT "El primer jugador en anotar 100 o mas puntos gana.";CHR$(13);CHR$(10)
230 'while
240 FOR J = 1 TO 2 'nj
250 PT = 0
260 IF APT(J) > MP THEN GOTO 370
270 PRINT
280 PRINT "j";J;": (";APT(J);",";PT;")";
290 INPUT " Tirada? (Sn) ";NT$
300 IF NT$ = "S" OR NT$ = "s" THEN GOTO 400
310 REM opcion N
320 APT(J) = APT(J)+PT
330 PRINT " Te quedas con: ";APT(J)
340 IF APT(J) >= MP THEN PRINT CHR$(10);"Gana el j";J;"con";APT(J);"puntos." : END
350 GOTO 370 'exit while
360 GOTO 260
370 NEXT J
380 GOTO 230
390 END
400 REM opcion S
410 TIRA = INT(RND(1)*5)+1
420 PRINT " tirada:";TIRA
430 IF TIRA = 1 THEN PRINT CHR$(10);"!Pierdes tu turno! j";J;"pero mantienes tu puntuacion anterior de";APT(J) : GOTO 370 'exit while
440 PT = PT+TIRA
450 GOTO 360