T3RRYT3RR0R

Codegolf Noisey Screamface

Nov 19th, 2021 (edited)
917
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.99 KB | None | 0 0
  1. :# Noisy screamface reference implementation. Requires Windows 10 ver 10586 or new to run, with Virtual terminal Sequences enabled
  2. :# https://codegolf.stackexchange.com/questions/237468/animate-a-noisey-ascii-screamface
  3.  
  4. @Echo off& CHCP 65001 > nul
  5. Setlocal EnableDelayedExpansion&Cls
  6. For /f %%e in ('echo prompt $E^|cmd')Do set \e=%%e
  7.  
  8.  <nul Set /p=%\E%[?25l
  9.  
  10.  Set /A "et=8,ew=10,mt=18,mh=20"
  11.  
  12. :# Do not modify below assignments
  13.  Set /A "ew=ew,eg=(ew/2)+1,eh=et/2,lel=et+1,rel=ew+lel+eg,pw=ew/2-1,eb=et+eh,ler=lel+ew-1,rer=rel+ew-1,lpx=lel+ew/3,rpx=rel+ew/3"
  14.  Set /A "mb=mt+mh-1,mib=mt+2,mih=mb-mh-1,ml=lel-1,mr=rer,mw=rer-lel+1,miw=mw-4,ph=et+(eh/2)"
  15.  Set/A sw=lel+rer-1,sh=et/2+mh+mt,its=0
  16.  
  17. Mode !sw!,!sh!
  18.  
  19. For /l %%. in ()Do (
  20.  Set "s="
  21.  For %%n in ("!ew!+!lel!" "!ew!+!rel!")Do (Set/AY=!random!%%5+et,X=!random!%%%%~n,g=!random!%%80+40,b=!random!%%80+80&Set s=!s!%\E%[!Y!;!X!H%\E%[48;2;0;0;!b!m%\E%[38;2;0;!g!;!b!m#)
  22.  For %%n in ("!pw!+!lpx!" "!pw!+!rpx!")Do (Set/AY=!random!%%2+ph,X=!random!%%%%~n,g=!random!%%45+15&Set s=!s!%\E%[!Y!;!X!H%\E%[48;2;0;!g!;0m%\E%[38;2;;!g!;!g!m@)
  23.  Set/AY=!random!%%mh+mt,X=!random!%%mw+ml+1,r=!random!%%80+60,rr=!random!%%185+50,g=!random!%%40+1&Set "s=!s!%\E%[!Y!;!X!H%\E%[48;2;!r!;0;0m%\E%[38;2;!rr!;!g!;0mM"
  24.  Set/AY=!random!%%mih+mib,X=!random!%%miw+lel+2,r=!random!%%60+20&Set "s=!s!%\E%[!Y!;!X!H%\E%[48;2;!r!;0;0m%\E%[38;2;!r!;0;!r!mW"
  25.  Set/AY=!random!%%mih+mib,X=!random!%%miw+lel+2,r=!random!%%60+20&Set "s=!s!%\E%[!Y!;!X!H%\E%[48;2;!r!;0;0m%\E%[38;2;!r!;0;!r!mW"
  26.  Set /a xt=yt=0,its+=1
  27.  For /L %%i in (0 1 14)Do If not "!xt!!yt!"=="11" (
  28.   Set /a xt=yt=0
  29.   Set /A Y=!random!%%sh+1,X=!random!%%sw+1,r=g=b=!random!%%25+15
  30.   If !Y! LEQ !et! Set /A yt=xt=1
  31.   If !X! LEQ !lel! Set /A yt=xt=1
  32.   If !X! GEQ !rer! Set /A yt=xt=1
  33.   If !Y! GEQ !mb! Set /A yt=xt=1
  34.   If !Y! GEQ !eb! If !Y! LEQ !mt! Set /A yt=xt=1
  35.   If !Y! GEQ !et! If !Y! LEQ !eb! (
  36.    If !X! GEQ !ler! If !X! LEQ !rel! Set /A yt=xt=1
  37.   )
  38.  )
  39.  <nul Set/p "=!s!%\E%[!Y!;!X!H%\E%[48;2;!r!;!g!;!b!m "
  40. )
Add Comment
Please, Sign In to add comment