@echo off

rem =============================
rem =                           =
rem =    Test descriptions      =
rem =                           =
rem =============================

rem Tests   1-2      sample

SET PROBLEM_NAME=game
SET FIRST_GENERATED_TEST=2
SET EXECUTABLE=java solution
SET MAXIMUM_TESTS=200

rem =============================
rem =                           =
rem =         Compiling         =
rem =                           =
rem =============================

echo Compiling...

dcc32 -CC gen_random >nul

rem =============================
rem =                           =
rem =       Delete files        =
rem =                           =
rem =============================

echo Deleting old files

del "%~dp0*.out" > nul

for /l %%i in (%FIRST_GENERATED_TEST%,1,%MAXIMUM_TESTS%) do (
  if exist %%i.in (
    del %%i.in > nul
  )
)

rem =============================
rem =                           =
rem =     Generating tests      =
rem =                           =
rem =============================

echo Generating tests...


gen_random 1 0.5 0.99
gen_random 1 0.99 0.5
gen_random 1 0.99 0.99
gen_random 1 0.5 0.78
gen_random 2 0.5 0.99
gen_random 2 0.99 0.5
gen_random 2 0.99 0.99
gen_random 2 0.5 0.78
gen_random 3 0.5 0.5
gen_random 4 0.5 0.5
gen_random 5 0.5 0.5
gen_random 6 0.5 0.5
gen_random 7 0.5 0.5
gen_random 8 0.5 0.5
gen_random 9 0.5 0.5
gen_random 10 0.5 0.5
gen_random 17 0.5 0.5
gen_random 1000 0.5 0.5
gen_random 1000 0.50 0.99
gen_random 1000 0.99 0.99
gen_random 1000 0.99 0.50
gen_random 1000 0.57 0.77
gen_random 5 0.51234567 0.61234567
gen_random 5 0.51234568 0.61234567
gen_random 30 0.5000000 0.50000002
gen_random 1000000 0.6001 0.6001
gen_random 1000 0.99999999 0.99999999
gen_random 1000 0.99999999 0.99999998
gen_random 1000 0.99999998 0.99999999
gen_random 99999999 0.99999999 0.99999998
gen_random 99999999 0.94599999 0.99999998
gen_random
gen_random
gen_random
gen_random
gen_random
gen_random
gen_random
gen_random
gen_random
gen_random
gen_random
gen_random





rem =============================
rem =                           =
rem =      Making answers       =
rem =                           =
rem =============================

echo Getting answers with model solution

for /l %%i in (1,1,%MAXIMUM_TESTS%) do (
  if exist %%i.in (
    copy %%i.in %PROBLEM_NAME%.in > nul
    %EXECUTABLE% > nul
    copy %PROBLEM_NAME%.out %%i.out > nul
    del %PROBLEM_NAME%.in > nul
    del %PROBLEM_NAME%.out > nul
  )
)