I had never seen that game before, so I played an on-line version... it was quite fun! :)
you will probably need to keep the board pieces in an array, for checking if a move is valid, if there are any moves possible, and reshuffling the board when necessary.
Since after every player move you need to make sure there is at least one move possible, the only way to do that quick enough is looping through an array - definitely some tricky programming needed there! I would love to take a crack at it, but don't have time right now...