Make the empty grid an array. On start of layout, fill the array with numbers 1 - 6 in a random order (not sure how do do this off the top of my head.)
If you are not familiar with arrays, there is a nice tutorial for it in the tutorials section (you will need to be familiar with loops to fill the array).
Now, it is easy to get which card is at which position. use the command array.at(x,y).
A rule of thumb to help you: when you have a grid, more often than not you will want an array.