aboutsummaryrefslogtreecommitdiff
path: root/game.bas
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-07-29 08:12:16 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-07-29 08:25:22 +0100
commitf569f70654def8f2b590fca62dbfa3e7b2b5dd8c (patch)
treeea33632775a75e9ac1caf3f12cbf09763f30dcc3 /game.bas
downloadsinclair-basic-main.tar.gz
sinclair-basic-main.zip
Initial importHEADmain
Diffstat (limited to 'game.bas')
-rw-r--r--game.bas10
1 files changed, 10 insertions, 0 deletions
diff --git a/game.bas b/game.bas
new file mode 100644
index 0000000..1757efb
--- /dev/null
+++ b/game.bas
@@ -0,0 +1,10 @@
+10 REM Guess a number
+20 CLS : RANDOMIZE
+30 LET n = INT(RND * 8) +1 : LET t = 1
+100 INPUT "Guess a number from 1 to 9", g
+120 PRINT "Your guess is "; g
+130 IF g < n THEN PRINT "The number is bigger"
+140 IF g > n THEN PRINT "The number is smaller"
+150 IF g = n THEN GO TO 200
+160 LET t = t + 1 : GO TO 100
+200 PRINT "You won in "; t ; " turns"