THIS VERSION is by WHMoweryJr. 

The 2-threaded mp seems OK 
on my 2-cpu machine. 

The basic engine is VERY strong 
and 
the learning works.  

The mp design has been furthered past beta5c...

The MP design now detects the actual #cpu's (NumberProcessors) 
and upper limits the functionality of NumberThreads to NumberProcessors.
If you set "Number Threads" to 16 on a 4-core,
we only do 4 threads...


Legal details
-------------

DeepLearningToga 1.5.21a
based on Fruit 2.1 by Fabien Letouzey and
Toga II 1.4beta5c by Thomas Gaksch and
Toga II 1.4.1SE, settings by Chris Formula and
TogaII1.4WHMlearnCFS56 by William Mowery and 
LearningTogaII14.12 by William Mowery and
LearningTogaII14_24b by WHM and 
Toga II 1.4.3JDbeta14 by J Donald.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA

See the file "copying.txt" for details.


General
-------

DeepLearningToga based on 
LearningToga based on 
Toga II based on 
Fruit 2.1
is a UCI-only chess engine.  

This distribution comes with
Windows executable 
and platform-independent source code.



Official distribution 
---------------------

You can download the GNU GPL Package (incl. sources) 
with Toga II based on Fruit at: http://www.superchessengine.com/
or http://www.computerchess.info/tdbb/phpBB3/
or send an email to togaII@gmx.de
or "shaun.brewer@totalise.co.uk" <shaun.brewer@totalise.co.uk>
or the Toga Developers Discussion Board.  


Version
-------

DeepLearningToga 1.5.21a
is based on 
Fruit 2.1 by Fabien Letouzey 
and
Toga II 1.4beta5c & Toga II 1.2.1a by Thomas Gaksch
and
Toga 1.4.1SE {parameter changes by Chris Formula}.
and
TogaII1.4WHMlearnCFS56 {WHM and CF}
and
LearningTogaII14.12 & LearningTogaII14_24b by William H. Mowery Jr.  
and
Toga II 1.4.3JDbeta14 mods from 1.4.1SE by Jerry Donald.

Following changes and extensions made:

- Positional mode added.  Tactical mode is like beta5c & 1.4.1SE {when History Value is 100%}.  
- Mixed mode added for mp use.  Half threads Tactical and half threads Positional.  
- Piece Invasion moved into eval_king().  pi_attack_tot compressed with AttackTotArray[], halves the peak power.  
     static const int AttackTotArray[32] = { // WHM to compress piece invasion.  
        0,  256,  512,  768, 1024, 1280, 1536, 1792, 1920, 1984, 2016, 2032, 2040, 2044, 2046, 2047, 
     2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, };
     In 1.5.14 divisor is 128 to get initial slope to 2.  beta5c was about 3 for slope...
- changes in search smp design by WHMoweryJr
     multi-processor (mp) design furthered in a major way...
     seems to work!  Wish i had more than 1 core.  
- multipv is back and working.  A final sort is needed if the moves are out of order.
     The moves are reported in the order of the sort at the previous depth.  
- improved history pruning - Tactical and Positional modes added.  
- history drop pruning.  
- futility pruning programmable to depth 6 via UCI. 1.4.1SE values were 100,200,300,200,300.  
     stabilized with (sort->value < FutilityHistory[depth])
     Forks and forcing moves assumed to have good histories.  
- lazy evaluation added for nps
     eval_passer() always done because FreePasser + PassedEndgameMax >= 200.  
     second lazy eval threshold for eval_piece() added. 
     lazy eval thresholds increased for (beta > 1 + alpha) case.
- evaluation knight outpost  Thomas
- code speedup in full_search(),  WHM
     board, move_do
- Ryan Benitez's GambitFruit speedup of eval_piece() added.  
- Endgame bitbases by Daniel Shawul (Scorpio) added.  
  Mate stuff not yet successfully integrated, only draw values used.  
  Years ago i explained that fruit type engines could only use just the draw values from egbb.  
