Showcasing the stuff I made over time

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Lordoa
Posts: 6
Joined: 26 May 2021 09:07

Showcasing the stuff I made over time

#1 Post by Lordoa » 01 Mar 2022 09:24

Here is some of the batch garbage I made over the years (actually quarantine, other stuff didn't make the cut)

https://drive.google.com/drive/folders/ ... sp=sharing

Don't get me wrong I have created plenty of more garbage. It's just that this garbage has the most interesting technical implementations or visuals.
Most of the interesting stuff was done during quarantine.

Still don't expect to have a blast. If you're bored, you can take a look. No malicious stuff, I promise.
I added code comments to most things you can read through to see what is being showcased.

While I'd hope that there would be games I could have showcased, they are either unfinished or unfun.

p.s. the random text files you might find are font files for "genosgpu"
Excuse my naming sense, I thought it was cool. It kinda is, still.

Lordoa
Posts: 6
Joined: 26 May 2021 09:07

Re: Showcasing the stuff I made over time

#2 Post by Lordoa » 14 Mar 2022 09:26

Here is command line one-liner to play snake. Just Ctrl+c and ctrl+v into an open terminal to play.
WASD to move

ver 2:
-Using a font with an aspect ratio close to 1 is recommended.
-While I did know that time could be used to calculate the length of a game tick, it obliviously didn't occur to me (no break; command), until I took a look at dbenham's snake.bat.
-Using a similar method apple can no longer spawn on snake.
-Added parameters: [XLEN=map X-size; YLEN=map Y-size; TICK=game speed (lower is faster); OWDELAY=Adds delay to script writing input to mitigate write+read at the same time error (lower is faster)]
Note that the error doesn't affect gameplay at all except by writing a bunch of text onto the screen. I could move the cursor to somewhere where it wouldn't be intrusive, but that is not possible since I resize the screen (and it's small).
-Note on above note that secret ver 2.1 possibly fixed this issue, added 2 lines to bottom for text space and moved cursor to right below box at the portion of the code where it reads the file.
-Added an online high score using curl. High-score can be toggled ON/OFF with the parameter [HS=(0=OFF; 1=ON)]
Replace {USERNAME} with your username or it will generate a really ugly user Id for you. Try to beat me! Oh and don't cheat pls.
Note that score is separate from length.

- Note that to save your score you need to press retry once you die, as to re-run the game loop. Yes it's disorganized and it's a huge mess, but to be fair just look at it.
- Note that having highscore feature ON can cause an issue where typing during the curl command causes input to go to console.
- If at any point you start typing on console, just spam enter and movement keys and pray.

ver 1:
-Game tick was capped 1 second.
-Apple could very very rarely (not that it occurred, but theoretically) spawn on snake.
-Typing during specific instances of the timeout command could cause input to go to console.

Code: Select all

@echo off & color f & cmd /q /v:on /c (set "NAME={USERNAME}" ^& set/a XLEN=12, YLEN=10, TICK=20, OWDELAY=3, HS=1 ^>nul ^& (if "!HS!" == "1" (if "!NAME!" == "{USERNAME}" set NAME=USER!random:~1,4!)^& set scorelist=,^&set $c=0^& for /f "tokens=* delims=," %a in ^('curl -s https://notes.orga.cat/et2qn'^) do set/a $c+=1 ^& if not "!$c!"=="1" set scorelist=!scorelist! %a) ^& set/a $xd=XLEN+6+HS*13, $xd2=XLEN-1, $xd3=XLEN+3,$yd=YLEN+10, $yd2=YLEN+2, $yd3=YLEN+6, $yd4=YLEN+2, len=2 ^>nul) ^& (set spaces= ^& for /l %a in ^(1,1,!$xd2!^) do set "spaces=!spaces! ") ^& mode con: cols=!$xd! lines=!$yd! ^& for /f "skip=4" %a in ^('echo prompt $E ^^^| cmd'^) do (echo %a[?25l) ^& ((set /a posX=XLEN/2+3, posY=YLEN/2+3, apps=0, redraw=1 ^> nul) ^& (set body=,) ^& set dir=W^) ^& ^(start "" /b cmd /q /c cls ^^^& for /l %v in ^^^(^^^) do ^^^(for /l %z in ^^^(1,1,!OVDELAY!^^^) do rem: ^^^)^^^& for /f %w in ^^^('choice /c wasd /n'^^^) do echo %w^^^>"%temp%\movinput.flag") ^& ^(timeout /t 1 /NOBREAK ^>nul^) ^& for /l %b in ^(^) do (if "!apps!"=="0" set/a aposX=!random!*!XLEN!/32768+4, aposY=!random!*!YLEN!/32768+3, apps=1 ^>nul ^& (if "!posX!-!posY!" == "!aposX!-!aposY!" set apps=0^& set/a aposX=!random!*!XLEN!/32768+4, aposY=!random!*!YLEN!/32768+3 ^>nul) ^& (for %c in ^(!body!^) do if "%c" == "!aposX!-!aposY!" set apps=0^& set/a aposX=!random!*!XLEN!/32768+4, aposY=!random!*!YLEN!/32768+3, apps=0 ^>nul) ^& if "!apps!" == "1" for /f "tokens=1-2 delims= " %c in ^("!aposX! !aposY!"^) do echo %a[%d;%cH%a[101m %a[40m) ^& if "!apps!" == "1" (for /f "tokens=1-4 delims=:.," %a in ("!time: =0!") do set /a "t2=(((1%a*60)+1%b)*60+1%c)*100+1%d-36610100, tDiff=t2-t1" ^>nul) ^& if !tDiff! geq !TICK! (set /a t1=t2 ^>nul) ^& (if "!redraw!" == "1" set /a score=^^^(200-TICK^^^)*^^^(len-2^^^)/XLEN/YLEN, redraw=0, apps=0, len=2 ^>nul ^& (if "!HS!" == "1" ((set HS=2^&for %h in ^(!scorelist!^) do (if "!HS!"=="2" set scorelist=,^& set $c=0^& set HS=1)^& set /a $c+=1 ^& for /f "tokens=1* delims=[" %j in ^("%h"^) do if "!HS!" == "1" (if !score! GTR %j (set HS=0^& if not "!$c!"=="5" (set scorelist=!scorelist! !score![!NAME! %j[%k) else set scorelist=!scorelist! !score![!NAME!) else set scorelist=!scorelist! %j[%k) else if not "!$c!"=="5" set scorelist=!scorelist! %j[%k) ^& if not "!HS!" == "1" (set postlist=,^&for %h in ^(!scorelist!^) do set postlist=!postlist!%0A%h) ^& (curl -X POST -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -d "text=999999999[Hidescörä%0A!postlist!" https://notes.orga.cat/et2qn) ^& set HS=1)) ^& cls ^& echo(^& (for /l %k in ^(1,1,!$yd2!^) do if "%k" == "1" (echo   %a[107m !spaces! %a[40m) else if "%k" == "!$yd2!" (echo   %a[107m !spaces! %a[40m) else echo   %a[107m %a[40m!spaces!%a[107m %a[40m)^& if "!HS!"=="1" for %z in ^(!$xd!^) do echo %a[3;%zH%a[12DHigh Scores^& set $c=3^& for %g in ^(!scorelist!^) do set /a $c+=2 ^>nul^& for /f "tokens=1* delims=[" %h in ^("%g"^) do for %k in ^(!$c!^) do set $d=%h   ^& set $e=%i^& echo %a[%k;%zH%a[13D%a[93m!$d:~0,3!%a[97m !$e:~0,9!) ^& (if exist "%temp%\movinput.flag" (for %d in ^(!$yd3!^) do (^<nul set /p=%a[%d;1H%a[A)) ^& for /f "usebackq tokens=*" %d in ^("%temp%\movinput.flag"^) do if not "!dir!%d" == "WS" if not "!dir!%d" == "SW" if not "!dir!%d" == "AD" if not "!dir!%d" == "DA" set dir=%d) ^& (set body=!body! !posX!-!posY!) ^& (for /f "tokens=1-2 delims= " %c in ^("!posX! !posY!"^) do echo %a[%d;%cH%a[102m %a[40m) ^& (if "!dir!" == "W" (set /a posY-=1 ^>nul) else if "!dir!" == "S" (set /a posY+=1 ^>nul) else if "!dir!" == "A" (set /a posX-=1 ^>nul) else set /a posX+=1 ^>nul) ^& (for /f "tokens=1-2 delims= " %c in ^("!posX! !posY!"^) do echo %a[%d;%cH%a[46m %a[40m) ^& (if !posX! LSS 4 (echo You died! Retry?^& pause^>nul ^& set/a posX=!XLEN!/2+3, posY=!YLEN!/2+3, redraw=1, apps=0 ^>nul ^& set body=,) else if !posX! GTR !$xd3! (echo You died! Retry?^& pause^>nul ^& set/a posX=!XLEN!/2+3, posY=!YLEN!/2+3, redraw=1, apps=0 ^>nul ^& set body=,) else if !posY! LSS 3 (echo You died! Retry?^& pause^>nul ^& set/a posX=!XLEN!/2+3, posY=!YLEN!/2+3, redraw=1, apps=0 ^>nul ^& set body=,) else if !posY! GTR !$yd4! echo You died! Retry?^& pause^>nul ^& set/a posX=!XLEN!/2+3, posY=!YLEN!/2+3, redraw=1, apps=0 ^>nul ^& set body=,) ^& (if "!posX!" == "!aposX!" if "!posY!" == "!aposY!" (set/a apps=0, len+=1 ^>nul)) ^& ((set /a count=0 ^>nul) ^& for %e in ^(!body!^) do (set /a count+=1 ^>nul) ^& for /f "tokens=1-2 delims=-" %c in ^("%e"^) do (if "!apps!" == "1" if "!count!" == "1" ((if not "!posX!-!posY!" == "%e" echo %a[%d;%cH%a[40m ) ^& set body=,) else set body=!body! %e) ^& if not "!count!" == "1" if "!posX!" == "%c" if "!posY!" == "%d" echo You died! Retry?^& pause^>nul ^& set/a posX=!XLEN!/2+3, posY=!YLEN!/2+3, redraw=1, apps=0 ^>nul ^& set body=,) ^& (for %z in ^(!$yd3!^) do echo %a[%z;3H%a[BLength: !len!) || ((if exist "%temp%\movinput.flag" del "%temp%\movinput.flag") & echo Interrupt! & exit)
Image

Puccilillo
Posts: 8
Joined: 11 Apr 2022 09:33
Location: Italy
Contact:

Re: Showcasing the stuff I made over time

#3 Post by Puccilillo » 11 Apr 2022 10:25

I just played your snake and it is really cool.
Well done

Post Reply