Magic 8-ball: Difference between revisions

Content added Content deleted
imported>Fishhack66
imported>Fishhack66
Line 1,296: Line 1,296:
{{based on the BASIC versions}}
{{based on the BASIC versions}}
<syntaxhighlight lang="focal">
<syntaxhighlight lang="focal">



1.09 S FRAN(-1);C randomize
1.09 S FRAN(-1);C randomize
1.10 S FISL(80,A$);C set length to 80 char.

1.10 S FISL(80,A$);C set/dim length A$ 80

1.20 T !"Magic 8-Ball (Q to quit)"!!
1.20 T !"Magic 8-Ball (Q to quit)"!!

1.30 T "What would you like to know?"!
1.30 T "What would you like to know?"!

1.40 S FSTI(80,A$(0),13);C input from console to A$, CR delimited
1.40 S FSTI(80,A$(0),13);C input from console to A$, CR delimited

1.42 S Z=A$(0);I (Z-81) , 50.1;C Capital Q, if first char = then branch
1.42 S Z=A$(0);I (Z-81) , 50.1;C Capital Q, if first char = then branch
1.44 S Z=A$(0);I (Z-113) , 50.1;C lowercase q, if first char = then branch

1.44 S Z=A$(0);I (Z-113) , 50.1;C Lowercase q, if first char = then branch


1.50 T !
1.50 T !

1.60 S R=FINT(FRAN(0)*20+1);C get a random integer 1-20
1.60 S R=FINT(FRAN(0)*20+1);C get a random integer 1-20

1.70 D R*2;C 'do' calculated response subroutine
1.70 D R*2;C 'do' calculated response subroutine

1.80 T !!"What else would you like to know?"!;G 1.4;C loop up to A$ input
1.80 T !!"What else would you like to know?"!;G 1.4;C loop up to A$ input



2.10 T "It is certain.";R;C print a response and return from subroutine
2.10 T "It is certain.";R;C print a response and return from subroutine

4.10 T "It is decidedly so.";R;C etc.....
4.10 T "It is decidedly so.";R;C etc.....

6.10 T "Without a doubt.";R
6.10 T "Without a doubt.";R

8.10 T "Yes - definitely.";R
8.10 T "Yes - definitely.";R

10.10 T "You may rely on it.";R
10.10 T "You may rely on it.";R

12.10 T "As I see it, yes.";R
12.10 T "As I see it, yes.";R

14.10 T "Most likely.";R
14.10 T "Most likely.";R

16.10 T "Outlook good.";R
16.10 T "Outlook good.";R

18.10 T "Yes.";R
18.10 T "Yes.";R

20.10 T "Signs point to yes.";R
20.10 T "Signs point to yes.";R

22.10 T "Reply hazy, try again.";R
22.10 T "Reply hazy, try again.";R

24.10 T "Ask again later.";R
24.10 T "Ask again later.";R

26.10 T "Better not tell you now.";R
26.10 T "Better not tell you now.";R

28.10 T "Cannot predict now.";R
28.10 T "Cannot predict now.";R

30.10 T "Concentrate and ask again.";R
30.10 T "Concentrate and ask again.";R

32.10 T "Don't count on it.";R
32.10 T "Don't count on it.";R

34.10 T "My reply is no.";R
34.10 T "My reply is no.";R

36.10 T "My sources say no.";R
36.10 T "My sources say no.";R

38.10 T "Outlook not so good.";R
38.10 T "Outlook not so good.";R

40.10 T "Very doubtful.";R
40.10 T "Very doubtful.";R


50.10 T !"Thanks for consulting Magic 8-Ball for your life choices."!
50.10 T !"Thanks for consulting Magic 8-Ball for your life choices."!
50.20 Q


50.20 Q
</syntaxhighlight>
</syntaxhighlight>