- UCI options increased:

   // first 4 are not displayed by Shredder 9 GUI
   { "Hash",     true, "64",              "spin",   "min 4 max 4096", NULL }, // 11/25/08 up to 64 for today's machines.  
   { "MultiPV",  true, "1",               "spin",   "min 1 max 40",   NULL },
   { "Ponder",   true, "false",           "check",  "",               NULL },
 
   { "Number Threads",        true, "2",  "spin",   "min 1 max 16",   NULL }, // 11/25/08
   { "OwnBook",  true, "true",            "check",  "",               NULL }, // Fritz GUI displays this.  20-21 top. 
   
   { "BookFile", true, "performance.bin", "string", "",               NULL },
   { "Max Book Moves", true, "30",        "spin",   "min 0 max 40",   NULL }, // WHM:
// { "Analyze Book",   true, "true",      "check",  "",               NULL }, // WHM: TODO do a MultiPV look at book
                                                                              //      note Fritz/Chessbase GUI does this with .ctg books.  
   { "Bitbases Path",       true, "c:/egbb/", "string", "",               NULL },
   { "Bitbases Cache Size", true, "8",        "spin",   "min 1 max 1024", NULL },
   
   { "Playing Style",            true, "Tactical", "combo", "var Tactical var Positional var Mixed", NULL }, // 11/25/08 to "Tactical".  
   { "Tactical History Value",   true, "80",       "spin",  "min 50 max 100",                        NULL }, // 11/25/08 to 75.  
   { "Positional History Value", true, "75",       "spin",  "min 50 max 100",                        NULL },
   { "WSD",                      true, "false",    "check", "",                                      NULL }, // Win or Save Draw by WHM, good for Junior?  

   { "King Attack",              true, "100",   "spin", "min 0 max 200", NULL },
   { "King Safety",              true, "100",   "spin", "min 0 max 200", NULL },
   { "Pawn Structure",           true, "100",   "spin", "min 0 max 200", NULL },
   { "Passed Pawns",             true, "100",   "spin", "min 0 max 200", NULL },
   { "Piece Square Tables",      true, "100",   "spin", "min 0 max 200", NULL },
   { "Piece Activity",           true, "100",   "spin", "min 0 max 200", NULL },
   { "Material",                 true, "100",   "spin", "min 0 max 200", NULL }, // TODO: replace this with q,r,b,n,p opening & endgame, 10 UCI guys.  
   { "Bishop Pair Opening",      true, "50",    "spin", "min 0 max 100", NULL },
   { "Bishop Pair Endgame",      true, "70",    "spin", "min 0 max 100", NULL },
   { "Pawn Holes",               true, "false", "check", "",             NULL },
   { "Toga Lazy Eval",           true, "true",  "check", "",             NULL },

   //-----------------------------------------------------------------------------
   
   // 21 items bottom.
   
   { "Debug", true, "false", "check", "", NULL }, // sets UCI_debug true, UCI_debug is extern in util.h, writes to "toga.log"
   
   // JAS
   // search X seconds for the best move, equal to "go movetime"
   { "Search Time",  true, "0",   "spin",  "min 0 max 3600000", NULL },
   // search X plies deep, equal to "go depth"
   { "Search Depth",  true, "0",   "spin",  "min 0 max 30", NULL },
   // JAS end
   
   // WHM learning inserted.  
   //   1,   4,   4,   6,   12  material advantage algorithms 
   //   P    N    B    R     Q
   // versus 
   // territotial control algorithms using recipricals 
   // 1/1, 1/4, 1/4, 1/6, 1/12 for PNBRQ, 
   // pawn control of a square is most powerful, king control least.  {Junior}
   { "Use Learn",                 true, "true",           "check",  "",                                      NULL }, // 11/25/08 back to true for baseline.  
   { "Generate Learn",            true, "false",          "check",  "",                                      NULL },
   { "Learn Weighting",           true, "Territorial",    "combo",  "var Material var Flat var Territorial", NULL },
   { "Learn Positions",           true, "17",             "spin",   "min 1 max 29",                          NULL },
   { "Learn Weight",              true, "20",             "spin",   "min 1 max 100",                         NULL },
   { "Learn Game Lost Threshold", true, "275",            "spin",   "min 200 max 600",                       NULL },
   { "Learn Start Threshold",     true, "35",             "spin",   "min 0 max 200",                         NULL },
   { "Information File",          true, "toga_info.finf", "string", "",                                      NULL }, // .finf files available  
   
   { "Quiescence Check Plies", true, "1", "spin", "min 0 max 2", NULL },
   
   { "Delta Pruning", true, "true", "check", "", NULL },
   { "Delta Margin",  true, "50",   "spin",  "min 0 max 500", NULL },
   
   { "Futility Depth",    true, "4",    "spin",  "min 0 max 6",   NULL }, // beta5c was 3, 1.4.1SE was 5, 1.2.1a was 2.  11/25/08 max to 6, baseline 4.  
   { "Futility Margin 1", true, "100",  "spin",  "min 0 max 400", NULL }, // 1.4.1SE was 100,200,300,200,300, CFS==Chris Formula Setting
   { "Futility Margin 2", true, "310",  "spin",  "min 0 max 600", NULL }, // 1.4beta5c was 100,300,350, Futility Depth 3.
   { "Futility Margin 3", true, "310",  "spin",  "min 0 max 700", NULL },
   { "Futility Margin 4", true, "310",  "spin",  "min 0 max 800", NULL },
   { "Futility Margin 5", true, "310",  "spin",  "min 0 max 900", NULL },
   { "Futility Margin 6", true, "310",  "spin",  "min 0 max 900", NULL },

   { NULL, false, NULL, NULL, NULL, NULL, },

