Data update

This commit is contained in:
Ingy döt Net 2024-07-13 15:19:22 -07:00
parent 29a5eea0d4
commit 5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions

View file

@ -1,6 +1,6 @@
V tokens = 12
F getTokens(curTokens) -> N
F getTokens(curTokens) -> Void
print(How many tokens would you like to take? , end' )
V take = Int(input())

View file

@ -0,0 +1,25 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. NIM-GAME.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 MONTON PIC 99 VALUE 12.
01 LLEVAR PIC 9 VALUE 0.
01 TEMP PIC 9.
PROCEDURE DIVISION.
PERFORM UNTIL MONTON = 0
DISPLAY "There are " MONTON " tokens remaining. How many"
"would you like to take? "
ACCEPT LLEVAR
PERFORM UNTIL LLEVAR > 0 AND LLEVAR < 4
DISPLAY "You must take 1, 2, or 3 tokens. How many"
"would you like to take "
ACCEPT LLEVAR
END-PERFORM
COMPUTE TEMP = 4 - LLEVAR
DISPLAY "On my turn I will take " TEMP " token(s)."
SUBTRACT 4 FROM MONTON
END-PERFORM
DISPLAY " "
DISPLAY "I got the last token. I win! Better luck next time."
STOP RUN.

View file

@ -0,0 +1,24 @@
PROGRAM "nim-game"
VERSION "0.0000"
DECLARE FUNCTION Entry ()
FUNCTION Entry ()
monton = 12
DO WHILE monton > 0
PRINT "There are "; monton; " tokens remaining. How many would you like to take? ";
llevar = UBYTE(INLINE$(""))
DO WHILE (llevar <= 0) OR (llevar > 3)
llevar = UBYTE(INLINE$("You must take 1, 2, or 3 tokens. How many would you like to take"))
LOOP
PRINT "On my turn I will take"; 4 - llevar; " token(s)."
monton = monton - 4
LOOP
PRINT "\nI got the last token. I win! Better luck next time."
END FUNCTION
END PROGRAM