Art & Science of Java Chapter 3
===

So I'm dipping a toe in the Java pool, and wanted to ask for some advice. I've been reading through The Art & Science of Java, and doing all the Programming Exercises. I know solutions are out there for most of them, but I really want to try and complete them all by myself, and I'm sure there's a better solution to Problem 10 at the end of Chapter 3.

If anyone has any suggestions for how this code could be improved, I'd be keen to hear, and hopefully learn, how to be a better programmer!

As you can see below, you only have to change the BOARD_SIZE, and when its drawn, it will always be centred on the screen.

     /*
     * File: TicTacToe.java
     * --------------------
     * This program draws a Tic Tac Toe board using better programming methods
     * and one constant BOARD_SIZE, always centered in screen
     */
    
    
    import acm.graphics.*;
    import acm.program.*;
    
    
    public class TicTacToe extends GraphicsProgram {
    	
    	
    	public void run() {
    	    
    		double x = getWidth() / 2; //This finds the mid width
            double y = getHeight() / 2; //This finds the mid height
            double z = BOARD_SIZE / 6; //This divides the square size
            
            add(new GLine(x - (3 * z), y - z, x - (3 * z) + BOARD_SIZE, y - z)); //This draws the upper horizontal line
            add(new GLine(x - (3 * z), y + z, x - (3 * z) + BOARD_SIZE, y + z)); //This draws the lower horizontal line 
            add(new GLine(x - z, y - (3 * z), x - z, y - (3 * z) + BOARD_SIZE)); //This draws the left vertical line
            add(new GLine(x + z, y - (3 * z), x + z, y - (3 * z) + BOARD_SIZE)); //This draws the right vertical line
    
    	}
    	
    	private static final int BOARD_SIZE = 300;
    	
    }