shal i drive tester

General FreeBASIC programming questions.
bluatigro
Posts: 448
Joined: Apr 25, 2012 10:35
Location: netherlands

shal i drive tester

Postby bluatigro » Aug 23, 2017 12:30

i m woring about trafic savety
whit al the drugs in trafic

you can't test for al drugs
so let test for effects

one of the mosrt dangerous effects is reactiotime growth
so lets test for that

error :
i never saw 'TAKE A CAB !!!'

i m no expert on road savety
are the timespans right ?

Code: Select all

'' bluatigro 23 augv 2017
'' shal i drive tester

function range( l as integer , h as integer ) as integer
  return int( rnd * ( h - l + 1 ) + l )
end function

print
print "  Welkome by shal i drive tester ."
print "  Instructions :"
print "  1 push return at end of this text ."
print "  2 Wait til you see PUSH ."
print "  3 push a random key ."
dim as integer dice = range( 500 , 1500 )
dim as integer tel = 0
print "  [ push return . ]"
sleep
sleep dice * 10
print "  PUSH"
do
  tel = tel + 1
  sleep 10
loop until tel > 200 or inkey <> ""
if tel < 1 then print "  You pressed to soon ."
if tel < 10 then
  print "  You are fit to drive ."
else
  if tel < 50 then
    print "  Drive slow ."
  else
    print "  TAKE A CAB !!!"
  end if
end if
print "  [ game over : push return ]"
sleep
fxm
Posts: 7274
Joined: Apr 22, 2009 12:46
Location: Paris suburb, FRANCE

Re: shal i drive tester

Postby fxm » Aug 23, 2017 12:52

See comments in code:

Code: Select all

'' bluatigro 23 augv 2017
'' shal i drive tester

function range( l as integer , h as integer ) as integer
  return int( rnd * ( h - l + 1 ) + l )
end function

print
print "  Welkome by shal i drive tester ."
print "  Instructions :"
print "  1 push return at end of this text ."
print "  2 Wait til you see PUSH ."
print "  3 push a random key ."
dim as integer dice = range( 500 , 1500 )
dim as integer tel = 0
print "  [ push return . ]"
sleep
sleep dice * 10, 1  '' Ii is necessary to specify that this wait cannot be interrupted by a key-press
while inkey <> ""   '' It is necessary to empty the keyboard buffer after any previous key-press
wend
print "  PUSH"
do
  tel = tel + 1
  sleep 10
loop until tel > 200 or inkey <> ""
if tel < 1 then print "  You pressed to soon ."
if tel < 10 then
  print "  You are fit to drive ."
else
  if tel < 50 then
    print "  Drive slow ."
  else
    print "  TAKE A CAB !!!"
  end if
end if
print "  [ game over : push return ]"
sleep

Return to “General”

Who is online

Users browsing this forum: No registered users and 5 guests