LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a maze in Labview

You may want to take a look at the Tetris link in my signature - Tetris has some similar features like timed changes, handling collisions etc. - you might find some bits of useful stuff in there.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 11 of 13
(1,339 Views)

Just in case anyone is interested in the maze - this is my final product.

 

I'm sure people can make it much better, and I've probably used bad coding methods but I'm still pretty proud of it.

 

I didn't manage to get a maze solver to work aside from using an A* algorithm I found from online.

 

Thanks for all the help

Message 12 of 13
(1,086 Views)

Thanks for posting the code.

 

Yes, there are some weird things in there, the most annoying is the fact that many diagrams and front panels are maximised to the screen.

 

As an illustrative example on how the code could be improved, Let's randomly look a Choose map.vi (see picture top):

 

  • One silly detour is the 2D arry -> 3D array ->index back to 2D array, i.e. you get exactly what you started out with. 😄
  • If you would select a random file name string and built the path later, you would be doing much less (no FOR loop, etc.) (middle picture)
  • Do not use hybrid filenames (containing "\"), because that will break on MAC or linux. Exclusively use "build path/Strip path" to make things platform independent. (middle picture)
  • Ideally, you should just get all the map files from the folder using "list folder" and randomly pick one of them (bottom image). Now, if you later want to add more maps, all you need is add a new file matching the name pattern (Map *.csv) to the folder and LabVIEW will use it without any code changes. Scalability! Even if you distribute it as executable, users can add their own maps at any time or remove maps that they don't like. (For completeless, you probably would need to add some error handling to detect if the folder is empty...)

This is just the top of the iceberg salad, but your other VIs could probably be improved similalry. 😉

 

Still, this is an impressive piece of work. I am sure you learned a lot. Keep going! Good luck!

 

 

 

 

0 Kudos
Message 13 of 13
(1,055 Views)