Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- numguess:-numGuess(100,1).
- numGuess(Top,Bottom):-write('Is your number less than '),Middle is truncate((Top + Bottom) / 2),write(Middle),write('? [y/n]'),read(y), numGuess(Middle - 1,Bottom).
- numGuess(Top,Bottom):-write('Is your number greater than '),Middle is truncate((Top + Bottom) / 2),write(Middle),write('? [y/n]'),read(y), numGuess(Top,Middle + 1).
- numGuess(Top,Bottom):-write('Your number is '),Middle is truncate((Top + Bottom) / 2),write(Middle),write('.').
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement