4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

「1」「4」「5」を適当に並べて「114514」が完成したら喋るバッチファイル

Last updated at Posted at 2016-01-03

 (淫夢要素は)ないです。

 ●1,4,5をランダムに表示して、114514と順に並んだら機械音声が「いいよ!来いよ!」と言います。
 ●114,514の回数も個別に数えています。
 ●ランダムと言いつつ、同じ数字が3つ並ばないようになっています。
  そうしないと10000字とか行っても終わらないので…。

114514.bat
@echo off
setlocal enabledelayedexpansion
mode con cols=52 lines=46

:Top
cls
color 0F
set /a loop=0,loop2=0,result1=0,result2=0,result3=0,judge=999,judge2=0

:Main
set /a loop+=1,loop2-=1,judge3="!loop!"%%50
call :RndGenerate num[%loop%]
if %judge3% == 0 echo.
set /p <nul=!num[%loop%]!
set judge=!judge:~1!!num[%loop%]!
if %judge% == 114 set /a loop2=3,result1+=1
if %judge% == 514 if %loop2% == 0 goto Finish
if %judge% == 514 if %loop2% neq 0 set /a result2+=1
set judge2=0
if %judge:~1% == 11 set judge2=1
if %judge:~1% == 44 set judge2=4
if %judge:~1% == 55 set judge2=5
goto Main

:Finish
color 65
call :Voice 良いよ!来いよ!
echo.
echo.
echo 総文字数:%loop%
echo    114数:%result1%
echo    514数:%result2%
pause >nul
goto Top

:RndGenerate
set /a num=%random%*3/32768
if %num% == 0 set %1=1
if %num% == 1 set %1=4
if %num% == 2 set %1=5
if !%1! == %judge2% goto RndGenerate
exit /b

:Voice
echo CreateObject^("SAPI.SpVoice"^).Speak"%1">sp114514.vbs
cscript //nologo sp114514.vbs
del /q sp114514.vbs
exit /b
4
1
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?