View Single Post
  #1   Spotlight this post!  
Unread 06-11-2010, 18:05
RoboMaster's Avatar
RoboMaster RoboMaster is offline
Alum, former programmer&co-captain
FRC #2472 (The Centurions)
Team Role: Mentor
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Minnesota, Twin Cities
Posts: 268
RoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant future
Computer playing Bejeweled Blitz project

As started in this thread, I'm actually working on this project. I have chosen Facebook's Bejeweled Blitz*, like was first suggested.

I've worked on it a bunch so far and have made a main program with the different parts sketched out. I only have the computational part right now, but it finds matches and knows where to move what gem where. It looks at an array of numeric values, which be converted to from the screen.It doesn't find "gap" matches yet, where there's two gems in a row with a gap in the middle that you can fill in with a third. It only looks for a row of 2 that it can complete. It does this by looking at a theoretical position to move the current gem being tested. Then it looks around that gem to see if there's one match with the original. If so, it looks further in the same direction to see if there's a second match. It counts that as a full match and passes that on the the rest of the program.

Now I need to code up how it will interact with the computer. It was suggested to interact with the Windows API to control the mouse and click in the right spots to move the gems. The Library Call node will do this for you. I looked into it though, and configuring it is beyond me since I don't know a lot about API commands. Does someone have an example or tutorial on how to use them with LabVIEW? I've Googled it and looked at NI's Dev Zone, but a lot of things expect you to know about Windows API.

Also, anyone have any suggestions for looking at the screen and getting the colors of certain pixels? I know you could do a screen capture somehow and then save the file and analyze it, but I think that might slow and/or a round-about way of doing it. Again, this might take some API work.

Thanks for your help! I've attached the VI's in case you're interested. You can run them and they'll work, I've put in the test screen shot into the array. Sorry that there's not a ton of documentation yet.


*An 8x8 playing "board" that has gems you must switch to make 3 in a row or more. Then these gems disappear and more drop from the top, Connect 4 style.
Attached Thumbnails
Click image for larger version

Name:	Test_Shot_1.jpg
Views:	20
Size:	33.4 KB
ID:	9396  
Attached Files
File Type: vi Main.vi (11.2 KB, 15 views)
File Type: vi Move.vi (15.6 KB, 13 views)
File Type: vi M_L1 match test (SubVI).vi (7.8 KB, 15 views)
__________________
My engineering blog: noeticbrainwaves.blogspot.com

I'm not slacking, my code's compiling
...and I'm using LabVIEW
Reply With Quote