The beginning of a chess applet

I started a chess applet. So far the board and pieces are there. The difficult part, actually making it play chess, is still ahead of me.

The board is an eight-by-eight integer array. Positive and negative values distinguish the two sides, and the number identifies which piece image to draw. The paint method draws the alternating squares, then walks through the array and places the matching picture on each occupied square.

There is a mouse-listener hook, but the move-handling method is still empty. I am not going to call that a chess engine. It is a useful start, though: the board state is separate from the pictures, so changing a piece’s position can eventually be a data change followed by a repaint. Now I just need to add the rules. A few more details than drawing sixty-four squares. 🙂

Chess source and applet