]> git.sesse.net Git - stockfish/commitdiff
Merge pull request #1 from Panthee/master
authormcostalba <mcostalba@gmail.com>
Mon, 31 Oct 2011 12:32:18 +0000 (05:32 -0700)
committermcostalba <mcostalba@gmail.com>
Mon, 31 Oct 2011 12:32:18 +0000 (05:32 -0700)
Code Cleanup - Replacing macros Min() and Max() with corresponding STL algorithms std::min() and std::max()

12 files changed:
src/bitboard.cpp
src/endgame.cpp
src/evaluate.cpp
src/history.h
src/lock.h
src/material.cpp
src/misc.cpp
src/movegen.cpp
src/position.cpp
src/search.cpp
src/timeman.cpp
src/types.h

index 3bed69bead7665dc9a51e53f29008d67ab8fda9e..415f98692f48195fd152bf8ad15ed262c47f8136 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <cstring>
 #include <iostream>
+#include <algorithm>
 
 #include "bitboard.h"
 #include "bitcount.h"
@@ -160,7 +161,7 @@ void init_bitboards() {
 
   for (Square s1 = SQ_A1; s1 <= SQ_H8; s1++)
       for (Square s2 = SQ_A1; s2 <= SQ_H8; s2++)
-          SquareDistance[s1][s2] = Max(file_distance(s1, s2), rank_distance(s1, s2));
+          SquareDistance[s1][s2] = std::max(file_distance(s1, s2), rank_distance(s1, s2));
 
   SquaresByColorBB[DARK]  =  0xAA55AA55AA55AA55ULL;
   SquaresByColorBB[LIGHT] = ~SquaresByColorBB[DARK];
@@ -247,7 +248,7 @@ void init_bitboards() {
               int f = file_distance(s1, s2);
               int r = rank_distance(s1, s2);
 
-              Square d = (s2 - s1) / Max(f, r);
+              Square d = (s2 - s1) / std::max(f, r);
 
               for (Square s3 = s1 + d; s3 != s2; s3 += d)
                   set_bit(&BetweenBB[s1][s2], s3);
index a4526ff612939307f5ce9f25c6878713af247010..4e6de80968fc45e3e67d65cf7024541f2ec6c2ff 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include <cassert>
+#include <algorithm>
 
 #include "bitcount.h"
 #include "endgame.h"
@@ -632,7 +633,7 @@ ScaleFactor Endgame<KRPPKRP>::apply(const Position& pos) const {
       || pos.pawn_is_passed(strongerSide, wpsq2))
       return SCALE_FACTOR_NONE;
 
-  Rank r = Max(relative_rank(strongerSide, wpsq1), relative_rank(strongerSide, wpsq2));
+  Rank r = std::max(relative_rank(strongerSide, wpsq1), relative_rank(strongerSide, wpsq2));
 
   if (   file_distance(bksq, wpsq1) <= 1
       && file_distance(bksq, wpsq2) <= 1
index f39cd5b35b305982df76c7edcb528820b574f63a..558f05b06ee4292bca48c5af3fc7d834866af315 100644 (file)
@@ -21,6 +21,7 @@
 #include <iostream>
 #include <iomanip>
 #include <sstream>
+#include <algorithm>
 
 #include "bitcount.h"
 #include "evaluate.h"
@@ -698,7 +699,7 @@ namespace {
         // the number and types of the enemy's attacking pieces, the number of
         // attacked and undefended squares around our king, the square of the
         // king, and the quality of the pawn shelter.
-        attackUnits =  Min(25, (ei.kingAttackersCount[Them] * ei.kingAttackersWeight[Them]) / 2)
+        attackUnits =  std::min(25, (ei.kingAttackersCount[Them] * ei.kingAttackersWeight[Them]) / 2)
                      + 3 * (ei.kingAdjacentZoneAttacksCount[Them] + count_1s<Max15>(undefended))
                      + InitKingDanger[relative_square(Us, ksq)]
                      - mg_value(ei.pi->king_shelter<Us>(pos, ksq)) / 32;
@@ -762,7 +763,7 @@ namespace {
             attackUnits += KnightCheckBonus * count_1s<Max15>(b);
 
         // To index KingDangerTable[] attackUnits must be in [0, 99] range
-        attackUnits = Min(99, Max(0, attackUnits));
+        attackUnits = std::min(99, std::max(0, attackUnits));
 
         // Finally, extract the king danger score from the KingDangerTable[]
         // array and subtract the score from evaluation. Set also margins[]
@@ -933,7 +934,7 @@ namespace {
                 continue;
 
             pliesToGo = 2 * movesToGo - int(c == pos.side_to_move());
-            pliesToQueen[c] = Min(pliesToQueen[c], pliesToGo);
+            pliesToQueen[c] = std::min(pliesToQueen[c], pliesToGo);
         }
     }
 
@@ -1003,7 +1004,7 @@ namespace {
                 while (b2) // This while-loop could be replaced with LSB/MSB (depending on color)
                 {
                     d = square_distance(blockSq, pop_1st_bit(&b2)) - 2;
-                    movesToGo = Min(movesToGo, d);
+                    movesToGo = std::min(movesToGo, d);
                 }
             }
 
@@ -1013,7 +1014,7 @@ namespace {
             while (b2) // This while-loop could be replaced with LSB/MSB (depending on color)
             {
                 d = square_distance(blockSq, pop_1st_bit(&b2)) - 2;
-                movesToGo = Min(movesToGo, d);
+                movesToGo = std::min(movesToGo, d);
             }
 
             // If obstacle can be destroyed with an immediate pawn exchange / sacrifice,
@@ -1027,7 +1028,7 @@ namespace {
 
             // Plies needed for the king to capture all the blocking pawns
             d = square_distance(pos.king_square(loserSide), blockSq);
-            minKingDist = Min(minKingDist, d);
+            minKingDist = std::min(minKingDist, d);
             kingptg = (minKingDist + blockersCount) * 2;
         }
 
@@ -1126,9 +1127,9 @@ namespace {
         t[i] = Value(int(0.4 * i * i));
 
         if (i > 0)
-            t[i] = Min(t[i], t[i - 1] + MaxSlope);
+            t[i] = std::min(t[i], t[i - 1] + MaxSlope);
 
-        t[i] = Min(t[i], Peak);
+        t[i] = std::min(t[i], Peak);
     }
 
     // Then apply the weights and get the final KingDangerTable[] array
index 4d84be7054858eb37407b097b87e5aa2320e7846..f95faa0f3ef3c6bb5a1abec05156e596fa97f3ce 100644 (file)
@@ -20,8 +20,9 @@
 #if !defined(HISTORY_H_INCLUDED)
 #define HISTORY_H_INCLUDED
 
-#include <cstring>
 #include "types.h"
+#include <cstring>
+#include <algorithm>
 
 /// The History class stores statistics about how often different moves
 /// have been successful or unsuccessful during the current search. These
@@ -64,7 +65,7 @@ inline Value History::gain(Piece p, Square to) const {
 }
 
 inline void History::update_gain(Piece p, Square to, Value g) {
-  maxGains[p][to] = Max(g, maxGains[p][to] - 1);
+  maxGains[p][to] = std::max(g, maxGains[p][to] - 1);
 }
 
 #endif // !defined(HISTORY_H_INCLUDED)
index 939b7da0ad544052b104ce04d0c1b13a92c02469..b64293cf71f8c014e36bd61722b44dca2c5b37bc 100644 (file)
@@ -38,9 +38,11 @@ typedef pthread_cond_t WaitCondition;
 
 #else
 
+#define NOMINMAX // disable macros min() and max()
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #undef WIN32_LEAN_AND_MEAN
+#undef NOMINMAX
 
 // Default fast and race free locks and condition variables
 #if !defined(OLD_LOCKS)
index 7ad5dc47e891b57a4d9717ee1a793dba3bb8d3a2..6171c70a9ab62c38b7df4ae316755bbafd0dea07 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <cassert>
 #include <cstring>
+#include <algorithm>
 
 #include "material.h"
 
@@ -203,13 +204,13 @@ MaterialInfo* MaterialInfoTable::get_material_info(const Position& pos) const {
   if (pos.piece_count(WHITE, PAWN) == 0 && npm_w - npm_b <= BishopValueMidgame)
   {
       mi->factor[WHITE] = uint8_t
-      (npm_w == npm_b || npm_w < RookValueMidgame ? 0 : NoPawnsSF[Min(pos.piece_count(WHITE, BISHOP), 2)]);
+      (npm_w == npm_b || npm_w < RookValueMidgame ? 0 : NoPawnsSF[std::min(pos.piece_count(WHITE, BISHOP), 2)]);
   }
 
   if (pos.piece_count(BLACK, PAWN) == 0 && npm_b - npm_w <= BishopValueMidgame)
   {
       mi->factor[BLACK] = uint8_t
-      (npm_w == npm_b || npm_b < RookValueMidgame ? 0 : NoPawnsSF[Min(pos.piece_count(BLACK, BISHOP), 2)]);
+      (npm_w == npm_b || npm_b < RookValueMidgame ? 0 : NoPawnsSF[std::min(pos.piece_count(BLACK, BISHOP), 2)]);
   }
 
   // Compute the space weight
index d53836438aa716a6eb38c3c95401b9cdf1d09ca3..10c779ed846f4d0a37f146efc636d0e687cbaedf 100644 (file)
@@ -29,6 +29,7 @@
 #else
 
 #define _CRT_SECURE_NO_DEPRECATE
+#define NOMINMAX // disable macros min() and max()
 #include <windows.h>
 #include <sys/timeb.h>
 
@@ -43,6 +44,7 @@
 #include <iomanip>
 #include <iostream>
 #include <sstream>
+#include <algorithm>
 
 #include "bitcount.h"
 #include "misc.h"
@@ -155,16 +157,16 @@ int cpu_count() {
 #if defined(_MSC_VER)
   SYSTEM_INFO s;
   GetSystemInfo(&s);
-  return Min(s.dwNumberOfProcessors, MAX_THREADS);
+  return std::min(int(s.dwNumberOfProcessors), MAX_THREADS);
 #else
 
 #  if defined(_SC_NPROCESSORS_ONLN)
-  return Min(sysconf(_SC_NPROCESSORS_ONLN), MAX_THREADS);
+  return std::min(sysconf(_SC_NPROCESSORS_ONLN), MAX_THREADS);
 #  elif defined(__hpux)
   struct pst_dynamic psd;
   if (pstat_getdynamic(&psd, sizeof(psd), (size_t)1, 0) == -1)
       return 1;
-  return Min(psd.psd_proc_cnt, MAX_THREADS);
+  return std::min(psd.psd_proc_cnt, MAX_THREADS);
 #  else
   return 1;
 #  endif
@@ -232,7 +234,7 @@ int input_available() {
   GetNumberOfConsoleInputEvents(inh, &nchars);
 
   // Read data from console without removing it from the buffer
-  if (nchars <= 0 || !PeekConsoleInput(inh, rec, Min(nchars, 256), &recCnt))
+  if (nchars <= 0 || !PeekConsoleInput(inh, rec, std::min(int(nchars), 256), &recCnt))
       return 0;
 
   // Search for at least one keyboard event
index eb390cd14f224dc9f6c51211279168b9050dae97..dd849c15604813c9ba6acf005d807fa4e508f682 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include <cassert>
+#include <algorithm>
 
 #include "bitcount.h"
 #include "movegen.h"
@@ -516,12 +517,12 @@ namespace {
     // (including the final square), and all the squares between the rook's initial
     // and final squares (including the final square), must be vacant except for
     // the king and castling rook.
-    for (Square s = Min(kfrom, kto); s <= Max(kfrom, kto); s++)
+    for (Square s = std::min(kfrom, kto); s <= std::max(kfrom, kto); s++)
         if (  (s != kfrom && s != rfrom && !pos.square_is_empty(s))
             ||(pos.attackers_to(s) & pos.pieces(them)))
             return mlist;
 
-    for (Square s = Min(rfrom, rto); s <= Max(rfrom, rto); s++)
+    for (Square s = std::min(rfrom, rto); s <= std::max(rfrom, rto); s++)
         if (s != kfrom && s != rfrom && !pos.square_is_empty(s))
             return mlist;
 
index 12485fbb780fb64026e359bc97cdd271ea9c2599..0f6a3febeb98d92a8e50232fcb16df4e1bd98716 100644 (file)
@@ -22,6 +22,7 @@
 #include <fstream>
 #include <iostream>
 #include <sstream>
+#include <algorithm>
 
 #include "bitcount.h"
 #include "movegen.h"
@@ -223,7 +224,7 @@ void Position::from_fen(const string& fenStr, bool isChess960) {
 
   // Convert from fullmove starting from 1 to ply starting from 0,
   // handle also common incorrect FEN with fullmove = 0.
-  startPosPly = Max(2 * (startPosPly - 1), 0) + int(sideToMove == BLACK);
+  startPosPly = std::max(2 * (startPosPly - 1), 0) + int(sideToMove == BLACK);
 
   st->key = compute_key();
   st->pawnKey = compute_pawn_key();
@@ -1330,7 +1331,7 @@ int Position::see(Move m) const {
   // Having built the swap list, we negamax through it to find the best
   // achievable score from the point of view of the side to move.
   while (--slIndex)
-      swapList[slIndex-1] = Min(-swapList[slIndex], swapList[slIndex-1]);
+      swapList[slIndex-1] = std::min(-swapList[slIndex], swapList[slIndex-1]);
 
   return swapList[0];
 }
@@ -1502,7 +1503,7 @@ bool Position::is_draw() const {
   // Draw by repetition?
   if (!SkipRepetition)
   {
-      int i = 4, e = Min(st->rule50, st->pliesFromNull);
+      int i = 4, e = std::min(st->rule50, st->pliesFromNull);
 
       if (i <= e)
       {
index 30e0502086fddb09cd0b9d41222855f478c4e178..851797dd22d49abf8e62d414f35289fcaf8f86fa 100644 (file)
@@ -24,6 +24,7 @@
 #include <iostream>
 #include <sstream>
 #include <vector>
+#include <algorithm>
 
 #include "book.h"
 #include "evaluate.h"
@@ -128,7 +129,7 @@ namespace {
 
   inline Value futility_margin(Depth d, int mn) {
 
-    return d < 7 * ONE_PLY ? FutilityMargins[Max(d, 1)][Min(mn, 63)]
+    return d < 7 * ONE_PLY ? FutilityMargins[std::max(int(d), 1)][std::min(mn, 63)]
                            : 2 * VALUE_INFINITE;
   }
 
@@ -144,7 +145,7 @@ namespace {
 
   template <bool PvNode> inline Depth reduction(Depth d, int mn) {
 
-    return (Depth) Reductions[PvNode][Min(d / ONE_PLY, 63)][Min(mn, 63)];
+    return (Depth) Reductions[PvNode][std::min(int(d) / ONE_PLY, 63)][std::min(mn, 63)];
   }
 
   // Easy move margin. An easy move candidate must be at least this much
@@ -290,7 +291,7 @@ namespace {
         *dangerous = true;
     }
 
-    return Min(result, ONE_PLY);
+    return std::min(result, ONE_PLY);
   }
 
 } // namespace
@@ -372,7 +373,7 @@ bool think(Position& pos, const SearchLimits& limits, Move searchMoves[]) {
 
   // Set best NodesBetweenPolls interval to avoid lagging under time pressure
   if (Limits.maxNodes)
-      NodesBetweenPolls = Min(Limits.maxNodes, 30000);
+      NodesBetweenPolls = std::min(Limits.maxNodes, 30000);
   else if (Limits.time && Limits.time < 1000)
       NodesBetweenPolls = 1000;
   else if (Limits.time && Limits.time < 5000)
@@ -416,7 +417,7 @@ bool think(Position& pos, const SearchLimits& limits, Move searchMoves[]) {
   // Do we have to play with skill handicap? In this case enable MultiPV that
   // we will use behind the scenes to retrieve a set of possible moves.
   SkillLevelEnabled = (SkillLevel < 20);
-  MultiPV = (SkillLevelEnabled ? Max(UCIMultiPV, 4) : UCIMultiPV);
+  MultiPV = (SkillLevelEnabled ? std::max(UCIMultiPV, 4) : UCIMultiPV);
 
   // Wake up needed threads and reset maxPly counter
   for (int i = 0; i < Threads.size(); i++)
@@ -526,7 +527,7 @@ namespace {
         Rml.bestMoveChanges = 0;
 
         // MultiPV loop. We perform a full root search for each PV line
-        for (MultiPVIdx = 0; MultiPVIdx < Min(MultiPV, (int)Rml.size()); MultiPVIdx++)
+        for (MultiPVIdx = 0; MultiPVIdx < std::min(MultiPV, (int)Rml.size()); MultiPVIdx++)
         {
             // Calculate dynamic aspiration window based on previous iterations
             if (depth >= 5 && abs(Rml[MultiPVIdx].prevScore) < VALUE_KNOWN_WIN)
@@ -534,11 +535,11 @@ namespace {
                 int prevDelta1 = bestValues[depth - 1] - bestValues[depth - 2];
                 int prevDelta2 = bestValues[depth - 2] - bestValues[depth - 3];
 
-                aspirationDelta = Min(Max(abs(prevDelta1) + abs(prevDelta2) / 2, 16), 24);
+                aspirationDelta = std::min(std::max(abs(prevDelta1) + abs(prevDelta2) / 2, 16), 24);
                 aspirationDelta = (aspirationDelta + 7) / 8 * 8; // Round to match grainSize
 
-                alpha = Max(Rml[MultiPVIdx].prevScore - aspirationDelta, -VALUE_INFINITE);
-                beta  = Min(Rml[MultiPVIdx].prevScore + aspirationDelta,  VALUE_INFINITE);
+                alpha = std::max(Rml[MultiPVIdx].prevScore - aspirationDelta, -VALUE_INFINITE);
+                beta  = std::min(Rml[MultiPVIdx].prevScore + aspirationDelta,  VALUE_INFINITE);
             }
             else
             {
@@ -584,7 +585,7 @@ namespace {
                 // protocol requires to send all the PV lines also if are still
                 // to be searched and so refer to the previous search's score.
                 if ((value > alpha && value < beta) || current_search_time() > 2000)
-                    for (int i = 0; i < Min(UCIMultiPV, (int)Rml.size()); i++)
+                    for (int i = 0; i < std::min(UCIMultiPV, (int)Rml.size()); i++)
                     {
                         bool updated = (i <= MultiPVIdx);
 
@@ -606,7 +607,7 @@ namespace {
                 // research, otherwise exit the fail high/low loop.
                 if (value >= beta)
                 {
-                    beta = Min(beta + aspirationDelta, VALUE_INFINITE);
+                    beta = std::min(beta + aspirationDelta, VALUE_INFINITE);
                     aspirationDelta += aspirationDelta / 2;
                 }
                 else if (value <= alpha)
@@ -614,7 +615,7 @@ namespace {
                     AspirationFailLow = true;
                     StopOnPonderhit = false;
 
-                    alpha = Max(alpha - aspirationDelta, -VALUE_INFINITE);
+                    alpha = std::max(alpha - aspirationDelta, -VALUE_INFINITE);
                     aspirationDelta += aspirationDelta / 2;
                 }
                 else
@@ -766,8 +767,8 @@ namespace {
     // Step 3. Mate distance pruning
     if (!RootNode)
     {
-        alpha = Max(value_mated_in(ss->ply), alpha);
-        beta = Min(value_mate_in(ss->ply+1), beta);
+        alpha = std::max(value_mated_in(ss->ply), alpha);
+        beta = std::min(value_mate_in(ss->ply+1), beta);
         if (alpha >= beta)
             return alpha;
     }
@@ -1688,8 +1689,8 @@ split_point_start: // At split points actual search starts from here
     Value v = value_from_tt(tte->value(), ply);
 
     return   (   tte->depth() >= depth
-              || v >= Max(VALUE_MATE_IN_PLY_MAX, beta)
-              || v < Min(VALUE_MATED_IN_PLY_MAX, beta))
+              || v >= std::max(VALUE_MATE_IN_PLY_MAX, beta)
+              || v < std::min(VALUE_MATED_IN_PLY_MAX, beta))
 
           && (   ((tte->type() & VALUE_TYPE_LOWER) && v >= beta)
               || ((tte->type() & VALUE_TYPE_UPPER) && v < beta));
@@ -2009,9 +2010,9 @@ split_point_start: // At split points actual search starts from here
     // Rml list is already sorted by score in descending order
     int s;
     int max_s = -VALUE_INFINITE;
-    int size = Min(MultiPV, (int)Rml.size());
+    int size = std::min(MultiPV, (int)Rml.size());
     int max = Rml[0].score;
-    int var = Min(max - Rml[size - 1].score, PawnValueMidgame);
+    int var = std::min(max - Rml[size - 1].score, int(PawnValueMidgame));
     int wk = 120 - 2 * SkillLevel;
 
     // PRNG sequence should be non deterministic
index e29d4e467fec7a9f3f4f8e34983b9d210e323959..b69169007e2ec15b0e353986d5ccd9b18ed5fa2a 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include <cmath>
+#include <algorithm>
 
 #include "misc.h"
 #include "search.h"
@@ -64,7 +65,7 @@ namespace {
     4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 2, 2, 2, 2,
     2, 1, 1, 1, 1, 1, 1, 1 };
 
-  int move_importance(int ply) { return MoveImportance[Min(ply, 511)]; }
+  int move_importance(int ply) { return MoveImportance[std::min(ply, 511)]; }
 
 
   /// Function Prototypes
@@ -114,28 +115,28 @@ void TimeManager::init(const SearchLimits& limits, int currentPly)
 
   // We calculate optimum time usage for different hypothetic "moves to go"-values and choose the
   // minimum of calculated search time values. Usually the greatest hypMTG gives the minimum values.
-  for (hypMTG = 1; hypMTG <= (limits.movesToGo ? Min(limits.movesToGo, MoveHorizon) : MoveHorizon); hypMTG++)
+  for (hypMTG = 1; hypMTG <= (limits.movesToGo ? std::min(limits.movesToGo, MoveHorizon) : MoveHorizon); hypMTG++)
   {
       // Calculate thinking time for hypothetic "moves to go"-value
       hypMyTime =  limits.time
                  + limits.increment * (hypMTG - 1)
                  - emergencyBaseTime
-                 - emergencyMoveTime * Min(hypMTG, emergencyMoveHorizon);
+                 - emergencyMoveTime * std::min(hypMTG, emergencyMoveHorizon);
 
-      hypMyTime = Max(hypMyTime, 0);
+      hypMyTime = std::max(hypMyTime, 0);
 
       t1 = minThinkingTime + remaining<OptimumTime>(hypMyTime, hypMTG, currentPly);
       t2 = minThinkingTime + remaining<MaxTime>(hypMyTime, hypMTG, currentPly);
 
-      optimumSearchTime = Min(optimumSearchTime, t1);
-      maximumSearchTime = Min(maximumSearchTime, t2);
+      optimumSearchTime = std::min(optimumSearchTime, t1);
+      maximumSearchTime = std::min(maximumSearchTime, t2);
   }
 
   if (Options["Ponder"].value<bool>())
       optimumSearchTime += optimumSearchTime / 4;
 
   // Make sure that maxSearchTime is not over absoluteMaxSearchTime
-  optimumSearchTime = Min(optimumSearchTime, maximumSearchTime);
+  optimumSearchTime = std::min(optimumSearchTime, maximumSearchTime);
 }
 
 
@@ -156,6 +157,6 @@ namespace {
     float ratio1 = (TMaxRatio * thisMoveImportance) / float(TMaxRatio * thisMoveImportance + otherMovesImportance);
     float ratio2 = (thisMoveImportance + TStealRatio * otherMovesImportance) / float(thisMoveImportance + otherMovesImportance);
 
-    return int(floor(myTime * Min(ratio1, ratio2)));
+    return int(floor(myTime * std::min(ratio1, ratio2)));
   }
 }
index 9ac0787e1c08b045c6f45b48c3f15c43395e8a7a..841c794ad0b87691043b7d3a58c692b6fdb8d5f5 100644 (file)
@@ -46,9 +46,6 @@ typedef unsigned __int64 uint64_t;
 
 #endif
 
-#define Min(x, y) (((x) < (y)) ? (x) : (y))
-#define Max(x, y) (((x) < (y)) ? (y) : (x))
-
 ////
 //// Configuration
 ////