--------------------------------------------

Thomas excerpts: 

A very big thanks to Daniel Shawul 
for sharing his great endgame bitbases and his dll.

EGBBs
-----
    Toga uses the Scorpio endgame bitbases up to 5 pieces.
   
    Installation 
    ------------
       First You have to download the 5men bitbases from Leo Dijksman's WBEC site 
       http://www.wbec-ridderkerk.nl . The egbbs are 340mb in size. Then put them 
       anywhere in your computer. The default path is c:\egbb\ (Windows) or /usr/share/egbb (Unix/Linux) but you can change this in the uci options. 
       The egbbdll.dll (Windows) or egbbso.so (Linux/Unix) must be in the same folder as the bitbase files.

       Also in the Toga Developer's Discussion Board.  

Thanks Fabien Letouzey for the great source code of the program Fruit 2.1.

Special thanks to
Dieter Eberle, Karl-Heinz Sntges, 
Shaun Brewer for testing Beta Versions.
A big thank to Dieter Eberle for his setting.
Orlando Mouchel for bugfixes and new ideas.
Wilhelm Hudetz for the Logo.

Without their help i{Thomas} 
wouldnt be able to increase the playing strenghth.


Thomas Gaksch
--------------------------------------------


Thanks to Thomas and Mr. Hack 
for the transposition tables improvements.   

Thanks to Thomas for the interface to the bitbases, 
and Daniel Shawl for them {Scorpio}.

Thanks to Thomas for using TROPISM for queen-mobility 
giving us the Queen versus Rook mate, nice job Thomas!  

Thanks to Shaun Brewer for the Toga Discussion Board 
and many many hours of testing...

Thanks to Kevin Frayer for Toga 1.1 Book in .ctg format.
Great job as it tests exceptionally smart!  
Looking forward to new and better books!
Kevin is using Toga II 1.4.1SE for his book work 
so that is why i chose to be as close as possible
to the 1.4.1SE parameters for 
this engine, to synergize with Kevin's work.  

Thanks to Denis Mendoza for his 
countless hours of compiling and testing
and his extreme Toga ferver...

Thanks to Chris Formula for the 
settings in Toga II 1.4.1SE
which led our Gauntlet board for a long time...

Thanks to Jerry Donald for his excellent ideas...


William Mowery Jr.

WHMoweryJr@yahoo.com


More changes:

Learning from LearningToga added...
Run 30,000 games versus strong engines, 
using Kevin's book 
and "Generate Learn" true.  
Be sure to use Toga II 1.4beta5c with King Safety at 150 & Lazy Eval at 250.
for some of those games.  
Be sure to use Toga II 1.4.1SE with King Safety at 150 & Lazy Eval at 250.
for some of those games.  
Fritz 7,8,9,10, & 11.
Most Rybka's.
Shredder 11.
Junior 10.
Naum.


