AI for dummy's : gues a number

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

AI for dummy's : gues a number

Post by bluatigro »

this is a example of verry basic AI

Code: Select all

''bluatigro 14 jun 2017
''higher lower ai

print "think of a number between 1 and 100 ."
dim as string in
input "[ pres return to continue . ]" ; in
dim as integer high = 100 , low = 0 , gok
while left( in , 1 ) <> "g"
  gok = int( ( low + high ) / 2 )
  print
  print "i think of : " ; gok
  input "is that good , lower or higher than yours ? [ g l h ] : " ; in
  in = left( lcase( in ) , 1 )
  if in = "l" then
    low = gok
  end if
  if in = "h" then
    high = gok
  end if
wend
print "[ game over : pres return to end program ]"
sleep
  
Post Reply