/home/dino/web/java/Life/source/java/Constants.java
/* ******************************************************************
    This interface contains no code, only constants used by the code.

    Hence when this interface is implemented, there is no code to
    over-write, and all constants come for free.
   ****************************************************************** */

import java.awt.Font;   // There are both font
import java.awt.Color;  // and color constants.
import java.awt.Point;

public interface Constants
{
    // Constant values this program uses follow. No magic numbers, no magic
    // anything!

    // On the next: a min of 1 "froze" and I had to crash
    // my system. A min of 2 had Microsoft Internet Explorer
    // crash with a mysterious error. Best to be sensible.
    // Three is small enough to remain conservative and allow
    // some pretty darn small cells.

    final int MIN_PIXELS_PER_CELL = 2; 
    final int DEFAULT_PIXELS_PER_CELL = 20; // Number of pixels we per cell,
                                            // default.
    // Board size min constants:

    final int MIN_ROWS = 3;
    final int MIN_COLS = 3;

    // The program displays sample boards to the user, should s/he request
    // such. But we can't do this with a teeny board. We need room to move.

    final int MIN_DIMENSIONS_TO_DISPLAY_SAMPLE_BOARDS = 10;

    // From the book: maximum integer value:
   
    final int MAX_INT = 2147483647; // For time delay?! User would wait a long 
                                    // time for this one.

    final int MIN_TIME_DELAY = 0;   // Shortest time delay.

    final int NOT_ON_BOARD   = -0xBad;  // A non-existant pixel value.
    // Color constants follow:

    final Color COLOR_BACKGROUND = Color.gray;
    final Color COLOR_ABOUT_TO_COME_TO_LIFE = Color.black; //new Color(15, 15, 15);  // Very dark.
    final Color COLOR_ALIVE = Color.green;
    final Color COLOR_SOON_TO_DIE = new Color(50,200,0); // Light green.
    final Color COLOR_DEAD = Color.black;
    final Color COLOR_OF_GENERATION_NUMBER = Color.red;
    final Color SELECTED_BUTTON_COLOR = Color.green;
    final Color DE_SELECTED_BUTTON_COLOR = Color.yellow;

    // Next are constants defining where the board goes and how much
    // padding exists between the board and the edges.

    final int PIXELS_TO_SKIP_FROM_TOP_AND_BOTTOM        = 3;
    final int PIXELS_TO_SKIP_FROM_RIGHT_SIDE_OF_BOARD   = 9;
    final int PIXELS_TO_SKIP_FROM_LEFT_SIDE_OF_BOARD    = 3;
    final int PIXELS_TO_SKIP_FROM_WIDGETS_AND_EDGES     = 3;

    // Windows look better a little higher on the screen:

    final int Y_OFFSET_TO_RAISE_WINDOW = 100;

    // What if a window gets located at a "weird" place?

    final int PIXELS_WE_MUST_SKIP_FROM_EDGES_FOR_WINDOW_POSITIONING = 20;
    final int DEFAULT_FARTHEST_LEFT_A_COMPONENT_LIVES = 612;

    // Insets and padding:

    final int DEFAULT_INSET  = 20;  // Standard value used for insets.
    final int DEFAULT_PADDING = 30; // Padding of 25 pixels around a cell.
    final int SMALL_PADDING   = 7;

    // Sometimes we set the board probalistically, and the next is default
    // probability of "alive."

    final int MIN_PROBABILITY =   1;
    final int MAX_PROBABILITY = 100;
    final int DEFAULT_PROBABILITY_OF_ALIVE = 45; // If we set "alives" 
                                                 // probalistically.

    // Several time-related constants:
    
    final int ONE_SECOND            = 1000;                 // These
    final int EIGHTH_SECOND         = 125;                  // should be
    final int THREE_QUARTER_SECOND  = 750;                  // obvious.
    final int DEFAULT_SHORT_TIME_TO_PAUSE = 275;            // Short pause.
    final int HALF_SECOND           = 500;
    final int TIME_TO_WAIT_FOR_THREADS = 3;
    final int TIME_TO_WAIT_FOR_BUTTON_CLICK  = 50;
    final int TIME_TO_WAIT_FOR_PAINTING      =  10;
    // We store old boards to determine if we are in a repeating pattern:

    final int NUMBER_OF_OLDBOARDS = 6;
    final int PATTERN_DOES_NOT_REPEAT = -0xBad; // Code means: current pattern
                                                // doesn't repeat.

    final int GARBAGE_VALUE = -0xDeadBeef;
                                  // We do not use zero, because zero
                                  // has a meaning -- "cell is dead."

    // Next all relate to type: fonts, font sizes, and where on the board
    // to put them.

    final int GENERATION_NUMBER_FONT_SIZE   = 25;
    final String DEFAULT_FONT               = "TimesRoman";// What font we use.

    final int SMALL_FONT_SIZE   = 10;
    final int NORMAL_FONT_SIZE  = 15;              // And how big it is.
    final int LARGE_FONT_SIZE   = 20;

    final Font SMALL_FONT = new Font("TimeRoman", Font.PLAIN, SMALL_FONT_SIZE);
    final Font STANDARD_FONT = new Font("TimeRoman", Font.PLAIN, NORMAL_FONT_SIZE);
    final Font LARGE_FONT = new Font(DEFAULT_FONT, Font.PLAIN, LARGE_FONT_SIZE);
    
    final int BREAK_MAIN_LOOP      = 0; // Used to determine actions
    final int CONTINUE_MAIN_LOOP   = 1; // in MainLoop, main class *Life*
    final int KEEP_GOING_MAIN_LOOP = 2; // Java does not seem to have enums.

}   // End interface < Constants.java >.