How to resolve the algorithm Guess the number/With feedback step by step in the Tiny Craft Basic 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 Tiny Craft Basic 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 Tiny Craft Basic programming language

Source code in the tiny programming language

10 cls

20 let r = int(rnd * 100) + 1

30 print "hilo game"
40 print "guess the nusmber between 1 and 100"

50 rem loop

	60 let t = t + 1

	70 input "guess: ", g

	80 if g <> r then 110

		90 print "you guessed it in ", t ," tries."
		100 goto 220

	110 rem endif

	120 if g > r or g < 1 then 140

		130 print "too low"

	140 rem endif

	150 if g < r or g > 100 then 170

		160 print "too high"

	170 rem endif

	180 if g >= 1 and g <= 100 then 200

		190 print "invalid guess"

	200 rem endif

210 if g <> r then 50

220 shell "pause"


  

You may also check:How to resolve the algorithm Align columns step by step in the F# programming language
You may also check:How to resolve the algorithm AKS test for primes step by step in the 11l programming language
You may also check:How to resolve the algorithm Guess the number step by step in the XPL0 programming language
You may also check:How to resolve the algorithm Zig-zag matrix step by step in the AWK programming language
You may also check:How to resolve the algorithm Substring step by step in the Ruby programming language