11-29-2018 09:19 PM - edited 11-29-2018 09:35 PM
Hi, as part of a school project, I've been developing this simple arithmetic question generator (for small kids, like really small). It uses random to generate two values between 1-9 and another random is connected to a ring which has the operations Addition/Subtraction/Multiplication (to display), and the value is also connected to a case structure that lets the VI know which operation to check for with number 1 and 2. Each time user enters a value in the answer field and presses the button Check Answer, the current answer should be checked with the result of the actual operation of [random number 1] [random operation] [random number 2], and if it is correct, Point value gets incremented by 1, and numbers randomized again. If incorrect, point value stays same but numbers are randomized anyway.
In my case, all the values generate fine, the only issue is point doesn't get incremented for some reason. I've tried rearranging everything a few times, and now I've noticed I get a point if the answer currently typed in the field, by an odd stroke of luck, accidentally matches up with the correct value for the new numbers and operations generated when clicking Check Answer (The NEXT question). This is currently more a program to test for precognition than arithmetic ability If anybody could look over as to why, it'd be great, thanks!
11-29-2018 09:30 PM
Please include a Snippet of your code, I don't have your version of LabVIEW.
It sounds like you might have an issue with your dataflow. The Highlight Execution feature is a great way to watch how your application utilizes dataflow.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
11-29-2018 09:33 PM
Alright, adding it to the initial post now 🙂
11-30-2018 12:30 AM
Hmm, interesting application!
To quickly fix your problem, you can remove the Feedback Node (this is what's causing the precognition test) and use a local variable for Op as the input to the case structure.
A more reliable way to do this would be to take a look at the Event Structure. You could use this to check for button presses using the Value Change event, which would mitigate the polling necessary on the Boolean controls, and would make it easier to write some initialization code for the first test (with the fix proposed above, the first test is 0x0 = ?). I'd also suggest perhaps a subVI to do the random generation, if you want to place it both before the first test and in each regeneration.
11-30-2018 09:18 AM
Use a while loop to repeat the process rather than using the Run Continuously button.
11-30-2018 06:13 PM
A few more comments:
Try to apply most of these fixes and post your new solution again. We'll help you get it perfect. 😄