brainfrz

Untitled

Oct 13th, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. MIN_NUMBER = 1, MAX_NUMBER = 100, guesses = 1, MAX_GUESSES = 10
  2.  
  3. correctNumber = random number between MIN_NUMBER and MAX_NUMBER
  4.  
  5. DO
  6. DO
  7. DO
  8. Prompt guess
  9. IF guess < MIN_NUMBER OR guess > MAX_NUMBER THEN
  10. Display error message
  11. END IF
  12. LOOP WHILE guess < MIN_NUMBER OR guess > MAX_NUMBER
  13.  
  14. IF guess == correctNumber THEN
  15. Display congrats message with number of guesses used
  16. ELSE IF guesses == MAX_GUESSES THEN
  17. Display consolation message with correct number
  18. ELSE
  19. IF guess < currectNumber THEN
  20. Display hint that guess is too low
  21. ELSE IF guess > currectNumber THEN
  22. Display hint that guess is too high
  23. ELSE
  24. Display bug message about guess handling failure
  25. END IF
  26.  
  27. Increment guesses
  28. END IF
  29. LOOP WHILE guess != correctNumber AND guesses <= MAX_GUESSES
  30.  
  31. Prompt if userContinues
  32. LOOP WHILE userContinues == “y” OR userContinues == “yes”
Advertisement
Add Comment
Please, Sign In to add comment