I decided to have a little bit of fun with command prompt yesterday: I wanted to make a randomly generated "maze" with unicode, and got super excited. I have the bones of it pretty much done, but I'm having some issues with my coordinate system to make the image using characters. For some reason, my plethora of variables aren't displaying their values. I don't know what's wrong. It could be the syntax when I made the variables (there are variables in the variable name,) it could be the way I'm setting them up when I'm trying to display them, I don't know.
@echo off
:restart
set x=0
set y=0
:next
set /a chance=%random% %%2
if chance==1 (
set %x%l%y%=00
)
if chance==2 (
set %x%l%y%=11
)
set /a x=%x%+1
if x GEQ 10 (
set x=0
goto display
set /a y=%y%+1
if y GEQ 11 (
goto display
)
)
goto next
:display
echo %0l0%%1l0%%2l0%%3l0%%4l0%%5l0%%6l0%%7l0%%8l0%%9l0%
echo %0l1%%1l1%%2l1%%3l1%%4l1%%5l1%%6l1%%7l1%%8l1%%9l1%
echo %0l2%%1l2%%2l2%%3l2%%4l2%%5l2%%6l2%%7l2%%8l2%%9l2%
echo %0l3%%1l3%%2l3%%3l3%%4l3%%5l3%%6l3%%7l3%%8l3%%9l3%
echo %0l4%%1l4%%2l4%%3l4%%4l4%%5l4%%6l4%%7l4%%8l4%%9l4%
echo %0l5%%1l5%%2l5%%3l5%%4l5%%5l5%%6l5%%7l5%%8l5%%9l5%
echo %0l6%%1l6%%2l6%%3l6%%4l6%%5l6%%6l6%%7l6%%8l6%%9l6%
echo %0l7%%1l7%%2l7%%3l7%%4l7%%5l7%%6l7%%7l7%%8l7%%9l7%
echo %0l8%%1l8%%2l8%%3l8%%4l8%%5l8%%6l8%%7l8%%8l8%%9l8%
echo %0l9%%1l9%%2l9%%3l9%%4l9%%5l9%%6l9%%7l9%%8l9%%9l9%
echo:
pause
cls
goto restart
Because I have not replaced "00" and "11" with unicode yet, the desired output would look something like this:
00110000111100111111
11110011110000111100
00000011111111001100
11000000111100110011
00110000111100111111
00110000111100111111
11110011110000111100
00000011111111001100
11000000111100110011
00110000111100111111
Press any key to continue...
Instead it's this mess.
"C:\Users\***\Documents\array.bat"l0%1l0%2l0%3l0%4l0%5l0%6l0%7l0%8l0%9l0
"C:\Users\***\Documents\array.bat"l1%1l1%2l1%3l1%4l1%5l1%6l1%7l1%8l1%9l1
"C:\Users\***\Documents\array.bat"l2%1l2%2l2%3l2%4l2%5l2%6l2%7l2%8l2%9l2
"C:\Users\***\Documents\array.bat"l3%1l3%2l3%3l3%4l3%5l3%6l3%7l3%8l3%9l3
"C:\Users\***\Documents\array.bat"l4%1l4%2l4%3l4%4l4%5l4%6l4%7l4%8l4%9l4
"C:\Users\***\Documents\array.bat"l5%1l5%2l5%3l5%4l5%5l5%6l5%7l5%8l5%9l5
"C:\Users\***\Documents\array.bat"l6%1l6%2l6%3l6%4l6%5l6%6l6%7l6%8l6%9l6
"C:\Users\***\Documents\array.bat"l7%1l7%2l7%3l7%4l7%5l7%6l7%7l7%8l7%9l7
"C:\Users\***\Documents\array.bat"l8%1l8%2l8%3l8%4l8%5l8%6l8%7l8%8l8%9l8
"C:\Users\***\Documents\array.bat"l9%1l9%2l9%3l9%4l9%5l9%6l9%7l9%8l9%9l9
Press any key to continue . . .
I have plans to expand on this concept, but I cannot go any further without addressing this issue. Please help!