05-07-2013 01:55 PM
Hi all,
I'm working on the implementation of a tic-tac-toe game.The strategy code is written in c++; the interface is in Labview; and the aftergame "replay" is going to be in MatLab. For this last part, I need to be able to retrace the players' moves chronologically -- and it's here I need your help, please.
The board is represented in LV by a 2D array. Each cell contains a ring of three numerical constants (0 for empty state, 1 or 2 for occupied by respective players). I would like to store the contents of this 2d array (ie. of the board) each time a cell is changed, keeping in mind that data can be entered into this array before running the VI (when you want to start a game from a non-empty board).
Can this be done? Or is this not the right way about it?
I hope I've been clear in my explanation of the set-up; if not, please let me know.
Many thanks for any guidance or insight.
Alex
05-07-2013 02:24 PM
Store in a 3-D array. The third dimension, the page, will reflect the state of the grid at each point of time.
05-07-2013 04:34 PM
@ak02141 wrote:
The strategy code is written in c++; the interface is in Labview; and the aftergame "replay" is going to be in MatLab.
Is this for learning all three development systems or pure masochism??? 😮
Why not do everything in LabVIEW and save the headaches?
For some pure LabVIEW ideas, have a look at my 4x4 tic tac toe entry from a long time ago.
You definitely don't need a 3D array, because 99% of the information is redundant (most fields almost never change). A game is so short that any position can be regenerated in nanoseconds from a simple move list. Don't store hot air!
05-08-2013 06:15 AM
Thanks for the help guys!
The triple whammy of languages was probably bourne from the delicate marriage of professoral sadism and the need to get students aquainted with various environments and programs... An interesting approach, if not the most straightforward.
I'll have a look at your project altenbach -- thanks for the ressource.
Best
Alex