Ranger03 Posted July 10, 2018 Share Posted July 10, 2018 Hello. i am making a short program that quizzes kids on the bible. ran into an issue: the answer is bunched up so instead of "The Earth" it comes out as TheEarth which is annoying. also, how do i separate good and bad answers (I.E that's wrong, try again or that's right next answer) this is a simple program, just need these two problems sorted out (Yes i am a proud christian, mock me if you will) Quote Link to comment Share on other sites More sharing options...
+OLD CS1 Posted July 11, 2018 Share Posted July 11, 2018 (Yes i am a proud christian, mock me if you will) Generally no one cares, but you do invite that kind of abuse with statements like this and makes it seem like you enjoy being mocked. ANYWAY, I am interested in neither discussing nor debating that point. It would be helpful to see parts of your program which are giving you problems. Otherwise your problem description is vague and could have many different solutions, none of which directly address your specific issue. Quote Link to comment Share on other sites More sharing options...
monzamess Posted July 11, 2018 Share Posted July 11, 2018 I assume you're using the built-in BASIC language? Can you post what you have so far? I would guess you need to study how to read and compare string variables. Some pages that might help: http://www.lemon64.com/forum/viewtopic.php?t=44907&sid=842c9725abb7a8de8765196b4b44f3fd http://retro64.altervista.org/blog/very-basic-basic-simple-tips-for-entering-strings-with-input-commodore-64-basic/ http://retro.lonningdal.net/home.php?page=Adventure&part=100 Quote Link to comment Share on other sites More sharing options...
Ranger03 Posted July 11, 2018 Author Share Posted July 11, 2018 10 print "in the beginning god created the" 15 dim a$(10) 20 print "earth" 30 print "peanut" 40 print "chestnut" 50 print "casserole" 60 input a$ 70 print "god created the";a$ (it comes out bunched together) 80 print a$ god created the theearth Quote Link to comment Share on other sites More sharing options...
+OLD CS1 Posted July 11, 2018 Share Posted July 11, 2018 70 print "god created the ";a$ Put a space between "the" and the quote, as above. The semicolon concatenates without adding a space. Quote Link to comment Share on other sites More sharing options...
thetick1 Posted July 11, 2018 Share Posted July 11, 2018 (edited) Actually you have a bunch of issues. 1) God created .. not god. Try using upper case. 2) CHR$(13) is the return character so use the first line below if want next line or use a space at end of quotes like the second line if you want a space. 70 print "God created the";CHR$(13);a$ 70 print "God created the ";a$ 3) Use simple IF string checks like shown at https://www.c64-wiki.com/wiki/RETURN_(Key) 4) Learn to use Google search... sorry to sound condescending but you should easily find simple examples for the above. and finally your question is just plain wrong. The correct answer is Everything... The Genesis origin is obviously an overly simplified story of the Big Bang , Solar System creation and evolution dumbed down to the knowledge level of the people thousands of years ago. Adam and Even is a story of mankind becoming conscious. Cain and Able is the story of man experiencing civilization. The tower of Babel explained different languages .. etc and on and on. The point is if you really are Christian only the belief in the Savior matters. Genesis is just a bunch of dumb down explanations for ancient people since their understanding of science was extremely primitive. Edited July 11, 2018 by thetick1 Quote Link to comment Share on other sites More sharing options...
+OLD CS1 Posted July 11, 2018 Share Posted July 11, 2018 You assume he is not using the default CBM character mode in which all characters are capitals. Quote Link to comment Share on other sites More sharing options...
Ranger03 Posted July 11, 2018 Author Share Posted July 11, 2018 Actually you have a bunch of issues. 1) God created .. not god. Try using upper case. 2) CHR$(13) is the return character so use the first line below if want next line or use a space at end of quotes like the second line if you want a space. 70 print "God created the";CHR$(13);a$ 70 print "God created the ";a$ 3) Use simple IF string checks like shown at https://www.c64-wiki.com/wiki/RETURN_(Key) 4) Learn to use Google search... sorry to sound condescending but you should easily find simple examples for the above. and finally your question is just plain wrong. The correct answer is Everything... The Genesis origin is obviously an overly simplified story of the Big Bang , Solar System creation and evolution dumbed down to the knowledge level of the people thousands of years ago. Adam and Even is a story of mankind becoming conscious. Cain and Able is the story of man experiencing civilization. The tower of Babel explained different languages .. etc and on and on. The point is if you really are Christian only the belief in the Savior matters. Genesis is just a bunch of dumb down explanations for ancient people since their understanding of science was extremely primitive. ... agreed Quote Link to comment Share on other sites More sharing options...
carlsson Posted July 11, 2018 Share Posted July 11, 2018 I would define a data structure. Something like this: 10 read q$:if q$="@@" then end 15 read c,a$(1),a$(2),a$(3),a$(4) 20 print chr$(147);q$:for i=1 to 4:print i;". ";a$(i):next 25 get u$:if u$<"1" or u$>"4" then 25 30 u=val(u$) 35 if u<>c then print"wrong answer! try again!":poke 198,0:wait 198,1:goto 20 40 print"correct answer!":poke 198,0:wait 198,1:goto 10 100 data"in the beginning god created the",1 105 data"earth","peanut","chestnut","casserole" 110 data"moses divided the",3 115 data"fishes","whole numbers","red sea","piles of sand" 120 data "@@" 1 Quote Link to comment Share on other sites More sharing options...
thetick1 Posted July 11, 2018 Share Posted July 11, 2018 Ha Carlsson .. guess you still program in Commodore BASIC. It was the first programing I learned about 40 years ago and have not used much since .. other than LOAD"$",8,1. I need to get some sleep as I have some bash and java to work on tomorrow at work. Quote Link to comment Share on other sites More sharing options...
carlsson Posted July 11, 2018 Share Posted July 11, 2018 (edited) Not very often, though obviously I still know the syntax and how to use it. In a lot of ways, a quiz program is similar to a text adventure. Both could be worked out with countless rows of PRINT statements which allows for very dynamic gameplay but is extremely tedious and hard to maintain. Both can also be driven by an engine and data structures like those DATA statements, which puts more rules and rigidness to it, but makes shorter and easier to follow code. A certain amount of dynamic can be wedged into the program anyway, though for the Bible multiple choice quiz perhaps not so much dynamic is required. Then again I think there are modern, better tools for setting up quizzes than using a C64 if the goal is not so much the programming challenge, but to get a useful application that will apply to kids in a Bible study group. (Personally I am of the faith that evolution is one big machine controlled by God pushing buttons every now and then to have evolution have its go, a bit like how someone would play The Sims. In that faith, both evolution and religion can co-exist, and God uses evolution as a tool to make things happen instead of directly creating or removing things like setting breakpoints into The Sims and change memory content with a monitor program. Besides it says that God created Human in His own image, and since humans by nature are lazy, it should mean that God also doesn't work more than absolutely required, which is where the evolution machine comes in handy as it does most of the dull work for God) Edited July 11, 2018 by carlsson Quote Link to comment Share on other sites More sharing options...
youxia Posted July 11, 2018 Share Posted July 11, 2018 One of the things I love about this forum is the politics/religion ban. Just sayin'... 1 Quote Link to comment Share on other sites More sharing options...
+OLD CS1 Posted July 11, 2018 Share Posted July 11, 2018 One of the things I love about this forum is the politics/religion ban. Just sayin'... | Just like any dinner with family unless you want the house burned down. Quote Link to comment Share on other sites More sharing options...
Ranger03 Posted July 11, 2018 Author Share Posted July 11, 2018 One of the things I love about this forum is the politics/religion ban. Just sayin'... | it's not a discussion, it's a program. i do not wish to attract the wrong crowd. Quote Link to comment Share on other sites More sharing options...
Ranger03 Posted July 12, 2018 Author Share Posted July 12, 2018 Not very often, though obviously I still know the syntax and how to use it. In a lot of ways, a quiz program is similar to a text adventure. Both could be worked out with countless rows of PRINT statements which allows for very dynamic gameplay but is extremely tedious and hard to maintain. Both can also be driven by an engine and data structures like those DATA statements, which puts more rules and rigidness to it, but makes shorter and easier to follow code. A certain amount of dynamic can be wedged into the program anyway, though for the Bible multiple choice quiz perhaps not so much dynamic is required. Then again I think there are modern, better tools for setting up quizzes than using a C64 if the goal is not so much the programming challenge, but to get a useful application that will apply to kids in a Bible study group. (Personally I am of the faith that evolution is one big machine controlled by God pushing buttons every now and then to have evolution have its go, a bit like how someone would play The Sims. In that faith, both evolution and religion can co-exist, and God uses evolution as a tool to make things happen instead of directly creating or removing things like setting breakpoints into The Sims and change memory content with a monitor program. Besides it says that God created Human in His own image, and since humans by nature are lazy, it should mean that God also doesn't work more than absolutely required, which is where the evolution machine comes in handy as it does most of the dull work for God) can we...not start a debate? Quote Link to comment Share on other sites More sharing options...
Ranger03 Posted July 12, 2018 Author Share Posted July 12, 2018 I would define a data structure. Something like this: 10 read q$:if q$="@@" then end 15 read c,a$(1),a$(2),a$(3),a$(4) 20 print chr$(147);q$:for i=1 to 4:print i;". ";a$(i):next 25 get u$:if u$<"1" or u$>"4" then 25 30 u=val(u$) 35 if u<>c then print"wrong answer! try again!":poke 198,0:wait 198,1:goto 20 40 print"correct answer!":poke 198,0:wait 198,1:goto 10 100 data"in the beginning god created the",1 105 data"earth","peanut","chestnut","casserole" 110 data"moses divided the",3 115 data"fishes","whole numbers","red sea","piles of sand" 120 data "@@" could i filter out the pokes and still have a running program? Quote Link to comment Share on other sites More sharing options...
carlsson Posted July 12, 2018 Share Posted July 12, 2018 (edited) Why would you omit the POKEs? Actually that is a space saving way to wait for a keypress. The POKE clears the keyboard buffer, the WAIT runs a busy loop waiting for any key to be pressed. Without clearing the keyboard buffer, the WAIT will pick up any remaining keypresses in the buffer which will make it not behave as intended. You can replace it with an extra line: 45 GET K$:IF K$="" THEN GOTO 45 However in the case of line 35, you already are inside an IF statement so it would need to break out into a subroutine or some form of spaghetti code to run another IF statement inside of it. Also if you're really getting into C64 programming, POKE will be one of your best friends so better get acquinted early on. Edited July 12, 2018 by carlsson Quote Link to comment Share on other sites More sharing options...
RobertB Posted July 12, 2018 Share Posted July 12, 2018 Hello. i am making a short program that quizzes kids on the bible. Oh, the editor of our club newsletter collects Bible programs. If you finish yours, could he have a copy of it to add to his collection? Truly, Robert Bernardo Fresno Commodore User Group - www.dickestel.com/fcug.htm Southern California Commodore & Amiga Network - www.portcommodore.com/sccan August 11-12 Commodore Vegas Expo v14 2018 - www.portcommodore.com/commvex Quote Link to comment Share on other sites More sharing options...
+OLD CS1 Posted July 13, 2018 Share Posted July 13, 2018 Why would you omit the POKEs? Actually that is a space saving way to wait for a keypress. The POKE clears the keyboard buffer, the WAIT runs a busy loop waiting for any key to be pressed. Without clearing the keyboard buffer, the WAIT will pick up any remaining keypresses in the buffer which will make it not behave as intended. You can replace it with an extra line: 45 GET K$:IF K$="" THEN GOTO 45 However in the case of line 35, you already are inside an IF statement so it would need to break out into a subroutine or some form of spaghetti code to run another IF statement inside of it. Also if you're really getting into C64 programming, POKE will be one of your best friends so better get acquinted early on. True statement and pretty neat convention. I never once programmed a such a wait-for-keypress loop -- the program did other things while waiting -- but that is a pretty cool trick. Under-rated tool, WAIT. Quote Link to comment Share on other sites More sharing options...
carlsson Posted July 13, 2018 Share Posted July 13, 2018 Yes, since WAIT will monitor any memory address for a change of value or even a particular value, it can be used for all sorts of inputs like keyboard, joystick and other I/O, but also other sources for a memory address to change, like an internal timer or other changes that may happen during interrupt. By the way, if you would define additional arrays you could read all the questions and answers into those and randomize the order, which I leave as an exercise to the user. There also is a pointer to the next DATA statement at address 65-66 that one can alter to read data in a non-sequential way or simulate the RESTORE lineno syntax otherwise not present, but it isn't entirely straightforward to use so not relevant in the beginner's course. Memory map: http://sta.c64.org/cbm64mem.html Quote Link to comment Share on other sites More sharing options...
Casey Posted July 13, 2018 Share Posted July 13, 2018 One thing noticed: line 15 creates an array of 11 string variables all named A$. I’m not sure if that was your intent, or if you were expecting A$ to be 10 characters long. Most BASICs create arrays of string variables with that syntax. Others (like Atari BASIC) use DIM to define the maximum length of the string variable. That may be causing you some headache also. Quote Link to comment Share on other sites More sharing options...
carlsson Posted July 13, 2018 Share Posted July 13, 2018 ZX Spectrum BASIC also uses DIM to determine maximum length of a string. Quote Link to comment Share on other sites More sharing options...
Ranger03 Posted July 13, 2018 Author Share Posted July 13, 2018 Oh, the editor of our club newsletter collects Bible programs. If you finish yours, could he have a copy of it to add to his collection? Truly, Robert Bernardo Fresno Commodore User Group - www.dickestel.com/fcug.htm Southern California Commodore & Amiga Network - www.portcommodore.com/sccan August 11-12 Commodore Vegas Expo v14 2018 - www.portcommodore.com/commve i could email a snapshot possibly. can he open .vsf files? Quote Link to comment Share on other sites More sharing options...
RobertB Posted July 13, 2018 Share Posted July 13, 2018 (edited) i could email a snapshot possibly. can he open .vsf files? Hmm, I don't know. What can he use to read such a file? Truly, Robert Bernardo Fresno Commodore User Group - www.dickestel.com/fcug.htm Southern California Commodore & Amiga Network - www.portcommodore.com/sccan August 11-12 Commodore Vegas Expo v14 2018 - http://www.portcommodore.com/commvex Edited July 13, 2018 by RobertB Quote Link to comment Share on other sites More sharing options...
Ranger03 Posted July 13, 2018 Author Share Posted July 13, 2018 got an error in 82 full code sin love anger parental control ? anger ?syntax error in 82 ready. 82 if inkey$=" love" print "wrong" 83 if inkey$=" parental control" goto 81 84 if inkey$="anger" goto 81 run in roman's, paul says we are free from w hat? sin love anger parental control ? anger i had decided to use the inkey$ command but that leads to an error in 82 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.