Author |
Message |
bc123
|
Posted: Thu Oct 15, 2009 2:52 pm Post subject: How to make A question and answer game? |
|
|
Hey i wanted to do something when i make it say What is my name and then some one has to answer corectly to say corect and if wrong then say incorrect.
I am totaly new to turing im starting to learn in school and i want to atleast kno this. All i kno is like
% blablabla is comments
and put and get but im not too sure like how to use them like with int and everything plzz help! and 1 more thing i wanted to kno how to get back to main like screen so i dont have to close the turing thing and click run again. TY
also i dont want some 1 to give me the code and say here you go did it for you... if you can plz try to explain like i tried to do
%Brandon
% october 15 2009
var 1 = int
put "Hello! "
put "Answer the questions corectly "
get
im totaly lost and dont think this makes sense whatsoever so plz help! |
|
|
|
|
|
Sponsor Sponsor
|
|
|
andrew.
|
Posted: Thu Oct 15, 2009 3:06 pm Post subject: RE:How to make A question and answer game? |
|
|
Okay, well here is a summary of different functions:
put - you can write stuff to the screen
get - you can get input from the user (this includes strings, ints, etc.)
int - an integer type. It holds only non-decimal numbers
loop - you can have certain parts of your code loop around until some kind of condition is met (in your case, they guess the right age)
If you need more help with the functions, look them up in the Turing help (press F10 in Turing) and then write out (in plain English) every step it will take to do this. Then you can easily turn that into Turing code. |
|
|
|
|
|
bc123
|
Posted: Thu Oct 15, 2009 3:10 pm Post subject: RE:How to make A question and answer game? |
|
|
still confused :S sorry |
|
|
|
|
|
S_Grimm
|
Posted: Thu Oct 15, 2009 3:13 pm Post subject: RE:How to make A question and answer game? |
|
|
if (statement)
else (statement)
those two will enable you to make a Q&A game |
|
|
|
|
|
bc123
|
Posted: Thu Oct 15, 2009 3:17 pm Post subject: RE:How to make A question and answer game? |
|
|
what exactly you mean by statements? var? |
|
|
|
|
|
S_Grimm
|
Posted: Thu Oct 15, 2009 3:38 pm Post subject: Re: How to make A question and answer game? |
|
|
for example
Turing: |
put "Input a number"
int i
get i
if (i = 1) then
put "you inputed 1"
end if
if (i = 2) then
...
|
|
|
|
|
|
|
ecookman
|
Posted: Thu Oct 15, 2009 3:46 pm Post subject: Re: How to make A question and answer game? |
|
|
statements are lines...in lack of a better term...do something or declare something
var creates a variable
anything after var is the variable the : says that that variable is this...either a string (text) or Boolean (true, false 1, 0), or a integer.
Basically you need a bunch of if, else, and get statements.
Here is a example. Please tell me how it works and fill in the blanks (remove the _____). (comment the code)
Turing: |
locate (1, 15)
put "Q and A game"
var n : string
locate (3, 5)
put "SAY MY NAME"
get n
if n = "_____" then
put ___________
_______
put "wtf bbq...no"
end _____
|
|
|
|
|
|
|
bc123
|
Posted: Thu Oct 15, 2009 3:51 pm Post subject: RE:How to make A question and answer game? |
|
|
TY SO MUCH wut does locate do? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
ecookman
|
Posted: Thu Oct 15, 2009 3:53 pm Post subject: Re: RE:How to make A question and answer game? |
|
|
bc123 @ Thu Oct 15, 2009 3:51 pm wrote: TY SO MUCH wut does locate do?
notice how the text isn't at thr right side of the page and a little down
locate tells the text where to be put
also could you tell me how the code works so you are not copying it. |
|
|
|
|
|
bc123
|
Posted: Thu Oct 15, 2009 3:58 pm Post subject: RE:How to make A question and answer game? |
|
|
ok
i re typed it
put "Question and Answer Game"
var n : string
put "What is my name?"
get n
if n = "brandon" then
put "correct"
else
put "wrong"
end if
put is puting out like a comment but visual (no code_
the variable im not too sure about also nto too sure about the string
from what i understand get n is getting the variable and saying if n = my name theh (type correct of w/e) else meaning if it is sumthing else type "error" and the end if is ending the if statement |
|
|
|
|
|
bc123
|
Posted: Thu Oct 15, 2009 4:00 pm Post subject: RE:How to make A question and answer game? |
|
|
wait does the string replace puting int? |
|
|
|
|
|
S_Grimm
|
Posted: Thu Oct 15, 2009 4:01 pm Post subject: RE:How to make A question and answer game? |
|
|
Turing: | if (n = "brandon") then |
yes, string replaces int |
|
|
|
|
|
bc123
|
Posted: Thu Oct 15, 2009 4:03 pm Post subject: Re: How to make A question and answer game? |
|
|
AV @ Thu Oct 15, 2009 3:38 pm wrote: for example
Turing: |
put "Input a number"
int i
get i
if (i = 1) then
put "you inputed 1"
end if
if (i = 2) then
...
|
i couldnt get this to work it sayd 2 errors |
|
|
|
|
|
S_Grimm
|
Posted: Thu Oct 15, 2009 4:05 pm Post subject: RE:How to make A question and answer game? |
|
|
well, I havent coded turing in almost forever so i forgot the following:
not
also that is not a complete program.
remove the
code: |
if (i = 2) then
...
|
|
|
|
|
|
|
bc123
|
Posted: Thu Oct 15, 2009 4:06 pm Post subject: RE:How to make A question and answer game? |
|
|
ok i amd goin to make a quick game hopefully it will workout and ill send to you if youd like but theres gunna be about 20 questions XD or 15 |
|
|
|
|
|
|