The graphics code is factorized into BoardPanel, split pieces into two lists which are properties of the players, caused the mate and stalemate not to work.