Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off & setlocal enableDelayedExpansion
- rem Speedy 1 var canvas
- set /a "wid=50", "hei=50", "iMax=wid*hei"
- for /l %%i in (1 1 !iMax!) do set "canvas= !canvas!"
- set "bss=!Canvas: =!"
- mode %wid%,%hei%
- rem math macros
- set /a "PI=(35500000/113+5)/10, PI_div_2=(35500000/113/2+5)/10, PIx2=2*PI, PI32=PI+PI_div_2"
- set "_SIN=a-a*a/1920*a/312500+a*a/1920*a/15625*a/15625*a/2560000-a*a/1875*a/15360*a/15625*a/15625*a/16000*a/44800000"
- set "SIN(x)=(a=(x * 31416 / 180)%%62832, c=(a>>31|1)*a, a-=(((c-47125)>>31)+1)*((a>>31|1)*62832) + (-((c-47125)>>31))*( (((c-15709)>>31)+1)*(-(a>>31|1)*31416+2*a) ), %_SIN%) / 10000"
- set "COS(x)=(a=(15708 - x * 31416 / 180)%%62832, c=(a>>31|1)*a, a-=(((c-47125)>>31)+1)*((a>>31|1)*62832) + (-((c-47125)>>31))*( (((c-15709)>>31)+1)*(-(a>>31|1)*31416+2*a) ), %_SIN%) / 10000"
- rem PLOT macro
- set ^"LF=^
- ^" Above empty line is required - do not remove
- set ^"\n=^^^%LF%%LF%^%LF%%LF%^^"
- set plot=for %%# in (1 2) do if %%#==2 ( for /f "tokens=1-3" %%1 in ("^!args^!") do (%\n%
- for /f "tokens=1" %%a in ("^!wid^!") do ( set /a "pos=%%1", "pos+=%%2 * %%a" )%\n%
- for /f "tokens=1-2" %%a in ("^!pos^! ^!iMax^!") do ( set /a "lL=%%a-1", "lR=%%b-%%a" )%\n%
- for /f "tokens=1-4" %%a in ("^!lL^! ^!pos^! ^!lR^! canvas") do ( set "canvas=^!%%d:~0,%%a^!%%~3^!%%d:~%%b,%%c^!" )%\n%
- )) else set args=
- rem perpetual veritical sine wave
- set /a "amp=5"
- for /l %%@ in (1,1,1000) do ( set /a "angle+=1"
- set /a "x=amp * !sin(x):x=angle! + wid / 2", "i=angle %% (amp * 4)"
- if !i! equ 0 set /a "y+=1"
- %plot% x y *
- cls & <nul set /p "=!Canvas:~0,-1!!bss!"
- )
- pause & exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement