增加了读取ex.txt文件立方体数据到变量“v"- @echo off&setlocal enabledelayedexpansion&set cr=^
-
-
- set h=0123456789abcdef
- ::读取ex.txt文件立方体到变量“v"
- for /f "delims=" %%a in (ex.txt) do (
- set "str=@%%a@@@@@@@@@@@@@@@@"
- for /l %%b in (1,1,10) do (set str=!str: @=@@!&set str=!str:@ =@@!)
- set s=!h!%%a
- set/a s=0x!s:~-16,1!,x+=1
- if !s! gtr !yg! set/a yg=s
- set _!x!=!str!
- )
- set v=
- for /l %%a in (1,1,!x!) do (
- set v=!v!!_%%a:~1,%yg%!
- )
- set/a xy=x*yg-1
-
- ::根据in.txt数据,画立方图形,写到二维数组空间_n.m
- set/a ns=0,ms=0
- for /f "tokens=*" %%a in (in.txt) do (
- set/a na=n,ma=m
- for %%b in (%%a) do (
- set/a m+=4,n=na
- for /l %%c in (1,1,%%b) do (
- if !n! gtr !ng! set/a ng=n
- if !m! gtr !mg! set/a mg=m
- if !n! lss !ns! set/a ns=n
- if !m! lss !ms! set/a ms=m
- call :sub
- set/a n-=2
- )
- )
- set/a m=ma,n=na,n+=2,m-=2
- )
- pause
- goto :eof
- :cho 把二维空间的数据显示出来
- set /a ngg=ng+5,mgg=mg+7
- set str=
- for /l %%a in (!ns!,1,!ngg!) do (
- for /l %%b in (!ms!,1,!mgg!) do (
- set "var=!_%%a.%%b! "
- set str=!str!!var:~,1!
- )
- set str=!str!!cr!
- )
- cls&echo;!str!
- ping -n 1 127.1 >nul
- goto :eof
- :sub 把一个立方图形放到地址空间
- for /l %%a in (0,1,!xy!) do (
- set "o=!v:~%%a,1!"
- if defined o if "!o!" neq "@" (
- set/a "nx=%%a/7+n,my=%%a%%7+m"
- set _!nx!.!my!=!o!
- )
- )
- call :cho
- goto :eof
复制代码
[ 本帖最后由 netbenton 于 2009-10-11 18:54 编辑 ] |