How to resolve the algorithm Guess the number/With feedback step by step in the ZX Spectrum 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 ZX Spectrum 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 ZX Spectrum Basic programming language
Source code in the zx programming language
ZX Spectrum Basic has no [[:Category:Conditional loops|conditional loop]] constructs, so we have to emulate them here using IF and GO TO.
1 LET n=INT (RND*10)+1
2 INPUT "Guess a number that is between 1 and 10: ",g: IF g=n THEN PRINT "That's my number!": STOP
3 IF g
4 IF g>n THEN PRINT "That guess is too high!": GO TO 2
You may also check:How to resolve the algorithm Morse code step by step in the sed programming language
You may also check:How to resolve the algorithm Dice game probabilities step by step in the Ruby programming language
You may also check:How to resolve the algorithm Abbreviations, easy step by step in the Clojure programming language
You may also check:How to resolve the algorithm ABC problem step by step in the Order programming language
You may also check:How to resolve the algorithm Binary digits step by step in the CoffeeScript programming language