1) CheckDepth indexed by [ThreadId]
2) futility depth adjustable 2-6 via UCI.  
  Chris Formula had it at 5 in Toga II 1.4.1SE, and it was 3 in beta5c, it was 2 in Toga II 1.2.1a  
  a) futility further stabilized with (sort->value < FutilityHistory[depth])
  b) alpha < ValueEvalInf && beta > -ValueEvalInf constraint added.
  c) do_futility(board) constraint added.
3) all pruning constraints added: ( new_depth < depth            && 
                                    sort->value < 16384          &&
                                    prunable                     && 
                                   !move_check                   &&
                                   !move_is_dangerous(move,board)  )
Pawn captures and bad captures now also return a history value in sort->value.  
Fruit 2.1 had no depth 1 pruning to insure that the history algorithm was well fed with a large number of moves...
In that same light we pass all first-time-never-been-tried moves {new piece-square}.  
The initial history value for an untried move is 16384.  
If the move fails, history value drops to 8192... 
If the move passes history value stays at 16384 and becomes a perfect history piece-square.  
5) History pruning for NodePV boards in Tactical mode.  {New style like beta5c & 1.4.1SE}
   History pruning for non-NodePV boards in Positional mode.  {Old style like fruit 2.1 & TogaII121 & LearningTogaII14_24b}
6) attack_set() in full_search() is passed on to full_no_null(), why do the same thing twice?
7) NodeAll not used. NODE_OPP() not used. Obsolete. Adding NodeShort is not needed.
8) Trans: extra unused argument removed, entry_t ** entry.
  No use of NodePV trans is ever needed.  First because trans_move is first in NodePV move sorting, 
  and second because NodePV boards are less than 0.1% of the total boards early in game.  
  Third, every attempt to add NodePV trans use - has dramatically lowered ELO!!!!!!!
  SmartReplace has been upgraded.  Works well with AlwaysWriteTrans=false now, HOWEVER,   
  BASELINE is AlwaysWriteTrans=true for the case of trans tables getting totally filled up!  
  SmartValue totally removed.  That idea never worked and would destroy the SmartReplace upgrade.
  SmartMove is as was {still a good idea, thank-you Mr. Hack}...
9) full_no_null() returns best_move in pv[0].
  pv_cat() was moved to where the *best_move assignment was.
  ASSERT(pv[0]==move); added to full_no_null() to show that the best_move is in pv[0].  
10) DEBUG ASSERT's are turned on. Set a breakpoint in util.cpp, my_fatel(), last brace, to use them...
   All broken ASSERT's fixed.
11) Added ASSERTS as needed to DEBUG this whole thing...
12) Skip a move logic added to full_root() as part of the multi-core design upgrade...
13) search.cpp major revisions to the mp design... Seems to work. {Proof/not}? by Gauntlet.
14) Dual lazy eval thresholds in eval.cpp
  a) NodePV lazy thresholds for (beta > 1 + alpha) case 
   increased over the normal/fast thresholds.
    lazy_eval_cutoff:     {const}
    lazy_eval_cutoff_PV:  {const}
    lazy_piece_cutoff:    {const}
    lazy_piece_cutoff_PV: {const}
  b) eval_passer() always done as it is much faster than eval_king() and the slowest eval_piece(),
    also the sum of PassedEndgameMax plus FreePasser is > 200, something we never want to cut off...
15) if either root move or ponder move changes, then change is set. A significant percent of the time after
    ponder move changes, root move changes at the next depth, so setting change turns early exit off...
16) History drop values:        12288, 12288,  8192,  8192,  4096,  4096,  const.  
17) FutilityHistory values:     16384, 16384, 12288, 12288,  9830,  9830,  const.  
19) TROPISM macro aded, used in eval_piece() for queen mobility.  
20) The mp design is all centered around last_complete_depth.
   When all the threads scheduled to hit a depth, complete that depth
     AND
   last_complete_depth is less than that depth
   THEN
   last_complete_depth is set to that depth. {ALL ROOT MOVES FOR THAT DEPTH HAE BEEN SEARCHED}

   SearchBestAtDepth{DepthMax][1] was added
   to do the keeping of the best move information.
   After we complete a depth, SearchBestAtDepth{depth][1] is up to date/time.
   After we exit search, we get the best value at last_complete_depth.
   Then any values >= that value at greater depths are searched for.
   Threads sequence thru the depths at an increment of DepthInc
   Threads start at START_DEPTH(ThreadId)
