Quote from: BaconShelf on November 02, 2014, 05:32:20 PMQuote from: Cheat on November 02, 2014, 05:29:45 PMQuote from: BaconShelf on November 02, 2014, 05:16:01 PMMy advice would be define each question/ answer and the input/ output of such as a function, then give that function a number variable (IE question==1)Then use a random module to choose a random number between the amount of numbers you assigned and it then run that function. Or use a list and use the random to select which place in the list it should look, then removing that number from the list.You could also import a file for questions and a file for answers, and have the matching pair on the same line. That would make it easier to edit them without recompiling the code.I'm going off what I know for python, which unfortunately cannot import other files. I just write functions (Or is it modules? I get confused) and then recall them later. It's the next best thing.Pretty sure you can read an external file in Java.
Quote from: Cheat on November 02, 2014, 05:29:45 PMQuote from: BaconShelf on November 02, 2014, 05:16:01 PMMy advice would be define each question/ answer and the input/ output of such as a function, then give that function a number variable (IE question==1)Then use a random module to choose a random number between the amount of numbers you assigned and it then run that function. Or use a list and use the random to select which place in the list it should look, then removing that number from the list.You could also import a file for questions and a file for answers, and have the matching pair on the same line. That would make it easier to edit them without recompiling the code.I'm going off what I know for python, which unfortunately cannot import other files. I just write functions (Or is it modules? I get confused) and then recall them later. It's the next best thing.
Quote from: BaconShelf on November 02, 2014, 05:16:01 PMMy advice would be define each question/ answer and the input/ output of such as a function, then give that function a number variable (IE question==1)Then use a random module to choose a random number between the amount of numbers you assigned and it then run that function. Or use a list and use the random to select which place in the list it should look, then removing that number from the list.You could also import a file for questions and a file for answers, and have the matching pair on the same line. That would make it easier to edit them without recompiling the code.
My advice would be define each question/ answer and the input/ output of such as a function, then give that function a number variable (IE question==1)Then use a random module to choose a random number between the amount of numbers you assigned and it then run that function. Or use a list and use the random to select which place in the list it should look, then removing that number from the list.
Quote from: Gasai Yuno on November 02, 2014, 05:20:51 PMQuote from: BaconShelf on November 02, 2014, 05:16:01 PMMy advice would be define each question/ answer and the input/ output of such as a function, then give that function a number variable (IE question==1)Then use a random module to choose a random number between the amount of numbers you assigned and it then run that function. Or use a list and use the random to select which place in the list it should look, then removing that number from the list.So (I use python so it would have to be tweaked a bit)def q1(): *question 1 function*def q2(): *question 2 function*q1=1q2=2list[1,2]a=rand.number(0,1)list[a]I hope that made senseomg watI edited the last part because it made no sense.Essentially, write the question as a function, so it can be called later.def q1(): *question and answer input and shit*def q2(): *same as above*Then put those into a list list[q1,q2]Then use a random number (In this case 0 or 1) and assign it to a variableA=rand.number(0,1)Then use A in the list to recall that function and run it.list[a]When I'm on a computer tomorrow I'll write a basic one in python for you to look at if you like. It's kind of hard to explain.
Quote from: BaconShelf on November 02, 2014, 05:16:01 PMMy advice would be define each question/ answer and the input/ output of such as a function, then give that function a number variable (IE question==1)Then use a random module to choose a random number between the amount of numbers you assigned and it then run that function. Or use a list and use the random to select which place in the list it should look, then removing that number from the list.So (I use python so it would have to be tweaked a bit)def q1(): *question 1 function*def q2(): *question 2 function*q1=1q2=2list[1,2]a=rand.number(0,1)list[a]I hope that made senseomg wat
My advice would be define each question/ answer and the input/ output of such as a function, then give that function a number variable (IE question==1)Then use a random module to choose a random number between the amount of numbers you assigned and it then run that function. Or use a list and use the random to select which place in the list it should look, then removing that number from the list.So (I use python so it would have to be tweaked a bit)def q1(): *question 1 function*def q2(): *question 2 function*q1=1q2=2list[1,2]a=rand.number(0,1)list[a]I hope that made sense
Quote from: BaconShelf on November 02, 2014, 05:24:36 PMQuote from: Gasai Yuno on November 02, 2014, 05:20:51 PMQuote from: BaconShelf on November 02, 2014, 05:16:01 PMMy advice would be define each question/ answer and the input/ output of such as a function, then give that function a number variable (IE question==1)Then use a random module to choose a random number between the amount of numbers you assigned and it then run that function. Or use a list and use the random to select which place in the list it should look, then removing that number from the list.So (I use python so it would have to be tweaked a bit)def q1(): *question 1 function*def q2(): *question 2 function*q1=1q2=2list[1,2]a=rand.number(0,1)list[a]I hope that made senseomg watI edited the last part because it made no sense.Essentially, write the question as a function, so it can be called later.def q1(): *question and answer input and shit*def q2(): *same as above*Then put those into a list list[q1,q2]Then use a random number (In this case 0 or 1) and assign it to a variableA=rand.number(0,1)Then use A in the list to recall that function and run it.list[a]When I'm on a computer tomorrow I'll write a basic one in python for you to look at if you like. It's kind of hard to explain.The assignment is due today :/I'm close to finishing it, but I'm stumped at how to make words into answers.
Quote from: Gasai Yuno on November 02, 2014, 05:36:52 PMQuote from: BaconShelf on November 02, 2014, 05:24:36 PMQuote from: Gasai Yuno on November 02, 2014, 05:20:51 PMQuote from: BaconShelf on November 02, 2014, 05:16:01 PMMy advice would be define each question/ answer and the input/ output of such as a function, then give that function a number variable (IE question==1)Then use a random module to choose a random number between the amount of numbers you assigned and it then run that function. Or use a list and use the random to select which place in the list it should look, then removing that number from the list.So (I use python so it would have to be tweaked a bit)def q1(): *question 1 function*def q2(): *question 2 function*q1=1q2=2list[1,2]a=rand.number(0,1)list[a]I hope that made senseomg watI edited the last part because it made no sense.Essentially, write the question as a function, so it can be called later.def q1(): *question and answer input and shit*def q2(): *same as above*Then put those into a list list[q1,q2]Then use a random number (In this case 0 or 1) and assign it to a variableA=rand.number(0,1)Then use A in the list to recall that function and run it.list[a]When I'm on a computer tomorrow I'll write a basic one in python for you to look at if you like. It's kind of hard to explain.The assignment is due today :/I'm close to finishing it, but I'm stumped at how to make words into answers.What do you mean?
Quote from: BaconShelf on November 02, 2014, 05:38:04 PMQuote from: Gasai Yuno on November 02, 2014, 05:36:52 PMQuote from: BaconShelf on November 02, 2014, 05:24:36 PMQuote from: Gasai Yuno on November 02, 2014, 05:20:51 PMQuote from: BaconShelf on November 02, 2014, 05:16:01 PMMy advice would be define each question/ answer and the input/ output of such as a function, then give that function a number variable (IE question==1)Then use a random module to choose a random number between the amount of numbers you assigned and it then run that function. Or use a list and use the random to select which place in the list it should look, then removing that number from the list.So (I use python so it would have to be tweaked a bit)def q1(): *question 1 function*def q2(): *question 2 function*q1=1q2=2list[1,2]a=rand.number(0,1)list[a]I hope that made senseomg watI edited the last part because it made no sense.Essentially, write the question as a function, so it can be called later.def q1(): *question and answer input and shit*def q2(): *same as above*Then put those into a list list[q1,q2]Then use a random number (In this case 0 or 1) and assign it to a variableA=rand.number(0,1)Then use A in the list to recall that function and run it.list[a]When I'm on a computer tomorrow I'll write a basic one in python for you to look at if you like. It's kind of hard to explain.The assignment is due today :/I'm close to finishing it, but I'm stumped at how to make words into answers.What do you mean?Question: What class are you going to play?Answers : Hunter, Faggot, WhorelockHave user input one of those choices to be correct. String variables and stuff