I'm coding a Othello (Reversi) engine, and I want to count the number of stable tokens for each player, but I don't know what's the best way of doing it.
I can easily count the stable pieces along the edge, but I'm not sure how to account for the other ones. Currently, I'm using a 1-D array to represent the board.
from http://en.wikipedia.org/wiki/Reversi
"generally, a piece is stable when, along all four axes (horizontal, vertical, and each diagonal), it is on a boundary, in a filled row, or next to a stable piece of the same color."
You've mentioned the boundaries already - filled rows can be checked by just counting the pieces, though there are probably many optimisations here, e.g. find the filled rows first and then mark each position on the full row as potentially stable, rather than iterating over every position and then checking all the relevant directions, which will lead to wasted effort.
This page has some more details on calculating stability.
If you are interested in computer Othello, make sure you look up the publications on Logistello, which was (at least a few years ago) the world champion. The author, Michael Buro, wrote his PhD thesis on this topic. The source code is now available, so you can inspect the data structures used. From memory, I think he used ternary numbers (i.e. values black, white, empty) to enable fast lookups - and also maintained the state of various patterns (rows, columns, diagonals, corners, and others) to speed up the evaluation function.