Stereogram in dos batch

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
einstein1969
Expert
Posts: 941
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Stereogram in dos batch

#1 Post by einstein1969 » 08 Jul 2014 18:57

Hi,

I started a project for animating in 3D a stereogram.

This is my first experiment... a porting from AA3D

Code: Select all

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Stereogram in dos batch.
::
:: version 0.1
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

@echo off & setlocal EnableDelayedExpansion

mode 120,43
cls
for /L %%N in (1,1,6) do echo(

:: use digit for depth and space

set "B0= "
set "L0= "
set  L1=                  11111111111111111111111111111111111
set  L2=                  11111111111111111111111111111111111
set  L3=                  11112222222222222222222222222211111
set  L4=                  11112222222222222222222222222211111
set  L5=                  11112222222222222222222222222211111
set  L6=                  11112222233333333333333322222211111
set  L7=                  11112222233333333333333322222211111
set  L8=                  11112222233333333333333322222211111
set  L9=                  11112222233333333333333322222211111
set L10=                  11112222233333333333333322222211111
set L11=                  11112222233333333333333322222211111
set L12=                  11112222233333333333333322222211111
set L13=                  11112222222222222222222222222211111
set L14=                  11112222222222222222222222222211111
set L15=                  11112222222222222222222222222211111
set L16=                  11111111111111111111111111111111111
set L17=                  11111111111111111111111111111111111
set "L18= "

set stdin=!B0!n!L0!n!L1!n!L2!n!L3!n!L4!n!L5!n!L6!n!L7!n!L8!n!L9!n!L10!n!L11!n!L12!n!L13!n!L14!n!L15!n!L16!n!L17!n!L18!
set istdin=0

:: These are 32 arbitrary simbols
set alphabet=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef

:: Step/size repeating sequence
set Skip=8

:: initialize some variables
set /a s=0

For /L %%y in (1,1,25) do (

  set l=0
  set "stdout="
  For /L %%x in (1,1,80) do (

     :: Get a random simbols
     set /a index=!random! %% 32
     For %%I in (!index!) do set letter=!alphabet:~%%I,1!

     if !l! equ 0 (
        if %%x gtr !skip! (

          :: read next char
          For %%I in (!istdin!) do set s=!stdin:~%%I,1!
          set /a istdin+=1

          if "!s!"==" " set s=0
          if "!s!"=="n" (set "s=0" & set l=1)
          if "!s!"=="" (set "s=0" & set l=1)

          if !s! geq 0 if !s! leq 10 set /a s=-s

        ) else set s=0
     ) else set s=0

     set /a s+=skip, s=%%x-s

     if !s! lss 0 (set s=!letter!) else (for %%s in (!s!) do (if not defined data[%%s] (set s=0) else set "s=!data[%%s]!"))

     set data[%%x]=!s!

     rem set /p ".=!s!" < nul
     set "stdout=!stdout!!s!"

  )
  echo(                    !stdout!

  if !l! equ 0 call :readln

)

pause>nul

exit /b

:readln

    :: read next char
    For %%I in (!istdin!) do set s=!stdin:~%%I,1!
    set /a istdin+=1

    if "!s!"=="" exit /b

    if Not "!s!"=="n" goto :readln

exit /b



rif: Autostereogram

einstein1969

Post Reply