LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MASTERMIND ON LABVIEW

Hi!,

I want to make the mastermind game on LabVIEW because is a class project, so I need help on getting the code. If anyone is willing to help me, contact me by here! Thx!

 

Pd: I have the code from someone, but i need to understand it all

 

Here: https://forums.ni.com/t5/Example-Code/Mastermind-Game-in-LabVIEW/ta-p/3513867

 

I pay if i it works and it's worth it

0 Kudos
Message 1 of 12
(1,919 Views)

Hi Aleexx4000,

 


@Aleexx4k wrote:

I want to make the mastermind game on LabVIEW because is a class project, so I need help on getting the code.


So the goal of that class is to teach you how to copy someone else's code? Really?

 


@Aleexx4k wrote:

Pd: I have the code from someone, but i need to understand it all

Here: https://forums.ni.com/t5/Example-Code/Mastermind-Game-in-LabVIEW/ta-p/3513867


Then you should do the LabVIEW basics courses as offered in the header of the LabVIEW board.

This really helps you to understand LabVIEW code!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 12
(1,905 Views)

You already have working code which is a great start! Turn on highlight execution, run it & watch the little guys race around!

 

Do you know how to use probes & breakpoints? ⬅ Really helpful for understanding existing code.

0 Kudos
Message 3 of 12
(1,897 Views)

Hi Dave!, 

 

Well i have done a some works with LabVIEW, but what i need to do is the mastermind, so i found someone's code, but i don't understand it, I need to do it with a State machine type. I'm looking for the Highlight execution button but it doesn't appears 😞

 

Thx! 

Aleexx4k_0-1670254078537.png

 

0 Kudos
Message 4 of 12
(1,883 Views)

@Aleexx4k wrote:

Well i have done a some works with LabVIEW, but what i need to do is the mastermind, so i found someone's code, but i don't understand it, I need to do it with a State machine type. I'm looking for the Highlight execution button but it doesn't appears 😞


Wonderful!  Perhaps without the "crutch" of the Highlight Execution button, you'll spend your time looking at this (rather messy, confusing, unstructured) routine and deciding either to study what's there and make sure you understand what the original Poster of this program did, or (and better yet), ask yourself how you would go designing a VI that would let you play Mastermind.  Note that this program is the "Code Maker", the easier part, not the "Code Breaker", the person trying to solve the puzzle.  

 

Here are what are meant as Really Helpful Suggestions that will come in useful for LabVIEW Programming, C++ Programming, Python Programming, and other complex tasks having nothing to do with programming --

  1. Turn off the computer.  Get several pieces of paper (or use a Notebook).
  2. Turn on your brain.  Think about the nature of the program.  Try to divide it up into "large chunks" that describe what you want to do.
  3. Figure out how the "Chunks" fit together.  How do you go from one Chunk to another?  How do you know which Chunk to do next?
  4. There will be one "Chunk" that starts the program (and is done once, and often called "Initialize" or "Begin").
  5. There will be one "Chunk" that ends the program (and is also done once, often called "Exit").
  6. Once you have sort of a Big Picture (or 30,000 ft view) of What you want to do, pick a Chunk and think about How you want to do it.
  7. When you start doing the "How"s, you might find that they can also be broken into smaller logical steps.

How does this relate to LabVIEW?  The Hows should be sub-VIs.  [How many sub-VIs are in your "example" Mastermind?  How easy is it to understand this "everything all-at-once" style of coding?]  Depending on how your Chunks "fit together", and whether or not any repetition is involved, you may want to learn about "Looping Structures" in LabVIEW and how they can be use to make things like State Machines (which follow a series of "Do this, then do that" decisions).  Learn how to write (and use) sub-VIs.  And always wire the Error Line (and be sure to use the default Connector Pane in any sub-VIs you write, with Error In and Error Out on the lower left and right Connectors).

 

Bob Schor

 

 

Message 6 of 12
(1,859 Views)

@Aleexx4k wrote:

Well i have done a some works with LabVIEW, but what i need to do is the mastermind, so i found someone's code,


It always upsets me if NI is verifying examples (NI verified!) that are total garbage such as this. All you will learn by studying this code are really (really!!!!) bad coding habits!

 

Array Data Ping-Ponging via value property nodes, never heard of autoindexing, sequence frame to fix race conditions, etc. etc. If you would submit anything similar, as your teacher I would fail you immediately!

 

Just look at this small code section. This is NOT how to do things!

altenbach_0-1670260466331.png

 

So go back to your course notes and the LabVIEW tutorials. Even as a beginner you should be able to write better code than this! Seriously!

Message 7 of 12
(1,818 Views)

Wow, I'm very grateful!, thx for this tips! I'll try, and if I have some questions or I'm blocked I'll text something!

0 Kudos
Message 8 of 12
(1,803 Views)

This actually sounds like a fun project.  The most important part is to make sure that you are properly implementing the rules.  We'll be happy to assist you.  If you get stuck somewhere, just upload what you have here and I'm sure we can give you some hints and ideas...  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 12
(1,778 Views)

Yes, should be easy to do. (I till have some original boards from the seventies, I think :D)

 

Make sure to define the implemented rules (or options to chose e.g. Max number of guesses? Blanks allowed? Duplicate color allowed? etc.)

 

Here are the rules.

0 Kudos
Message 10 of 12
(1,765 Views)