vtol Valued Contributor
Joined: 05 Feb 2004 Posts: 642 Location: Eastern Indiana
|
Posted: Sun Jan 02, 2005 5:37 am Post subject: Simple Randomizer tester |
|
|
Just a simple Randomizer Tester...
Code: |
Title Randomizer
OPTION DECIMALSEP, "."
LIST CREATE,1,SORTED
DIALOG CREATE,Randomizer,-1,0,240,155,,savepos
DIALOG ADD,LINE,LINE1,5,55,179,140
DIALOG ADD,STYLE,STYLE1,,10,,,CC6600
DIALOG ADD,LIST,counter,55,65,20,18,Counter
DIALOG ADD,LIST,numbers,5,5,40,140,Examples
DIALOG ADD,LIST,testing,90,65,40,20,testing
DIALOG ADD,TEXT,TEXT,20,75,,,Randomizer,,STYLE1
DIALOG ADD,BUTTON,start,13,168,45,20,START
DIALOG ADD,BUTTON,retry,39,168,45,20,RESET
DIALOG ADD,BUTTON,exit,120,138,75,17,PAUSE "/" EXIT
DIALOG SHOW
dialog disable,retry
:Evloop
wait event
goto @event()
:retryBUTTON
LIST clear,1
dialog clear,numbers
dialog clear,testing
dialog clear,counter
%%text_counter = 0
%%testing = no
dialog enable,start
dialog disable,retry
goto Evloop
:skip-retry
:startBUTTON
%%pause = off
dialog disable,retry
:START
LIST clear,1
:restart
%%count = 0
%%min = 1
%%max = 40
REPEAT
%%dt = @ext(@datetime())
if @greater(@len(%%dt_old), @len(%%dt))
REPEAT
%%dt = %%dt"0"
UNTIL @equal(@len(%%dt), @len(%%dt_old))
end
%%dt_old = %%dt
if @greater(@len(%%dt), @len(%%max))
%%rand = @substr(%%dt, @succ(@diff(@len(%%dt), @len(%%max))), @len(%%dt))
end
UNTIL @both(@greater(%%rand, @pred(%%min)), @greater(@succ(%%max), %%rand))
dialog clear,testing
LIST add,testing,%%rand
wait "0.1"
LIST add,1,%%rand
wait "0.1"
%%count_eighteen = @count(1)
dialog clear,counter
dialog set,counter,%%count_eighteen
%E = @event()
IF @equal(%E,exitBUTTON)
%%count_eighteen = 10
dialog set,testing,Pause
%%pause = on
END
IF @equal(%E,CLOSE)
goto close
END
# below partially determines how many numbers to process
# above REPEAT may beed adjustments for more numbers
IF @not(@greater(%%count_eighteen,9))
goto restart
END
IF @unequal(%%pause,on)
dialog set,testing,Done"!"
%%pause = off
END
dialog disable,start
dialog enable,retry
dialog set,numbers,@text(1)
goto evloop
:exitBUTTON
:CLOSE
LIST close,1
STOP
|
|
|