📄 golconst.java.old
字号:
package GameOfLife;
public class GoLconst
{
//Public constants
/***Grid control variables***/
public static int GRID_COLUMNS = 102;
public static int GRID_ROWS = 60;
public static int GRID_CELLSIZE = 10;
/*-- Optimum settings for full-screen display (hide Taskbar)
Cols Rows Size Cellsize
1280 x 1024 pixels: 85 56 15 normal
-- " -- 51 34 25 large
1152 x 864 76 46 15 normal
-- " -- 46 27 25 large
1024 x 768 68 40 15 normal
-- " -- 41 25 25 large
800 x 600 53 28 15 normal
-- " -- 32 18 25 large
--*/
//time-interval between generations
public static int GRID_REFRESH_SLOW = 1500;
public static int GRID_REFRESH_FAST = 500;
public static int GRID_REFRESH_HYPER = 0;
/***Variables determining properties for Grid coordinates***/
public static boolean GRID_COORD_SHOW = true;
//0->all cells, 1->last row&col, 2->last col, 3->last row, 4->last cell
public static int GRID_COORD_DETAIL = 1;
public static String GRID_COORD_COLOR = "blue"; //blue,black,red,green
/***Text display & command area***/
public static int TEXTAREA_HEIGHT = 1;
/***Population & Citizen-level control variables***/
//density of population used in the Random & Sugarscape template
public static double DENSITY_FACTOR = 0.5;
// maximum vision level for a citizen
public static int VISION_MAX = 3;
// maximum metabolism level for a citizen
public static int METABOLISM_MAX = 4;
// max "initial" qty of sugar inherited by a citizen - may gather more later.
public static int SUGAR_MAX_CITIZEN = 10;
//maximum "initial" qty of sugar in a cell, may exceed this limit later
public static int SUGAR_MAX_CELL = 10;
//Grid fertility - how generous a distribution do you want to start with
public static double GRID_FERTILITY = .60; //Any value between 0.0 & 1.0
// unit increase in amt of sugar per generation
public static double SUGAR_RENEW = 0.1;
//Carrying capacity
public static boolean LIMIT_CELL_SUGAR = false;
/* debug mode - do you want it on or off?
/ The first flag switches on all debugging, leave it Off if you want debug info
/ for a specific section of code. Use one of the other more specific debug
/ switches to debug a particular section of code.
/ Enabling the DEBUG switch will render some of the other debugging switches
/ ineffective. The switches listed above the DEBUG switch are turned On but
/ not Off with the DEBUG switch.
*/
public static boolean DEBUG_CRITICAL_ERROR = true;
public static boolean DEBUG = false;
public static boolean DEBUG_CREATE_CITIZEN = false;
public static boolean DEBUG_CITIZEN_DEATH = false;
public static boolean DEBUG_SEARCH_SUGAR = false;
public static boolean DEBUG_CELLSCAPE_SUGAR = false;
public static boolean DEBUG_CITIZEN_DETAIL = false;
public static boolean flagSugarscape;
public static String chkGoLconstants()
{
String dataStream = "\n";
if( GRID_COORD_DETAIL < 0 || GRID_COORD_DETAIL > 5)
{
if( DEBUG_CRITICAL_ERROR || DEBUG )
{ dataStream +=
"GRID_COORD_DETAIL:Invalid value specified, assuming 0.5!!\n"; }
GRID_COORD_DETAIL = 1;
}
if( !(GRID_COORD_COLOR == "blue" ||
GRID_COORD_COLOR == "black" ||
GRID_COORD_COLOR == "red" ||
GRID_COORD_COLOR == "green") )
{
if( DEBUG_CRITICAL_ERROR || DEBUG )
{ dataStream += "GRID_COORD_COLOR:Invalid value specified, assuming blue!!\n"; }
GRID_COORD_COLOR = "blue";
}
if( DENSITY_FACTOR > 1 || DENSITY_FACTOR < 0)
{
if( DEBUG_CRITICAL_ERROR || DEBUG )
{ dataStream += "DENSITY_FACTOR:Invalid value specified, assuming 0.5!!\n"; }
DENSITY_FACTOR = 0.5;
}
if( VISION_MAX <= 0 )
{
if( DEBUG_CRITICAL_ERROR || DEBUG )
{ dataStream += "VISION_MAX:Invalid value specified, assuming 4!!\n"; }
VISION_MAX = 4;
}
if( METABOLISM_MAX < 0 )
{
if( DEBUG_CRITICAL_ERROR || DEBUG )
{ dataStream += "METABOLISM_MAX:Invalid value specified, assuming 4!!\n"; }
METABOLISM_MAX = 4;
}
if( SUGAR_MAX_CITIZEN < 0)
{
if( DEBUG_CRITICAL_ERROR || DEBUG )
{ dataStream += "SUGAR_MAX_CITIZEN:Invalid value specified, assuming 10!!\n"; }
SUGAR_MAX_CITIZEN = 10;
}
if( SUGAR_MAX_CELL < 0)
{
if( DEBUG_CRITICAL_ERROR || DEBUG )
{ dataStream += "SUGAR_MAX_CELL:Invalid value specified, assuming 10!!\n"; }
SUGAR_MAX_CELL = 10;
}
if( GRID_FERTILITY > 1 || GRID_FERTILITY < 0)
{
if( DEBUG_CRITICAL_ERROR || DEBUG )
{ dataStream += "GRID_FERTILITY:Invalid value specified, assuming 0.5!!\n"; }
DENSITY_FACTOR = 0.5;
}
if( SUGAR_RENEW > SUGAR_MAX_CELL || SUGAR_RENEW < 0)
{
if( DEBUG_CRITICAL_ERROR || DEBUG )
{ dataStream += "SUGAR_RENEW:Invalid value specified, assuming 0.1!!\n"; }
SUGAR_RENEW = 0.1;
}
return dataStream;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -