有规律的数独,不过符合数独要求…… | @echo off &setlocal enabledelayedexpansion | | ::code by 523066680@Bathome | | :test | | set "numx=123456789" | | set "ca=call :next" | | :first | | set /a ra=%random%%%9+1,rb=%random%%%9+1 | | set numx=!numx:%ra%=x! | | set numx=!numx:%rb%=%ra%! | | set numx=!numx:x=%rb%! | | if %ra% neq 9 (goto :first) | | set h1=%numx% | | %ca% 1 2 | | %ca% 2 3 | | set h4=%h1:~2,1%%h1:~0,2%%h1:~5,1%%h1:~3,2%%h1:~8,1%%h1:~6,2% | | %ca% 4 5 | | %ca% 5 6 | | set h7=%h4:~2,1%%h4:~0,2%%h4:~5,1%%h4:~3,2%%h4:~8,1%%h4:~6,2% | | %ca% 7 8 | | %ca% 8 9 | | for /l %%a in (1,1,9) do (for /l %%b in (1,1,9) do (set h%%a=!h%%a:%%b=%%b !)) | | for /l %%a in (1,1,9) do (echo,!h%%a!) | | echo, &pause &echo, | | goto :test | | :next | | set h%2=!h%1:~3,3!!h%1:~6!!h%1:~0,3! | | goto :eofCOPY |
|