PROGRAM LISTING 100 PRINT\PRINT "REVERSE -- A GAME OF SKILL"\PRINT 120 RANDOMIZE 130 DIM A(20) 140 REM *** N=NUMBER OF NUMBERS 150 N=9 160 INPUT "DO YOU WANT THE RULES (YES OR NO)";A$ 180 IF A$="N0" TNEN 210 190 GOSUB 710 200 REM *** MAKE A RANDOM LIST A(1) TO A(N) 210 A(1)=INT((N-1)*RND)+2 220 FOR K=2 TO N 230 A(K)=INT(N*RND)+1 240 FOR J=1 T0 K-1 250 IF A(K)=A(J) THEN 230 260 NEXT J\NEXT K 280 REM *** PRINT ORIGNIRL LIST AND START GAME 290 PRINT\PRINT "HERE HE G0 ... THE LIST IS:" 310 T=0 320 GOSUB 610 330 INPUT "HOW MANY SHALL I REVERSE";R 350 IF R=0 THEN 520 360 IF R<=N THEN 390 370 PRINT "OOPS! TOO MANY - I CAN REVERSE AT MOST"N\GOTO 330 390 T=T+1 400 REM *** REVERSE R NUMBERS AND PRINT NEW LIST 410 FOR K=1 T0 INT(R/2) 420 Z=A(K) 430 A(K)=A(R-K+1) 440 A(R-K+1)=Z 450 NEXT K 460 GOSUB 610 470 REM *** CHECK FOR A WIN 480 FOR K=1 T0 N 490 IF A(K)<>K THEN 330 500 NEXT K 510 PRINT "YOU WON IT IN"T"MOVES !!!"\PRINT 530 INPUT "TRY AGAIN (YES OR NO)";A$ 550 IF A$="YES" THEN 210 560 PRINT\PRINT "O.K. HOPE YOU HAD FUN!!"\GOTO 999 600 REM *** SUBROUTINE TO PRINT LIST 610 PRINT\FOR K=1 TO N\PRINT A(K);\NEXT K 650 PRINT\PRINT\RETURN 700 REM *** SUBROUTINE TO PRINT THE RULES 710 PRINT\FRINT "THIS IS THE GAME OF 'REVERSE'. T0 WIN, ALL YOU HAVE" 720 PRINT "TO DO IS ARRANGE A LIST OF NUMBERS (1 THROUGH"N")" 730 PRINT "IN NUMERICAL ORDER FROM LEFT TO RIGHT. TO MOVE, YOU" 740 PRINT "TELL ME HOW MANY NUMBERS (COUNTING FROM THE LEFT) TO" 750 PRINT "REVERSE. FOR EXAMPLE, IF THE CURRENT LIST IS:" 760 PRINT\PRINT "2 3 4 5 1 6 7 8 9" 770 PRINT\PRINT "AND YOU REVERSE 4, THE RESULT WILL BE:" 780 PRINT\PRINT "5 4 3 2 1 6 7 8 9" 790 PRINT\PRINT "NOW, IF YOU REVERSE 5, YOU WIN!" 800 PRINT\PRINT "1 2 3 4 5 6 7 8 9"\PRINT 810 PRINT "NO DOUBT YOU WILL LIKE THIS GAME OF SKILL, BUT" 820 PRINT "IF YOU WANT TO QUIT. REVERSE 0 (ZERO)."\PRINT\RETURN 999 END READY *** SAMPLE RUN REVERSE -- A GAME OF SKILL D0 YOU WANT THE RULES (YES OR N0)? YES THIS IS THE GAME OF 'REVERSE'. TO WIN, ALL YOU HAVE TO DO IS ARRANGE A LIST OF NUMBERS (1 THROUGH 9 ) IN NUMERICAL ORDER FROM LEFT TO RIGHT. TO MOVE, YOU TELL ME HOW MANY NUMBERS (COUNTING FROM THE LEFT) TO REVERSE. FOR EXAMPLE, IF THE CURRENT LIST IS: 2 3 4 5 1 6 7 8 9 AND YOU REVERSE 4, THE RESULT WILL BE: 5 4 3 2 1 6 7 8 9 NOW, IF YOU REVERSE 5, YOU WIN! 1 2 3 4 5 6 7 8 9 NO DOUBT YOU WILL LIKE THIS GAME OF SKILL, BUT IF YOU WANT TO QUIT, REVERSE 0 (ZERO). HERE WE GO... THE LIST IS: 9 8 6 1 7 3 2 4 5 HOW MANY SHALL I REVERSE? 9 5 4 2 3 7 1 6 8 9 HOW MANY SHALL I REVERSE? 4 3 2 4 5 7 1 6 8 9 HOW MANY SHALL I REVERSE? 2 2 3 4 5 7 1 6 8 9 HOW MANY SHALL I REVERSE? 6 1 7 5 4 3 2 6 8 9 HOW MANY SHALL I REVERSE? 2 7 1 5 4 3 2 6 8 9 HOW MANY SHALL I REVERSE? 6 2 3 4 5 1 7 6 8 9 [image] HOW MANY SHALL I REVERSE? 7 6 7 1 5 4 3 2 8 9 HOW MANY SHALL I REVERSE? 2 7 6 1 5 4 3 2 8 9 HOW MANY SHALL I REVERSE? 7 2 3 4 5 1 6 7 8 9 HOW MANY SHALL I REVERSE? 4 5 4 3 2 1 6 7 8 9 HOW MANY SHALL I REVERSE? 5 1 2 3 4 5 6 7 8 9 YOU HAVE WON IT IN 11 MOVES !!! *** Another new game from Creative Computing.... SCHMOO by Frederick H. Bell University of Pittsburgh Computers, Coordinates, and Schmoos This Module is a computer-based educational (and fun) game with instructions for its use. It is written in elementary BASIC and is compatible with nearly all BASIC interpreters. Getting Ready Before teaching this lesson load SPLAT2 into your computer system, debug it, and save it for future access. Things to Know You need to know a little bit about grids and angles. Like, (2,-3) means right 2 and down 3, and 237° is in the fourth (Whoops! That's third.) quadrant. Also, you should remember that the distance something travels through the air depends upon the angle at which it is thrown. Review the Basics Can you answer these questions? If not, hit the math books! 1. In each of the four quadrants, what are the signs of the x- and Y- coordinates? 2. If 0° is the angle coinciding with the positive x- axis, what are the measures of angles whose terminal sides fail in Quadrant I? Quadrant II? Quadrant III, Quadrant IV? Lines 5 to 70 explain how to play SPLAT2. This is a fun game to play in groups of two or three. If you're pretty good you can "splat the schmoo" in about eight tries; but don't cheat and use the formula. And don't expect me to tell you where it's hidden in the program! More Things to Do You might want to make a three dimensional game, SPLAT3 - with flying schmoos. The program shouldn't be too hard and it would be a really neat game. If you want to try something easier, fix SPLAT2 so that it requires initial velocities as well as angles. You could even make a low gravity, moon version of SPLAT2. [image]Program Listing Sample Output *** REMarks About BASIC REMark Statements REMember to REMind yourself when writing BASIC REMark statements to REMain imaginative. If you are not REMiss in this, you can REModel your programs into REMarkable masterpieces with no REMainder of your REMote past before you applied this REMedy and REMoved those old, dull REMark statements. REMit to this REMedial advice and you'll have no REMorse. Before long, you can be REMiniscent about your old programs containing REMinants of ordinary REMark statements. 10 REMARKABLE REMARKS BY DHA *** 259