//a game of HiLo BEGIN DECLARE GLOBAL hi,lo,mystery,tries as unsigned integer DECLARE GLOBAL guessed as boolean DECLARE guess as unsigned integer //new game SET hi to 100 SET lo to 0 SET guessed to false SET tries to 10 SET mystery to random(0-100) //game loop WHILE (not(guessed) and (tries > 0)) DO //let user guess SET tries = tries-1 OUTPUT 'The mystery number lies between ',hi,' and',lo INPUT guess //how good was the guess (goldilocks logic) IF(guess = mystery) THEN SET guessed = true ELSEIF (guess > mystery) THEN SET hi = guess OUTPUT 'Too HIGH' ELSE SET lo = guess OUTPUT 'Too LOW' ENDIF ENDWHILE //game outcome IF (guessed) THEN OUTPUT 'Good work, you guessed it in ',tries,' turns' ELSE OUTPUT 'too bad, you ran out of guesses - the mystery number was ',mystery ENDIF END