NOTE:In this poste is a 3x3 matrix, i use 10x10 matrix and thats why i have the speed issue
Code: Select all
@echo off
@rem Symbols
set full=X
set empty=O
@rem Cells
set cell_ini=0
set cell_max=9
:Cell
set /a cell_ini=%cell_ini%+1
set c%cell_ini%=%Empty%
if %cell_ini% NEQ %cell_max% goto Cell
:Display
:Convert_Empty_to_Blank
set s1=0
if %c1% EQU %empty% set s1=1
if %c1% EQU %empty% set c1=
set s2=0
if %c2% EQU %empty% set s2=1
if %c2% EQU %empty% set c2=
set s3=0
if %c3% EQU %empty% set s3=1
if %c3% EQU %empty% set c3=
set s4=0
if %c4% EQU %empty% set s4=1
if %c4% EQU %empty% set c4=
set s5=0
if %c5% EQU %empty% set s5=1
if %c5% EQU %empty% set c5=
set s6=0
if %c6% EQU %empty% set s6=1
if %c6% EQU %empty% set c6=
set s7=0
if %c7% EQU %empty% set s7=1
if %c7% EQU %empty% set c7=
set s8=0
if %c8% EQU %empty% set s8=1
if %c8% EQU %empty% set c8=
set s9=0
if %c9% EQU %empty% set s9=1
if %c9% EQU %empty% set c9=
cls
echo.
echo I---I
echo I%c1%%c2%%c3%I
echo I%c4%%c5%%c6%I
echo I%c7%%c8%%c9%I
echo I---I
echo.
:Convert_Blank_to_Empty
if %s1% EQU 1 set c1=%empty%
if %s2% EQU 1 set c2=%empty%
if %s3% EQU 1 set c3=%empty%
if %s4% EQU 1 set c4=%empty%
if %s5% EQU 1 set c5=%empty%
if %s6% EQU 1 set c6=%empty%
if %s7% EQU 1 set c7=%empty%
if %s8% EQU 1 set c8=%empty%
if %s9% EQU 1 set c9=%empty%
:Toggle_Values
set /a Toggle=%random%/ (32767 / 9)+1
goto C%Toggle%
:C1
set s=0
if %c1% EQU %Empty% set s=0
if %c1% EQu %full% set s=1
if %s% EQU 0 set c1=%full%
if %s% EQU 1 set c1=%Empty%
goto Display
:C2
set s=0
if %c2% EQU %Empty% set s=0
if %c2% EQu %full% set s=1
if %s% EQU 0 set c2=%full%
if %s% EQU 1 set c2=%Empty%
goto Display
:C3
set s=0
if %c3% EQU %Empty% set s=0
if %c3% EQu %full% set s=1
if %s% EQU 0 set c3=%full%
if %s% EQU 1 set c3=%Empty%
goto Display
:C4
set s=0
if %c4% EQU %Empty% set s=0
if %c4% EQu %full% set s=1
if %s% EQU 0 set c4=%full%
if %s% EQU 1 set c4=%Empty%
goto Display
:C5
set s=0
if %c5% EQU %Empty% set s=0
if %c5% EQu %full% set s=1
if %s% EQU 0 set c5=%full%
if %s% EQU 1 set c5=%Empty%
goto Display
:C6
set s=0
if %c6% EQU %Empty% set s=0
if %c6% EQu %full% set s=1
if %s% EQU 0 set c6=%full%
if %s% EQU 1 set c6=%Empty%
goto Display
:C7
set s=0
if %c7% EQU %Empty% set s=0
if %c7% EQu %full% set s=1
if %s% EQU 0 set c7=%full%
if %s% EQU 1 set c7=%Empty%
goto Display
:C8
set s=0
if %c8% EQU %Empty% set s=0
if %c8% EQu %full% set s=1
if %s% EQU 0 set c8=%full%
if %s% EQU 1 set c8=%Empty%
goto Display
:C9
set s=0
if %c9% EQU %Empty% set s=0
if %c9% EQu %full% set s=1
if %s% EQU 0 set c9=%full%
if %s% EQU 1 set c9=%Empty%
goto Display