21) material.cpp changes:

// constants and variables

static /*UCI*/ int BishopPairOpening = 50; // UCI now...
static /*UCI*/ int BishopPairEndgame = 70; // UCI now...

static const int OpeningExchangeBonus = 20; /* Thomas trade bonus win piece for pawn */
static const int EndgameExchangeBonus = 20;

// CFS == Chris Formula Setting == TogaII1.4.1SE
// WHM added 5,20,20,30,60 to p,n,b,r,q

static const int PawnOpening   =  75; // was 100   TogaII1.2.1 & TogaII1.4.1SE == 70   fruit 2.1 & TogaII1.4beta5c == 80
static const int PawnEndgame   =  95; // was 100   TogaII1.2.1 & TogaII1.4.1SE == 90
static const int KnightOpening = 345;
static const int KnightEndgame = 335; // CFS = 315, was 325
static const int BishopOpening = 345;
static const int BishopEndgame = 335; // CFS = 315, was 325
static const int RookOpening   = 520; // 2 * 520 = 1040 just 5 more than QueenOpening, DLT 1.5.20 based on 1.4.3SE.  520 / 345 about 1.5, good.  
static const int RookEndgame   = 530;
static const int QueenOpening  = 1035; // 1000==fruit21 975==Toga.
static const int QueenEndgame  = 1035; // 1000==fruit21 975==Toga.

   Also the following routine was made and tested to use the same code for both black and white.  
   
static int white_multiplier(const int wp, const int wn, const int wb, const int wr, const int wq,
                            const int bp, const int bn, const int bb, const int br, const int bq); // WHM; consolidated.

The above routine was used to speedup early in game plus to use the same code for both Black and White...

And finally the trade bonus area stuff...

   // trade bonus 
   // only kicks in for probable wins...
   // groups of pieces 
   // which in benign positions 
   // should work to a win...
   
   white_bonus = white_trade_bonus(owf, wt, wpc, wp, wn, 
                                   obf, bt, bpc, bp, bn );

   black_bonus = white_trade_bonus(obf, bt, bpc, bp, bn, 
                                   owf, wt, wpc, wp, wn );
   
   if (white_bonus && black_bonus) {
      ; // no-op
   }
   else if (white_bonus) {
      opening += OpeningExchangeBonus;
      endgame += EndgameExchangeBonus;
   }
   else if (black_bonus) {
      opening -= OpeningExchangeBonus;
      endgame -= EndgameExchangeBonus;
   }
   
static bool white_trade_bonus(const int owf, const int wt, const int wpc, const int wp, const int wn, 
                              const int obf, const int bt, const int bpc, const int bp, const int bn ) {

   ASSERT(wp + wpc == wt);
   ASSERT(bp + bpc == bt);
   
   // 1.5.12 redone.  Forward looking.   Win combo's only.  
   if (wpc > bpc  &&  wp >= 1) { // more non-pawn pieces AND a pawn.  
      if (owf > obf + 300  &&  wt >= bt) { // up a full minor, R+N+N vs r+b.  
         if (wn <= 1+bn  ||  wp > bp) { // not only N+N vs b
            return true;
         }
      }
      if (wp > bp) { // lesser power advantage cases...
         if (owf > obf + 100  &&  wn <= 1+bn) { // up a half minor, B+N+P+P vs r+p
            return true;
         }
         if (owf > obf  &&  wn <= bn) { // R+R+P+P vs q+p
            return true;
         }
      }
   }

   return false;
}

22) new_pv[] was replaced by pv[] in the verification search area for speed.  
pv_copy() is not used there anymore, as it is slower but bug-free!  
Verification search and null search hardwired as everyone is satisfied that "Always" "Always" is best.  
23) full_new_depth() simplified.  ELO is very sensitive to errors in this!  
26) "Pawn Holes" added for skipping mobility of opp's pawn attack squares...
   In 1.5.14 the pawn holes mobility stuff is only done for beta > 1 + alpha case, 
   all pruning plus 99.9% of search boards.  
   In 1.5.16 "Pawn Holes" is baselined false.  More like 1.4.1SE & 1.4.2JD.  
