Skip to main content
clarification of explanation, code repairal
Source Link
kitcar2000
  • 2.7k
  • 15
  • 24

Sinclair BASIC

 10 LET r=INT RND*8
 20 LET n$=""
 30 IF r=0 THEN LET n$="John"
 40 IF r=0r=1 THEN LET n$="Jeff"
 50 IF r=0r=2 THEN LET n$="Jmma"
 60 IF r=0r=3 THEN LET n$="Steve"
 70 IF r=0r=4 THEN LET n$="Julie"
 80 PRINT "The person buying the drinks today is..."
 90 FOR d=0 TO 16 : REM Drum roll...
100 OUT 254,31
110 PAUSE 6-(d/4)
120 OUT 245,15
130 PAUSE 6-(d/4)
140 NEXT d
150 PRINT n$;"!"

Explanation:

The INT function only evaluates the item immediately after it so it performs (INT RND)*8 (0) thenrather than 0*8INT (RND*8) (0) so John will always buy the drinks.

Sinclair BASIC

 10 LET r=INT RND*8
 20 LET n$=""
 30 IF r=0 THEN LET n$="John"
 40 IF r=0 THEN LET n$="Jeff"
 50 IF r=0 THEN LET n$="Jmma"
 60 IF r=0 THEN LET n$="Steve"
 70 IF r=0 THEN LET n$="Julie"
 80 PRINT "The person buying the drinks today is..."
 90 FOR d=0 TO 16 : REM Drum roll...
100 OUT 254,31
110 PAUSE 6-(d/4)
120 OUT 245,15
130 PAUSE 6-(d/4)
140 NEXT d
150 PRINT n$;"!"

Explanation:

The INT function only evaluates the item immediately after it so it performs INT RND (0) then 0*8 (0) so John will always buy the drinks.

Sinclair BASIC

 10 LET r=INT RND*8
 20 LET n$=""
 30 IF r=0 THEN LET n$="John"
 40 IF r=1 THEN LET n$="Jeff"
 50 IF r=2 THEN LET n$="Jmma"
 60 IF r=3 THEN LET n$="Steve"
 70 IF r=4 THEN LET n$="Julie"
 80 PRINT "The person buying the drinks today is..."
 90 FOR d=0 TO 16 : REM Drum roll...
100 OUT 254,31
110 PAUSE 6-(d/4)
120 OUT 245,15
130 PAUSE 6-(d/4)
140 NEXT d
150 PRINT n$;"!"

Explanation:

The INT function only evaluates the item immediately after it so it performs (INT RND)*8 rather than INT (RND*8) so John will always buy the drinks.

Source Link
kitcar2000
  • 2.7k
  • 15
  • 24

Sinclair BASIC

 10 LET r=INT RND*8
 20 LET n$=""
 30 IF r=0 THEN LET n$="John"
 40 IF r=0 THEN LET n$="Jeff"
 50 IF r=0 THEN LET n$="Jmma"
 60 IF r=0 THEN LET n$="Steve"
 70 IF r=0 THEN LET n$="Julie"
 80 PRINT "The person buying the drinks today is..."
 90 FOR d=0 TO 16 : REM Drum roll...
100 OUT 254,31
110 PAUSE 6-(d/4)
120 OUT 245,15
130 PAUSE 6-(d/4)
140 NEXT d
150 PRINT n$;"!"

Explanation:

The INT function only evaluates the item immediately after it so it performs INT RND (0) then 0*8 (0) so John will always buy the drinks.