Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch.nt    |    Fun with Windows NT batch files    |    68,980 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 68,887 of 68,980    |
|    Tom Del Rosso to All    |
|    Master Mind (2/2)    |
|    24 Feb 25 12:10:52    |
      [continued from previous message]              +++call set "XXXX_char=%%XXXX_test:~%p%,1%%"       +++if not "%XXXX_char%"=="_" goto :get_guess       +++       +++rem falls through if all X's       +++cls       +++call :show_guess_history       +++echo %secret% SOLVED!       +++set /a completed_games += 1       +++set /a completed_guesses += guesscount       +++call :average_score       +++set "playagain=Y"       +++set /p "playagain=Play again? [Y] "       +++if /i "%playagain:~0,1%"=="Y" goto :begin       +++title Command Prompt       +++if "%~F0"=="%0" (exit) else (goto :eof)       +++rem -------------------------------------------       +++rem end of main / start of subs       +++rem -------------------------------------------       +++       +++:randomize       +++ echo Priming random number generator...       +++ set /a n = (1%time:~-2,2% - 95) * 5       +++ :randomize_loop       +++ set dummy=%random%       +++ set /a n -= 1       +++ if %n% gtr 0 goto :randomize_loop       +++goto :eof       +++       +++:get_options       +++ rem -------------------------------------------       +++ rem NUMBERS OR LETTERS       +++ rem -------------------------------------------       +++ cls       +++ if not defined alphanum set "alphanum=%default_alphanum%"       +++ set /p "alphanum=Use numbers 0-9 (N) or letters A-Z (L)?       [%alphanum%] "       +++ if not "%alphanum:"=#%"=="%alphanum:"=$%" (       +++ set "alphanum="       +++ goto :get_options       +++ )       +++ set "alphanum=%alphanum: =%"       +++ set "alphanum=%alphanum:~0,1%"       +++ if /i %alphanum%==N (       +++ set "charset=1234567890"       +++ set /a charsetsize=10       +++ set "character_type=digits"       +++ ) else (       +++ if /i "%alphanum%"=="L" (       +++ set "charset=ABCDEFGHIJKLMNOPQRSTUVWXYZ"       +++ set /a charsetsize=26       +++ set "character_type=letters"       +++ ) else (       +++ set "alphanum="       +++ goto :get_options       +++ )       +++ )       +++ call :toupper alphanum       +++ echo;       +++ rem -------------------------------------------       +++ rem USE CHARACTERS MORE THAN ONCE       +++ rem -------------------------------------------       +++ if not defined repetition set "repetition=%default_repetition%"       +++ set /p "repetition=Use %character_type% more than once (Y/N)?       [%repetition%] "       +++ if not "%repetition:"=#%"=="%repetition:"=$%" (       +++ set "repetition="       +++ goto :get_options       +++ )       +++ set "repetition=%repetition: =%"       +++ set "repetition=%repetition:~0,1%"       +++ if /i not "%repetition%"=="Y" if /i not "%repetition%"=="N" (       +++ set "repetition="       +++ goto :get_options       +++ )       +++ call :toupper repetition       +++ if /i %repetition%==Y (set "promptsuffix=repeats allowed") else       (set "promptsuffix=no repeats")       +++ echo;       +++ rem -------------------------------------------       +++ rem LENGTH OF SECRET       +++ rem -------------------------------------------       +++ if not defined secretlength set /a secretlength =       %default_secretlength%       +++ if /i %repetition%==Y (set /a maxsecret = charsetsize * 4) else       (set /a maxsecret = charsetsize)       +++ if %secretlength% gtr %maxsecret% set /a secretlength =       %default_secretlength%       +++ set /p "secretlength=Length of the secret code (1 to       %maxsecret%)? [%secretlength%] "       +++ if not "%secretlength:"=#%"=="%secretlength:"=$%" (       +++ set "secretlength="       +++ goto :get_options       +++ )       +++ set /a secretlength = secretlength       +++ if %secretlength% lss 1 (       +++ set "secretlength="       +++ goto :get_options       +++ )       +++ if %secretlength% gtr %maxsecret% (       +++ set "secretlength="       +++ goto :get_options       +++ )       +++ echo;       +++ rem -------------------------------------------       +++ rem HOW MANY TO PICK FROM       +++ rem -------------------------------------------       +++ if not defined palletlength set /a palletlength =       %default_palletlength%       +++ if /i %repetition%==Y (set /a minpallet = 1) else (set /a       minpallet = secretlength)       +++ if %palletlength% lss %minpallet% set /a palletlength =       %default_palletlength%       +++ if %palletlength% gtr %charsetsize% set /a palletlength =       %default_palletlength%       +++ set /p "palletlength=How many %character_type% to pick from       (%minpallet% to %charsetsize%)? [%palletlength%] "       +++ if not "%palletlength:"=#%"=="%palletlength:"=$%" (       +++ set "palletlength="       +++ goto :get_options       +++ )       +++ set /a palletlength = palletlength       +++ if %palletlength% lss %minpallet% (       +++ set "palletlength="       +++ goto :get_options       +++ )       +++ if %palletlength% gtr %charsetsize% (       +++ set "palletlength="       +++ goto :get_options       +++ )       +++ call set pallet=%%charset:~0,%palletlength%%%       +++goto :eof       +++       +++:create_secret       +++ set "pallet_remaining=%pallet%"       +++ set /a palletlength_remaining = palletlength       +++ set "secret="       +++ set /a secretlen=0       +++ :build_secret       +++ set /a p = %random% * palletlength_remaining / 32768       +++ call set char=%%pallet_remaining:~%p%,1%%       +++ set "secret=%secret%%char%"       +++ set /a secretlen += 1       +++ if /i %repetition%==N (       +++ call set pallet_remaining=%%pallet_remaining:%char%=%%       +++ set /a palletlength_remaining -= 1       +++ )       +++ if %secretlen% lss %secretlength% goto :build_secret       +++goto :eof       +++       +++:toupper       +++ call set "upper=%%%1%%"       +++ for %%a in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)       do call set upper=%%upper:%%a=%%a%%       +++ set "%1=%upper%"       +++goto :eof       +++       +++:show_guess_history       +++ echo;       +++ for /l %%a in (1,1,%guesscount%) do call :show_line %%a       +++ echo;       +++goto :eof       +++:show_line       +++ set "linenumber= %1"       +++ set "linenumber=%linenumber:~-3,3%"       +++ call echo %linenumber%%%guess_history[%1]%%       +++goto :eof       +++       +++:average_score       +++ echo;       +++ echo Used %completed_guesses% guesses in %completed_games%       completed games.       +++ echo Used %aborted_guesses% guesses in %aborted_games% aborted       games.       +++ echo;       +++ if %completed_games% equ 0 goto :eof       +++ set /a average_guesses = (completed_guesses * 10000) /       completed_games + 5       +++ echo Average %average_guesses:~0,-4%.%average_guesses:~-4,3%       guesses in completed games.       +++ if %aborted_guesses% equ 0 echo; & goto :eof       +++ set /a average_guesses = ((completed_guesses + aborted_guesses)       * 10000) / completed_games + 5       +++ echo Average %average_guesses:~0,-4%.%average_guesses:~-4,3%       guesses counting aborted games.       +++ echo;       +++goto :eof              --- SoupGate-DOS v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca