Moving tiles BATCH : <p>I have been working on a puzzle and for some reason this does not work. </p>

<p>each slide is a random letter, "a, b, c, d, e, f, g, h, i, j, k, l, m, n, o" I know that 50% of the time this can be a unsolvable puzzle (don't know how to avoid it except for having constants) </p>

<p>Besides it being unsolvable half the time the movements don't work, could it be because the tiles are letters and not numbers? The movements are controlled by the wasd keys (w=up, a=left, s=down, d=right)</p>

<p>The final thing is can this be any more simple/effective?</p>

<pre><code>echo  ____ ____ ____ ____
echo ^|    ^|    ^|    ^|    ^|
echo ^| %slide1% ^| %slide2% ^| %slide3% ^| %slide4% ^|
echo ^|____^|____^|____^|____^|
echo ^|    ^|    ^|    ^|    ^|
echo ^| %slide5% ^| %slide6% ^| %slide7% ^| %slide8% ^|
echo ^|____^|____^|____^|____^|
echo ^|    ^|    ^|    ^|    ^|
echo ^| %slide9% ^| %slide10% ^| %slide11% ^| %slide12% ^|
echo ^|____^|____^|____^|____^|
echo ^|    ^|    ^|    ^|    ^|
echo ^| %slide13% ^| %slide14% ^| %slide15% ^| %slide16%  ^|
echo ^|____^|____^|____^|____^|

choice /c wasdr /n
if %errorlevel% == 1 goto movew
if %errorlevel% == 2 goto movea
if %errorlevel% == 3 goto moves
if %errorlevel% == 4 goto moved
if %errorlevel% == 5 goto reset
:movew
if %pos% GEQ 13 goto display
set /a helper=%pos% + 4
set /a slide%pos%=!slide%helper%!
set slide%helper%=%default%
set /a pos=%pos% + 4
:movea
if %pos% == 4 goto display
if %pos% == 8 goto display
if %pos% == 12 goto display
if %pos% == 16 goto display
set /a helper=%pos% + 1
set /a slide%pos%=!slide%helper%!
set slide%helper%=%default%
set /a pos=%pos% + 1
goto display
:moves
if %pos% LEQ 4 goto display
set /a helper=%pos% - 4
set /a slide%pos%=!slide%helper%!
set slide%helper%=%default%
set /a pos=%pos% - 4
goto display
:moved
if %pos% == 1 goto display
if %pos% == 5 goto display
if %pos% == 9 goto display
if %pos% == 13 goto display
set /a helper=%pos% - 1
set /a slide%pos%=!slide%helper%!
set slide%helper%=%default%
set /a pos=%pos% - 1
goto display
</code></pre>

<p>Thanks,</p>
