Replace square value DOM check with matrix check

More complicated but opens up room to move all the value checking and
marking to the matrix making GUI swappable and game saveable.