"Also how do you check if its a valid word? And do you make sure there are always valid words on the board?"
Not really. The words validate after the player finalizes it in runtime. I made an algorithm to basically make sure that letters are randomly generated from a pool of letters. Each letter generally being proportional to how often they occur in basic words (so that the Zs, Ws, and Vs, only occur once per set so they don't clog the grid). But it is possible to have multiple copies of them in-game if you ignore them on the grid long enough.