TheChess
|
00001 /* 00002 * thechess, chess game web application written in C++ and based on Wt 00003 * Copyright (C) 2010 Boris Nagaev 00004 * 00005 * thechess is licensed under the GNU GPL Version 2. 00006 * Other versions of the GPL do not apply. 00007 * See the LICENSE file for terms of use. 00008 */ 00009 00010 // 00011 #ifndef THECHESS_CONFIG_H_ 00012 #define THECHESS_CONFIG_H_ 00013 00014 #include "time_intervals.hpp" 00015 #include "model/UserClassification.hpp" 00016 #include "model/CompetitionType.hpp" 00017 #include "ThechessOptions.hpp" 00018 00019 namespace thechess { 00020 namespace config { 00021 00022 const char* const wt_config_files[] = { 00023 "wt_config.xml", 00024 "~/.thechess.wt_config.xml", 00025 "/etc/thechess/wt_config.xml", 00026 "/etc/wt/wt_config.xml" 00027 }; 00028 const int wt_config_files_size = 4; 00029 00030 const char* const username_regex = "[a-zA-Z][a-zA-Z0-9._-]{2,29}"; 00031 const char* const password_regex = "[a-zA-Z0-9._%+-@]{3,30}"; 00032 00033 namespace min { 00034 const Td limit_std = td_null; 00035 const Td limit_private_init = 5 * minute; 00036 const Td pause_limit_init = td_null; 00037 00038 const int first_draw = 2; 00039 } 00040 00041 namespace defaults { 00042 const Td limit_std = 2 * minute; 00043 const Td limit_private_init = 2 * hour; 00044 const Td pause_limit_init = day; 00045 00046 const int first_draw = 10 * 2; 00047 00048 const double pause_factor = 0.5; 00049 00050 const ThechessOptions::DatabaseType database_type = ThechessOptions::Sqlite3; 00051 const char* const database_value = "~/thechess.db"; 00052 const int connections_in_pool = 10; 00053 00054 const bool norating = false; 00055 } 00056 00057 namespace max { 00058 const int moves_init = 20 * 2; 00059 00060 const Td limit_std = week; 00061 const Td limit_private_init = 4 * week; 00062 const Td pause_limit_init = week; 00063 00064 const int first_draw = 5000 * 2; 00065 } 00066 00067 namespace competition { 00068 using namespace model; 00069 namespace min { 00070 const int max_rating = 900; 00071 const int min_rating = 100; 00072 const Classification max_classification = CLASSIFICATION_F; 00073 const Classification min_classification = NO_CLASSIFICATION; 00074 const Td force_start_delay = minute; 00075 const Td min_recruiting_time = minute; 00076 const Td max_recruiting_time = 2 * hour; 00077 const int min_users = 2; 00078 const int max_users = 5; 00079 const int max_simultaneous_games = 1; 00080 const float games_factor = 0.01; 00081 const Td relax_time = minute; 00082 const int min_substages = 1; 00083 const int increment_substages = 0; 00084 } 00085 00086 namespace defaults { 00087 const CompetitionType competition_type = STAGED; 00088 const int max_rating = 2000; 00089 const int min_rating = 500; 00090 const Classification max_classification = SUPER_GRANDMASTER; 00091 const Classification min_classification = NO_CLASSIFICATION; 00092 const Td force_start_delay = day; 00093 const Td min_recruiting_time = 3 * day; 00094 const Td max_recruiting_time = week; 00095 const int min_users = 8; 00096 const int max_users = 16; 00097 const int max_simultaneous_games = 8; 00098 const float games_factor = 1.0; 00099 const Td relax_time = day; 00100 const int min_substages = 3; 00101 const int increment_substages = 1; 00102 00103 const bool norating = true; 00104 } 00105 00106 namespace max { 00107 const int max_rating = 3000; 00108 const int min_rating = 1700; 00109 const Classification max_classification = SUPER_GRANDMASTER; 00110 const Classification min_classification = NATIONAL_MASTER; 00111 const Td force_start_delay = week; 00112 const Td min_recruiting_time = 4 * week; 00113 const Td max_recruiting_time = 8 * week; 00114 const int min_users = 50; 00115 const int max_users = 100; 00116 const int max_simultaneous_games = 50; 00117 const float games_factor = 10.0; 00118 const Td relax_time = week; 00119 const int min_substages = 15; 00120 const int increment_substages = 3; 00121 } 00122 00123 const unsigned int max_name = 50; 00124 const unsigned int max_description = 1000; 00125 } 00126 00127 namespace elo { 00128 const int init = 1200; 00129 const int big = 2400; 00130 const float big_K = 10; 00131 const int beginner_all = 30; 00132 const float beginner_K = 25; 00133 const float other_K = 15; 00134 } 00135 00136 const int salt_length = 16; 00137 const char crypt_id = '5'; // man 3 crypt 00138 00139 namespace tracker { 00140 const Td delay = 0.01 * second; 00141 const Td dummy_timer_expiry_time = 100500 * day; 00142 const Td stale_object_delay = second; 00143 const Td unknown_error_delay = 2 * second; 00144 } 00145 00146 const int cookie_session_age = (5*365*day).total_seconds(); 00147 00148 } 00149 } 00150 00151 #endif // THECHESS_CONFIG_H_