27) Win or Save Draw, by WHM added, UCI bool "WSD".  
   Was a Junior killer in years gone by...
   Given that Junior beat Rybka twice in tourneys, (Dec 2007 and early 2008)
   this might be a good idea...
29) move_is_dangerous(move,board) includes all rank passer moves now {except doubled trailing passers}, 
    not just to Rank7 moves only.  Debugged with passed_pawn_move().  
    Found that doubled passers only count the lead passer - neat!  
30) entry->date_flags = (trans->date << 4) | ENTRY_FLAGS(entry);
   added to trans_retrieve().
   AlwaysReplace area improved...  AlwaysReplace true is still the baseline...
32) Free queen check draws added.  For those high queen-work positions...
33) All short searches in full_search() are either full_no_null() or full_quiescence().  Speed, nps.  
   full_no_null() upgraded to do both NodeCut and NodePV.  
34) Razoring gone.  Weak.  
35) TODO: 2 rooks versus queen trade moving into good captures region, see_move() >= -25; 
36) All NodePV promotes to queen are good captures.  NodeCut still has them as bad captures.  
37) Bishop pair values are now UCI inputs.   
38) 4-parameter Pawney History is back.  11/24/08 baselined at 2-parameter.   
40) IID reduction area sped up using full_no_null() which always returns a move.  
41) 1.4.08: checking moves are never dropped.  
            bad captures have history HistoryBadCap == 8191.  
            captures close to king with see_value > -ValueBishop are now good captures.  
44) full_new_depth(): Extended stuff simplified somewhat, uses (new_depth == depth) as input to full_search().  
45) No checking moves are dropped.  
    No checking moves are reduced.  
46) "Learn Threshold" added to UCI options.
   Rybka 1.0 Beta 32-bit often snatches draw from win by endgame errors {no tablebases}.  
   Assuming a loss at a lower value catches these games that her big sister would win.  
   Also the KRPKQ draw stuff in the egbb's seems to work.  So, with egbb's we can lower the threshold.  
48) Experimental SmartMove the cutout moves only.  {best_value >= beta}  
   UseCutoutMovesOnly const bool false in trans.h  TODO: test it?  
50) nhits {uint16} added to trans tables entries.  
   Replacement score modified by nhits.  
   score -= entry->nhits;
   Trans hitches up much less now!  
51) 1.4.61 Algorithmically equivalent to 1.4.56 which measures as deep as beta5c.  
   The Tactical History Value of 75 seems stronger against Rybka.
54) 1.4.62:  history_score into full_new_depth()
55) Lazy thresholds optimized.  
static  const  int lazy_piece_cutoff    = 125; // WHM
static  const  int lazy_piece_cutoff_PV = 175; // WHM
static  const  int lazy_eval_cutoff_PV  = 335; // WHM
static  const  int lazy_eval_cutoff     = 275;
56) "Number Threads" UCI input added.  
57) trapped_king[ColourNb] bool added to king attack.  Baseline not used.  
58) UseOpenBoardPenalty added to eval.cpp  11/22/08 set to false, Baseline NOT USED.  
            if (UseOpenBoardPenalty) {                       // 1.4.65
               if (trapped_king[me]) {                       // 1.4.63
                  penalty *=  ((64 + 32) - board->piece_nb); // 1.4.63, 1.4.65 50% max instead of 100%
                  penalty /=   (64);                         // 1.4.63
               } else if (H1==king || H8==king || A1==king || A8==king) {
                  penalty *= ((128 + 32) - board->piece_nb); // 1.4.65
                  penalty /=  (128);                         // 1.4.65
// 1.4.69      } else {
// 1.4.69         penalty *= ((256 + 32) - board->piece_nb); // 1.4.65
// 1.4.69         penalty /=  (256);                         // 1.4.65
               }
            }
59) The bad determination/algorithm is now based on SearchBestAtDepth and has been moved into search_smp().  
For a 35 centipawn drop or more from the previous depth
61) 1.4.73:  Another attempt to use bad for the second and third repeats of our best_move.  
If we are going to settle for a repeat draw, 
then on the second and third times at this move & board, 
use some extra time to make sure we aren't missing a WIN.  

