Create a guessing game

Create a process that allows a user to guess a number between 1 and 10. Start with the flowchart, then the simple process using loops and you may try the state machine method.

Flowchart method

  • In a new process drag the flowchart activity to the main stage.
  • Create three variables using the variables panel
    intGuessNumber set as int32
    intRandomNumber set as int32
    strMessage set as a string default text “Guess a number between 1 and 10.
  • Use the AB Assign activity and in the TO field use variable intRandomNumber and define as new Random ( ) .Next (1, 10)
  • Drag an Input Dialog activity. Use quotes for the label and title which state “Enter a number …” Make sure the result field is the variable intGuessNumber.
  • The flow decision will enable true or false choices. Define the condition as intGuessNumber = intRandomNumber.
  • Create a Message box and connect it to the true side of the flow decision. Enter the text “You have guessed correctly.”
  • Drag a second flow decision to the false side of the first decision and define the condition as
    intGuess >intRandomNumber.
  • Drag an AB Assign to the true branch and in the To enter strMessage and enter text “You guess was too large.”
  • Drag an AB Assign on the false branch and define To as strMessage with text “Your guess was too small.
  • Each of the AB assign need to have arrows up to the first Input dialog.
  • Run this process.

Leave a comment

Design a site like this with WordPress.com
Get started