------------------------------------------------------------"Show and Tell Memory Game" from Aug/Sept, 1989------------------------------------------------------------ I read an interesting article in the newspaper the otherday. It said that three things happen more frequently as wegrow older. The first was that we tend to forget things. Iforget what the other two were. And, as old as that jokeis, it does introduce this month's program nicely. "Showand Tell" is a simple game that exercises your memoryskills. Do you need an easy-to-use and entertaining programthat will give your short-term memory skills a littleexercise? Then, read on! The premise for "Show and Tell" is quite simple. You willbe shown the answers to nine questions for a few seconds andallowed to memorize their position on the screen. Then, aseach question is asked, you must remember the position ofthe correct answer. What could be easier? Not only doesthis game help you improve your memory, but it also providessome very entertaining moments. Some of the incorrectcombinations of questions and answers can be very funny. Three Reasons ------------- Those of you who have been reading ONE THOUSAND Magazinefrom the very beginning might recognize this program. Infact, it has appeared before -- in the October, 1986 issueto be exact. But I am reprinting this dressed up version(with my apologies for those of you who already have it) fora variety of reasons. I got my Tandy 1000 about four years ago, and started doingwhat I enjoy most -- writing BASIC programs to entertainmyself. Back in mid-1986, I sent a few of those programsinto ONE THOUSAND magazine, hoping that they would bepublished. After seeing those programs, OTM's editor JeffThurston twisted my arm and talked me into writing for hisfledgling magazine. I agreed, and started writing a columncalled DOWN TO BASIC. One of those early pre-DTB submissions was a game I called"Show and Tell". It was printed with a few paragraphs ofexplanation later that year, and quickly forgotten. That isthe first reason for re-printing this program: I think it isa lot of fun, and since we have signed up so many newreaders since then, I wanted to share it with them. Just a few days ago, Jeff told me that due to changes in theproduction schedule, he needed a new column from me -- andthat he needed it in the next three days! At first, I didnot know what to do, but then I remembered "Show and Tell".That is the second reason for using it again: I did not havetime to write a new program from scratch, but there wasenough time to dress up the old version, remove a few bugs,and write a new column to accompany it. I enjoy hearing from readers, via both regular mail andelectronic mail on the national telecomputing services thatwe participate in. I have been trying to think of some wayto encourage reader involvement for a long time, and I justrealized that "Show and Tell" presents a wonderfulopportunity. That is the third reason for re-using thisprogram: to encourage you to get involved, I will beannouncing a contest at the end of this column based on"Show and Tell". Sorry, I cannot offer any expensiveprizes, but you could win a copy of "The Best of DOWN TOBASIC" Volumes I and II! Rules of the Game ----------------- How is the game played? You will first see a title page anda short summary of game rules. When you "press any key tobegin the game", you will see nine numbered answers. Theywill only stay on the screen for a few seconds, so try tomemorize their position. Very soon, the answers willdisappear, and a question will appear in an area on thebottom of the screen. Try to remember the NUMBER of thecorrect answer; type it and the answer associated with thatnumber will appear. If it is correct, you will not have toanswer that one again. It it is wrong, then you will getanother chance to answer it correctly later. The game continues until you have correctly answered allnine questions. You can end the game prematurely bypressing the ESC key. At the end of each game, the programwill present your score. Of course, going "9 for 9" is asgood as you can get; congratulations! If you take anythingless than about 12 tries to answer all 9 questions, you didvery well! If it took more than 12 tries, you need morepractice. When the program asks if you want to play again,you had better say "YES". The game as shown in Listing 1 contains four different setsof questions and answers, and you will never know which setwill turn up next. But just becoming familiar with all foursets of questions and answers will not help that much; everytime you play the game, the position of the answers on thescreen and the order in which the questions are asked willchange. As a result, "Show and Tell" will continue topresent a challenge for many months to come. Programming Details ------------------- Some of you are probably interested in how the programworks, so let's take a closer look at Listing 1. I have notmentioned one key feature of the program yet, but it willsupport much more than just four sets of questions andanswers. You can add many more sets of data easily (moredetails in a moment). But how does the program know howmany sets of data are down there waiting to be used? Theloop from lines 180 through 210 does that counting. Thereare nineteen elements in a question-and-answer data set, soline 190 reads as many elements as it can find, countingthem in variable NS. When no more elements can be found, anerror occurs in line 190, and the ON ERROR statement of line180 sends the program to line 200. NS is divided by 19 inline 210, so that NS now represents the number of data sets. The defined function FNR(X) in line 220 simply returns arandom integer between 1 and X. Lines 260 through 340present the title page and the instructions. Line 350 waitsfor any key to pressed. One of the available data sets isread in lines 390 through 410. The first line of thequestions is read into variable T$. The nine questions andanswers are read into array variables Q$ and A$. Line 410scrambles their order, using the SWAP command. The answersare displayed by lines 450 through 490. The answers stay on the screen for PAUSE seconds. PAUSE isinitially set at 5. If you need more time to study theanswers, change the statement PAUSE = 5 in line number 530to something larger. If you want a real challenge, changeit to read PAUSE = 3 or something even smaller. The answersare erased in lines 540 and 550. Lines 570 and 580 scramblethe order of the questions. A question is presented and your answer is accepted in lines620 through 680. The corresponding answer is displayed inlines 690 through 710. Lines 750 through 800 take care ofthe situation when your answer is wrong. Lines 840 through860 congratulate you when the answer is right. When allnine questions have been successfully answered, lines 900through 950 present the final score and offer theopportunity to play the game again. The rest of the program following line 960 is devoted to thequestion and answer data sets. Look at the format of thoselines. The first line (like line 990) contains the firstline of a two line question. Line 990 contains the phrase"Where do you". Other data sets might contain lines like"When do you", "What do you get", "Who is", "Why would you",and so on. The other nine lines in each data set (likelines 1000 through 1080) contain the second line of aquestion and its answer. For example, the first line "Wheredo you" combined with the second line "go to sleep" fromline 1000 is correctly answered "in your bed". Type in the "Show and Tell" program and enjoy it. I cannotguarantee that it will improve your memory, but you mightget a laugh or two out of some of your answers. Why, justthis morning, I discovered that Princess Diana was theheavyweight boxing champ, that meatballs serve as good fishbait, that I should change the oil in my car every time thephone rings! Contest Rules ------------- And now for the special contest -- just for those of you whoare seeing this in "The Best of DOWN TO BASIC, Volume III".I would love to see the question and answer data sets youhave created. So, I will send a disk copy of "The Best ofDOWN TO BASIC", Volumes I and II, to the author of the best"Show and Tell" questions and answers. I think everybodysees how simple it is to construct them. You must writenine pairs of questions and answers. All nine of thequestions must start with the same phrase, something like"Where do you", "What do you", "When do you", or whatever. The correct answer to each question should be obvious. Allthe answers should be similar; in any one set, they shouldall be things, or actions, or people, or places, or whateveris appropriate. You must make sure that each answersatisfies one and only one question, and vice versa. Thatis, make sure that there are not two answers that would workequally well with any one question. You will get extrapoints if your pairs lead to really funny combinations. To add your questions and answers to the program, follow thelead established in lines 990 through 1080. Start with anew line number, say 1500; enter your first-half question,and surround it in quotation marks. Then add line numbers1510 through 1590, with the second half of each question andits answer. Each question and answer in a DATA statementmust be enclosed in quotation marks, too. You can enter as many data sets in the contest as you wish.Just use LLIST 1500-1590 (or whatever) to print yourquestions and answers on paper, or write them down by handon a piece of paper. Send them to me in care of ONETHOUSAND at the address found in the front of the magazine.If you sign onto SUMMIT, then you can send your entry to mevia E-MAIL; send it to "RANDYH". If you sign onto PC-Link,send your entry to "OTMagRandy". Deadline for entries will be December 31, 1990. I willannounce the winner in this column and print some of thebest entries. I will also prepare a super-duper version of"Show and Tell" with ALL of your entries in it, and donateit to the Grandy Software Library (GSL). I look forward tohearing from you. See you next month!