// WHM 11/22/08 below.  
62) 1.5.01 FutilityHistory[7] added to search_full.cpp for history score thresholding anded with the futility pruning.  
   We now drop moves based on very low history scores
   and we drop moves by futility pruning only for reasonably low history scores.  
static const int  HistoryDropDepth = 6; //         0      1      2       3      4      5     6    ==   depth
static const int  HistoryDropValues[6 + 1]    = {16384, 12288, 12288,  8192,  8192,  4096,  4096, };
static const int  FutilityHistory[6 + 1]      = {16384, 14336, 14336, 12288, 12288, 10240, 10240, }; // WHM 11/22/08
63) capture_is_good() augmented with lower see-Value() scores for captures adjacent to opp king.  Rybka lessons.  
64) "Number Threads" added as UCI input.  Lottsa re-initialization in parse_setoption() added also!  
65) Jerry Donald's queens only passed pawn invasion bonus added.  
66) Jerry Donalds pawn captures futility pruned added.  
67) If no queens and at least one minor...  Was in earlier versions but these are new values.  
   The history thresholds are shaped and these are flat (excepth depth 1).  
         if (FutilityMargins[1] > 105) FutilityMargins[1] = 105; // WHM 11/26/08
         if (FutilityMargins[2] > 220) FutilityMargins[2] = 220; // WHM 11/26/08
         if (FutilityMargins[3] > 220) FutilityMargins[3] = 220; // WHM 11/26/08
         if (FutilityMargins[4] > 220) FutilityMargins[4] = 220; // WHM 11/26/08
         if (FutilityMargins[5] > 220) FutilityMargins[5] = 220; // WHM 11/26/08
         if (FutilityMargins[6] > 220) FutilityMargins[6] = 220; // WHM 11/26/08
68) Added get_NumberProcessors() to search.cpp
   Initially called from main.cpp
   Most thread loops now look like:
   for (ThreadId = 0; ThreadId < MIN(NumberThreads,NumberProcessors); ThreadId++){
69) 1.5.20  RookOpening down from 530 to 520, 
   twice is 1040, 5 centi's more than opening queen.
   Also ratio of rook to minor is 1.5 opening.  
70) RookOpening back to 530...  TODO: Try RookOpening 520 and RookEndgame 540... or just RookEndgame 540.  
71) Commented out a use_learn in protocol.cpp

2 MP BUGFIX's
-------------
Added extern bool timer_is_running to search.h
If the time is not yet running,
we skip search_update_current() and longjmp().  

The bug caused by using pv_copy() 
in search_update_best()
has been fixed...  
That may have been the last bug.  {Well, almost?}  

UCI_debug was added to chase these down,  
via UCI option "Debug"

Third MP BUGFIX:
----------------

SearchInfo[ThreadId]->stopped set in every exit of search_smp()
and also in every exit of search_check().    

Hopefully that was the last bug as the 1-cpu is line for line stronger than the 
Rybka 1.0 Beta 32-bit after a small amount of learning...
15min1sec games on my 2.1 GHz Pentium.  

Fourth MP BUGFIX:
-----------------

It was possible to exit search_smp() before the time limit if all 63 ply were done very fast.
In that case the bool SearchInfo[ThreadId]->stopped was not set true. 
That left threads still running and the program hang.  
Added the following before the final brace in search_smp()

   // 11/26/08 put this in - for exit by depth getting to 64...
   SearchInfo[ThreadId]->stopped = true; // 1.5.05

   return;


TODO:
-----

1) The following UCI parameters need tuning versus each and every strong engine...
"Playing Style"  - Tactical, Positional, Mixed {prob not strong}.
"WSD"            - on/off, was a Junior killer in years gone by...

2) Endgame learning for boards with king + 3 or less pieces, 
both sides with equal forces {+ any pawns}...  
About 27 more .finf files...  ???
KQRR, KQRB, KQRN, 
KQBB, KQBN, 
KQNN, 
KRRB, KRRN, 
KRBB, KRBN, KRNN,
KBBN, KBNN, 
KQR, KQB, KQN, 
KRR, KRB, KRN, 
KBB, KBN, KNN, 
KQ, KR, KB, KN.  
KK

{OR} do we do a deliniation like the tablebases covering both Black and White?

KQRR_KQRR, . . .
still gotta do some thinkin here...


