From 11:00 PM CDT Friday, Nov 8 - 2:30 PM CDT Saturday, Nov 9, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From 11:00 PM CDT Friday, Nov 8 - 2:30 PM CDT Saturday, Nov 9, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
12-05-2017 02:54 AM - edited 12-19-2017 09:27 AM
Coding Challenge 4 - The Memory Game
Email your entries to LabVIEWDigestCompetition@ni.com
Deadline - 26th January 2018
This challenge asks you to build a simple memory game. On the VI there is a colour box indicator. Your task is to have it display a growing series of random colours. So we start by displaying one colour, the user inputs the colour using the controls. Then we display the first colour again but add another random colour to the sequence, the user inputs the two colours of the sequence. Then we add a third colour and so on.
The program should:
Please use one of the attached VIs.
I have included an NXG version but colour box constants are not in NXG 1.0 so I have used words instead. The same coding is required, but you display the names of colours, not the actual colour.
Please note the competition is only open to LabVIEW users in Europe, Middle East, India and Africa.
Good luck,
Charlotte
12-06-2017 02:46 AM
Yes, I will participate, but I will stay out of the challenge, I don't want to win again 😉
12-19-2017 09:16 AM
12-19-2017 09:25 AM
Hey,
thanks for reminding me about the deadline. I put it in my calendar but not in the post for some reason! It's the 26th January and it's in the post now.
So definitely still plenty of time.
I've also noticed notifications not working as I didn't see Phil's comment until I actually came back to the post. 😐 Hopefully that's a temporary thing, I'll flag it up with the web team.
Thanks,
Charlotte
12-21-2017 07:09 AM
Hi Charlotte,
Thanks for this new challenge, it seems a little bit more difficult than the previous, but I prefer like this 🙂
I have a question: what do you mean about the fail message "the correct color was XXXX"?
XXXX represent all the colors of the test (in string like Blue, Green ...)? Only the first failed color? The latest color of the test?
Thanks 😉
12-22-2017 02:35 AM
Yeah, I thought I'd try and switch between a simple challenge and more of a full application every other time now. As I think it's nice to sometimes think about the structure a bit more, than just develop and algorithm.
So the XXXX should be replaced with whatever colour the person failed at. So yes, the first failed colour.
So if the sequence is Blue, Red, Black and I entered Blue, Green the program should stop the game as soon as I got it wrong and display the message 'the correct colour was Red'.
I hope that makes more sense.
Thanks,
Charlotte
01-08-2018 06:16 AM
Hi everybody,
I hope you my best wishes for this new year
and I sent my code for this challenge!
Bye.
Phil
01-24-2018 11:40 AM
Hello All,
I have also sent my code long back.
Thanks
02-02-2018 09:13 AM
Hi Everyone,
Thank you to everyone that joined in with this challenge! This one was definitely a bit harder than some of the others as I saw a lot of entries that almost worked but didn't quite.
This challenge's winner is user HugoPaul! They had one of the easiest to understand solutions I saw and it was very nicely documented. I believe they're looking to take their CLD so the good documentation practices will come in handy.
The winning code is attached below as I realise the block diagram is hard to see in the images
Key Point of Feedback:
Many solutions relied on a lot of local variables in state machines. Local variables can lead to race conditions which are hard to debug but can cause errors in your code.
Now you should be fine in a state machine as things don't happen in parallel which is where race conditions become likely. But it's really great practice to not use local variables when you don't have to. Even if you get lucky and never have a race condition, it's a lot easier to debug your code when you have wires updating the UI.
Ways to avoid using them in a state machine include only updating an indicator from one state, or updating the indicators after the case structure. Does anyone have other ways to deal with this?
There's a tutorial on race conditions here.
Interesting Solution
One of the issues with the UI I designed is that it was hard to tell if the same colour came up twice in a row. Thoric had a great solution to this by adding some fancy transitions! Code attached if you want to understand how it works!
03-04-2018 09:48 PM