Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

SmallBasic Guess the Number

simple text game
by

Mark Tranter

on 28 October 2012

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of SmallBasic Guess the Number

Guess the Number. If you enter a number outside the range, you get the chance to try again. I used a sub-routine for getting the number from the user. Task:
Modify this program so that the computer has to guess the number you are thinking of. Pseudocode

low = 1
high = 100
counter = 0
loop:
counter = counter +1
Make a guess (between high and low)
Get response from human player (h, l or y)
if "y":
break out of loop
if "h":
set low to guess +1
if "l":
set high to guess -1
repeat

print number of turns it took to get the answer.
Full transcript