LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stuck in Game of Life

I'll also attach the labview version 2019 .

0 Kudos
Message 11 of 18
(148 Views)
Hi...Yamaeda!
Although the logic you made was kinda nice doing DFS on every element and looking for each element whether a X exists or Not and then depending upon that a decision was being made but there is some slight error in the logic i still can't figure out what it is. It was great effort but the outputs are not the same as they should be like if there is O on the boundaries just, the logic in the code is producing Os in the middle of the matrix two where there are supposed to be No Os
 
0 Kudos
Message 12 of 18
(115 Views)

Tried a lot but still can't figure this one out

0 Kudos
Message 13 of 18
(111 Views)

Hi adam and knightrider,

 

you really should work together when you work on the same task (and probably in the same class)…

 

@knightrider:

Your VI should look more like this:

You really need to learn more about DATAFLOW, array handling, shift registers, indexing tunnels - in sum: LabVIEW basics!

 

Hint: when you want to handle all subarrays of your input array then you should NOT work with constants for any array indices…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 14 of 18
(93 Views)

@knightrider3466 wrote:

I'll also attach the labview version 2019 .


When attaching a VI, make sure that all controls have reasonable default values. Here the input is an array of strings, which has an infinite amount of possible values, while there can actually only be two possible values (X, O), so maybe an 2D array of booleans would be more reasonable.

 

It also helps to list the full rules (e.g. from here).

 

These are very simple rules and should not require a screenful of code, right? So try to simplify!

0 Kudos
Message 15 of 18
(68 Views)

@knightrider3466 wrote:
Hi...Yamaeda!
Although the logic you made was kinda nice doing DFS on every element and looking for each element whether a X exists or Not and then depending upon that a decision was being made but there is some slight error in the logic i still can't figure out what it is. It was great effort but the outputs are not the same as they should be like if there is O on the boundaries just, the logic in the code is producing Os in the middle of the matrix two where there are supposed to be No Os
 

That is a different task. Basically you need to check for every O if there is a path to the edge. LabVIEW comes with an example in examples\Synchronization\Queue\Queue Stack Maze Solver.vi

0 Kudos
Message 16 of 18
(48 Views)

Here is a very quick draft for the game of life (as mentioned in the first post). It would be easy to adapt to whatever logic and datatypes (e.g. strings) you are trying to implement.

 

altenbach_0-1745428242167.png

 

0 Kudos
Message 17 of 18
(37 Views)

@knightrider well, your original description didn't exactly include the border rules or Regions, did it? 🙂

By logic, all Regions that's not connected to an Edge will be surrounded, right?

So, search for all O's, see if they're connected to another O to create a region and if any O in the region is a border-O they won't flip.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 18 of 18
(6 Views)