当前位置:首页 >> 脚本专栏

批处理BAT实现正弦曲线和抛物线代码

先奉上正弦曲线的:

@echo off&setlocal enabledelayedexpansion
(
:loop
for %%i in (30 46 55 59 60 59 55 46 30 14 5 1 0 1 5 14) do (
  for /l %%j in (1 1 %%i) do (
   set "str=!str! "
  )
  echo     !str!#&set str=
  for /l %%i in (1 1 600) do qdj 2>nul
)
goto loop
)

根据悬崖之树的代码改造而成,可以说是真正的抛物线了。

函数解析式:f(x)=-x2-1

@echo off
mode con lines=40 cols=80
setlocal enabledelayedexpansion
set ctr=0
set "spc= "
for %%a in (65 33 17 9 5 3 2 3 5 9 17 33 65) do (
set /a ctr=ctr+4
set ln=%%a
for /l %%b in (1,1,!ln!) do (
 echo=
)
for /l %%b in (0,1,!ctr!) do (
 set "spc=!spc! "
)
echo !spc!O
ping 127.1 -n 1 >nul
ping 127.1 -n 1 >nul
ping 127.1 -n 1 >nul
set "spc= "
if !ctr! gtr 56 goto:f
cls
)
:f
pause>nul
exit