How to resolve the algorithm Guess the number/With feedback step by step in the Arturo programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Guess the number/With feedback step by step in the Arturo programming language

Table of Contents

Problem Statement

Write a game (computer program) that follows the following rules:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Guess the number/With feedback step by step in the Arturo programming language

Source code in the arturo programming language

n: random 1 10
while ø [
    try? [
        num: to :integer input "Guess the number: " n
        case [num]
            when? [=n][print "\tWell Guessed! :)", exit]
            when? [>n][print "\tHigher than the target..."]
            when? [<n][print "\tLess than the target..."]
            else []
    ]
    else -> print "\tInvalid input!"
]


  

You may also check:How to resolve the algorithm Bulls and cows step by step in the Raku programming language
You may also check:How to resolve the algorithm Array length step by step in the Phix programming language
You may also check:How to resolve the algorithm Iterated digits squaring step by step in the AWK programming language
You may also check:How to resolve the algorithm Call a function step by step in the Smalltalk programming language
You may also check:How to resolve the algorithm Host introspection step by step in the BBC BASIC programming language