From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tic Tac Toe 4x4

Solved!
Go to solution

Hello everyone

I have a tic tac toe 3x3 game,  I want to change it become 4x4, but I'm still confused because I'm Labview beginner. I hope someone can help me, Thanks.

0 Kudos
Message 1 of 9
(2,826 Views)
Solution
Accepted by topic author michaelkeane24

Maybe this can give you some ideas....

0 Kudos
Message 2 of 9
(2,808 Views)

Thank you for your answer Sir, but can you have more simple tic tac toe 4x4? 

0 Kudos
Message 3 of 9
(2,803 Views)

Hi Michael,

 

compared to your own TicTacToe code version Christians sources look far more easy to understand!

(Your code is full of misunderstanding of DATAFLOW and shows a lot of bad coding habits.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(2,796 Views)

You are making many glaring beginner mistakes:

 

  • Potential race conditions due to local variable overuse. (most will iron themselves out across iterations, but they are still not great!)
  • Learn about shift registers to retain data across iterations.
  • Having a constant wired to the toplevel conditional terminal, then an abort Vi inside a useless sequence structure inside a case structure is just insane. Where did you learn that? Just wire the button to the termination condition, stopping the  toplevel loop, the VI will run out of code and stop naturally.
  • There is a lot of duplicate code. Many cases are almost identical and could share most of their code if arranged right.
  • Your toplevel loop spins as fast as the computer allows. It needs a small wait.
  • Your random number generation is not fair because 1 occurs at twice the probability of 0 or 2. Think about how to fix that.
  • Your subVIs use up to 9 instances to index the same array. One is enough! you can resize it to 9 outputs.

My suggestion at this point would be to improve your current 3x3 version until the code is significantly cleaner. It can probably be done with 20% of the current code. You need to learn the basics without the additional complications of a larger board.

 

See how far you get and post your improvements. We will tell you once you are ready to go to 4x4.

Message 5 of 9
(2,774 Views)

Thank you for your advice

0 Kudos
Message 6 of 9
(2,760 Views)

Do you really only have LabVIEW 2010?

 

(I made a quick and simple draft to give you some ideas, but I don't really want to down-convert it that far....)

0 Kudos
Message 7 of 9
(2,715 Views)

@altenbach wrote:

(I made a quick and simple draft to give you some ideas, ...)


See also this gem. 😄

0 Kudos
Message 8 of 9
(2,666 Views)

Thank you for help me.

0 Kudos
Message 9 of 9
(2,638 Views)