X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmaterial.cpp;h=8a13d11559737ce36f3e6d88125e607131c55b7e;hp=9195880af4ccf5ffadd1abba7a226567007013b0;hb=bbd3e30b4e297877f1e1cad3e5b942175c58290b;hpb=3ed603cd64624d27de3f3f6e8f4e5dfccaaed420 diff --git a/src/material.cpp b/src/material.cpp index 9195880a..8a13d115 100644 --- a/src/material.cpp +++ b/src/material.cpp @@ -1,7 +1,7 @@ /* Stockfish, a UCI chess playing engine derived from Glaurung 2.1 Copyright (C) 2004-2008 Tord Romstad (Glaurung author) - Copyright (C) 2008 Marco Costalba + Copyright (C) 2008-2009 Marco Costalba Stockfish is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,6 +29,7 @@ #include "material.h" +using std::string; //// //// Local definitions @@ -36,6 +37,7 @@ namespace { + // Values modified by Joona Kiiski const Value BishopPairMidgameBonus = Value(109); const Value BishopPairEndgameBonus = Value(97); @@ -59,9 +61,9 @@ public: EndgameScalingFunctionBase* getESF(Key key, Color* c) const; private: - void add(const std::string& keyCode, EndgameEvaluationFunctionBase* f); - void add(const std::string& keyCode, Color c, EndgameScalingFunctionBase* f); - Key buildKey(const std::string& keyCode); + void add(const string& keyCode, EndgameEvaluationFunctionBase* f); + void add(const string& keyCode, Color c, EndgameScalingFunctionBase* f); + Key buildKey(const string& keyCode); struct ScalingInfo { @@ -90,7 +92,7 @@ MaterialInfoTable::MaterialInfoTable(unsigned int numOfEntries) { { std::cerr << "Failed to allocate " << (numOfEntries * sizeof(MaterialInfo)) << " bytes for material hash table." << std::endl; - exit(EXIT_FAILURE); + Application::exit_with_failure(); } clear(); } @@ -342,6 +344,8 @@ EndgameFunctions::EndgameFunctions() { add("KRKRP", BLACK, &ScaleKRKRP); add("KBPKB", WHITE, &ScaleKBPKB); add("KBKBP", BLACK, &ScaleKBKBP); + add("KBPPKB", WHITE, &ScaleKBPPKB); + add("KBKBPP", BLACK, &ScaleKBKBPP); add("KBPKN", WHITE, &ScaleKBPKN); add("KNKBP", BLACK, &ScaleKNKBP); add("KRPPKRP", WHITE, &ScaleKRPPKRP); @@ -350,7 +354,7 @@ EndgameFunctions::EndgameFunctions() { add("KRPKRPP", BLACK, &ScaleKRPKRPP); } -Key EndgameFunctions::buildKey(const std::string& keyCode) { +Key EndgameFunctions::buildKey(const string& keyCode) { assert(keyCode.length() > 0 && keyCode[0] == 'K'); assert(keyCode.length() < 8); @@ -371,12 +375,12 @@ Key EndgameFunctions::buildKey(const std::string& keyCode) { return Position(s.str()).get_material_key(); } -void EndgameFunctions::add(const std::string& keyCode, EndgameEvaluationFunctionBase* f) { +void EndgameFunctions::add(const string& keyCode, EndgameEvaluationFunctionBase* f) { EEFmap.insert(std::pair(buildKey(keyCode), f)); } -void EndgameFunctions::add(const std::string& keyCode, Color c, EndgameScalingFunctionBase* f) { +void EndgameFunctions::add(const string& keyCode, Color c, EndgameScalingFunctionBase* f) { ScalingInfo s = {c, f}; ESFmap.insert(std::pair(buildKey(keyCode), s));