Yeah, to expand on that, you have to look at each possible move, and then work out the most likely opponent move, then with the new board layout you have to repeat the process until you know which core move will yield the best score. The last time I kept track of the board by storing each move in the same string of data - like maybe A2 gets moved to A3:
A2A3|
Then you would copy your buffer board and perform the move. From there you can work out the opponents likely move, and add that to the mix, say:
A2A3|B7B5
Then you keep doing that, bulding up your list and keeping track of each items score until you run out of AI brain, like if you want it easy, you might check 3 moves ahead, higher difficulties would require you to gather more data. The last time I did this I stored it all in a long string, which makes it easy to perform the moves because you just check the string a character at a time, and it's quick and simple to start a new move from an old one by using the same moves.
If you imagine your main data array is huge, any size really - because there could be thousands of moves, you have to keep track of each move in turn, and use board buffer arrays to move pieces and calculate score. For example you might have 2 boards, 1 for displaying, like the current board, and a calculator board, both are the same - but 1 should be treated as a buffer for the other one.
It's the managing of all this data that makes it difficult to program chess without some decent foreplanning - know how your data will be stored and accessed before you start coding or things can get very messy.
Van-B

It's c**p being the only coder in the village.