まず、なぜあなたは使わないのsleep
ですか?それはうまくいきます(詳細については入力sleep /?
してください)しかし、これはfor /l
ループでこれを行う別の方法です
@echo off
setlocal enabledelayedexpansion
set score=0
title Memory Test : Current Score = !score!
for /l %%a in (0,1,20) do (
Rem In the above sequence, increase 20 to the amount of times you want the test to be performed
set number[%%a] = !random!!random!
echo Number: !number[%%a]!
set /a wait=21-%%a
set /a wait=!wait!*1000/4
sleep -m !wait!
cls
set /p "input=What was the last number youy saw? "
if !number[%%a]! equ "!input!" (
set /a score=!score!+1
Echo Correct !
title Memory Test : Current Score = !score!
)else(
Echo Incorrect! Coreect Answer = !number[%%a]!
)
)
echo Calculating score...
pause
cls
echo.
if %score% leq 14 set msg="Nice Try! But you can do better!"
if %score% geq 15 set msg="Good Job! Your on your way to the top!"
if %score% equ 20 set msg="Your So Close! Almost a perfect socre!"
if %score% equ 21 set msg="You got a perfect score! Woderful!"
Echo %score%/21 : %msg%
echo.
pause
そして、それはうまくいくはずです。テストの所要時間は変更できますが、最初のゲームでは質問を学習するのに 5 秒を少し超える時間があり、最後のラウンドでは 1/4 秒かかります!
モナ