12-19-2011 12:56 PM
Hi,
I am trying to do a memory game but I am facing some problems with the Flat Sequence Structure.
The for loop in the second frame compares but it gives only the last comparison.
How can I solve it?
(If I split the cases into 4 TFFF FTFF FFTF FFFT, it becomes more complicated and the case FFFF will be hard to program)
P.S. Labview Version 11
Solved! Go to Solution.
12-19-2011 01:18 PM
I think I would use a cluster here. I would have a button that covers an image file. When you press the button it would go to transparent mode displaying the image. You could keep the cluster and image arrays so that you could do the comparison when the button is pushed.
12-19-2011 01:19 PM
Maybe you should start with explaining what the program is supposed to do. Is the final goal something like simon?
12-19-2011 01:21 PM
Back for more homework help, I see.
Well, the direct answer to your question is that it has nothing to do with the sequence structure. In fact, the sequence structure serves no purpose in your code. You could remove it and the code will work exactly the same way. The problem is that the for-loop is working as designed. The value that's being generated by the Add function changes with each iteration. Since you are wiring its output through a tunnel, by definition you only ever see the last value. Did you intend to auto-index?
I don't understand the intention of this "game". How is it supposed to work?
You should consider looking at standard programming architectures. You will save yourself some headaches in the future.
12-19-2011 01:25 PM
mmm..
I don't want to use any pictures at the moment for the game(pure LABVIEW palletes).
As for the cluster, isn't it the same as the array in this case?
I'm having the difficulty in the element at index 3 of array2.
12-19-2011 01:41 PM
@ altenbach:
I 've seen this problem and I'm trying to figure it out. (its taking the last value)
How come the number of iterations are known? It depends on the user when he will click( i used a while loop so that each time the user clicks it will count it to be equal to x.)
In the second loop, I try to figure out what the "index" the user pushed.( this is what I'm having trouble with- user interface)
@smercurio_fc:
This is no homework, project, extra bonus point exercise...And only time will tell.
reasons:
homeworks: my last post was the last homework
project: more about sensors and dimensions
extra point: lol, no extra points
For the resulted compared array, I meant to auto-index.
intentions of the game:
The user will run run the program and the array should turn on-off randomly and user should try to memorize it
and try to click on the same pattern. until he makes a mistake three times and the game is over.
Its the first time I work with a code that there are user interface( The clicking of the user )
12-19-2011 04:14 PM
Here is how I would start
12-20-2011 09:57 AM
aeastet, I could not understand your code. It gave me wrong cases when I hit on the lighted parts.
I'm attaching the new code but I couldn't figure how to solve the problem.
Can you give some example where the user interferes and the output is totally related to the user.
simple example where the user clicks on an ok array and the output are the indecis of the elements clicked? number of clicked is predefined.
thanks
12-20-2011 10:01 AM
here is the latest version
12-20-2011 12:33 PM
Tim, your program works and does the job but it differs insome situations from my program. You use 4 independent variables while I use an array; you also use an event structure.
Is there a way to eliminate the event structure and use simple loops and case structures(I have minimal knowledge with the event structure)
Can you show me an example where the user clicks on different elements of the OK array and the outcome is the index of this array; if I understand that part I will do my own version of the mind game with no event structure
Thats what I did for this part and it doesnt work