cmd - Batch programming: randomly goto random parts of the code -


(i edit or delete post if wrote bad) have code can't seem pull off correctly. @ it.

set /a num=%random% %%9 +1 set /p start="do want start? " if %start% ==yes goto %random% if %start% ==no exit :1 echo tu turi %score% tasku (-us)! set /p answer="6 x 5 = " if %answer% equ 30 (     echo teisingai! gavai 1 taska!     set /a score+=1     echo %score% > %player%.sav     ) else (     echo neteisingai :( atsakymas buvo %answer%!     echo %score% > %player%.sav     ) :2 echo tu turi %score% tasku (-us)! set /p answer="123 x 3 = " if %answer% equ 369 (     echo teisingai! gavai 1 taska!     set /a score+=1     echo %score% > %player%.sav     ) else (     echo neteisingai :( atsakymas buvo %answer%!     echo %score% > %player%.sav     ) :3 echo tu turi %score% tasku (-us)! set /p answer="-93128 + 993128 = " if %answer% equ 900000 (     echo teisingai! gavai 5 taskus!     set /a score+=5     echo %score% > %player%.sav     ) else (     echo neteisingai :( atsakymas buvo %answer%!     echo %score% > %player%.sav     ) :4 echo tu turi %score% tasku! set /p answer="35734534757357 x 0 = " if %answer% equ 0 (     echo teisingai! gavai 2 taskus!     set /a score+=2     echo %score% > %player%.sav     ) else (     echo neteisingai :( atsakymas buvo %answer%!     echo %score% > %player%.sav     ) :5 echo tu turi %score% tasku! set /p answer="6 + 8 x 3 = " if %answer% equ 30 (     echo teisingai! gavai 3 taskus!     set /a score+=3     echo %score% > %player%.sav     ) else (     echo neteisingai :( atsakymas buvo %answer%!     echo %score% > %player%.sav     ) :6 echo tu turi %score% tasku! set /p answer="x + 1234 = 2468. koks skaicius yra x?" if %answer% equ 1234 (     echo teisingai! gavai 4 taskus!     set /a score+=4     echo %score% > %player%.sav     ) else (     echo neteisingai :( atsakymas buvo %answer%!     echo %score% > %player%.sav     ) :7 echo tu turi %score% tasku! set /p answer="-9 x -9 = " if %answer% equ 81 (     echo teisingai! gavai 5 taskus!     set /a score+=5     echo %score% > %player%.sav     ) else (     echo neteisingai :( atsakymas buvo %answer%!     echo %score% > %player%.sav     ) :8 echo tu turi %score% tasku! set /p answer="1 + 1 x (111 x 3) = " if %answer% equ 666 (     echo teisingai! gavai 6 taskus!     set /a score+=6     echo %score% > %player%.sav     ) else (     echo neteisingai :( atsakymas buvo %answer%!     echo %score% > %player%.sav     ) :9 echo tu turi %score% tasku! set /p answer="634745645634576456457645657 x 0 = " if %answer% equ 0 (     echo teisingai! gavai 2 taskus!     set /a score+=2     echo %score% > %player%.sav     ) else (     echo neteisingai :( atsakymas buvo %answer%!     echo %score% > %player%.sav     ) 

it's in different language. sorry. want make if write "yes" @ beginning go random math question (from 1 9). hope understand because i'm bad @ explaining things :(

copypasting isn't making piece of logic work on bunch of different data. don't need gotos here, organize data in more clever way. can pick random question data structure (or generate on fly) , put in function. ok, may hard in cmd language. not language start with, try simpler , more powerful. recommend scheme or haskell. after that, learning language easier.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -