Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,62 @@
/* NetRexx */
options replace format comments java crossref symbols nobinary
parse arg lo hi .
if lo = '' | lo = '.' then lo = 1
if hi = '' | hi = '.' then hi = 100
if lo > hi then parse (hi lo) lo hi -- make sure lo is < hi
rg = Random()
tries = 0
guessThis = rg.nextInt(hi - lo) + lo
say
say 'Rules: Guess a number between' lo 'and' hi
say ' Use QUIT or . to stop the game'
say ' Use TELL to get the game to tell you the answer.'
say
say 'Starting...'
say
loop label g_ forever
say 'Try guessing a number between' lo 'and' hi
parse ask guess .
select
when guess.upper = 'QUIT' | guess = '.' then do
say 'You asked to leave the game. Goodbye...'
leave g_
end
when guess.upper = 'TELL' | guess = '.' then do
say 'The number you were looking for is' guessThis
end
when \guess.datatype('w') then do
say guess 'is not a whole number. Try again.'
end
when guess = guessThis then do
tries = tries + 1
say 'Well guessed!' guess 'is the correct number.'
say 'It took you' tries 'tries.'
leave g_
end
when guess < lo then do
tries = tries + 1
say guess 'is below the lower limit of' lo
end
when guess > hi then do
tries = tries + 1
say guess 'is above the upper limit of' hi
end
when guess < guessThis then do
tries = tries + 1
say guess 'is too low. Try again.'
end
when guess > guessThis then do
tries = tries + 1
say guess 'is too high. Try again.'
end
otherwise do
say guess 'is an unexpected value.'
end
end
end g_
return