LCOV - code coverage report
Current view: top level - src - stored.h (source / functions) Hit Total Coverage
Test: test_coverage.info Lines: 2 2 100.0 %
Date: 2017-06-21 14:32:49 Functions: 0 0 -

          Line data    Source code
       1             : /*
       2             : * Copyright (C) 2014  Fulvio Benini
       3             : 
       4             : * This file is part of Scid (Shane's Chess Information Database).
       5             : *
       6             : * Scid is free software: you can redistribute it and/or modify
       7             : * it under the terms of the GNU General Public License as published by
       8             : * the Free Software Foundation.
       9             : *
      10             : * Scid is distributed in the hope that it will be useful,
      11             : * but WITHOUT ANY WARRANTY; without even the implied warranty of
      12             : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      13             : * GNU General Public License for more details.
      14             : *
      15             : * You should have received a copy of the GNU General Public License
      16             : * along with Scid.  If not, see <http://www.gnu.org/licenses/>.
      17             : */
      18             : 
      19             : #ifndef SCID_STORED_H
      20             : #define SCID_STORED_H
      21             : 
      22             : #include "fullmove.h"
      23             : const uint STORED_LINES = 255;
      24             : 
      25             : class StoredLine {
      26             : public:
      27             :         StoredLine(const pieceT* board, colorT toMove);
      28             :         //Result:
      29             :         //-2 : the game cannot reach the searched position
      30             :         //-1 : the game can reach the searched position
      31             :         //>=0: the game reach the searched position at the returned ply
      32             :         int match(uint code) {
      33             :                 if ((code > 0) && (code < STORED_LINES)) return matches_[code];
      34             :                 return -1;
      35             :         }
      36             : 
      37             :         static uint count () { return STORED_LINES; }
      38             :         static FullMove getMove (uint code, uint ply = 0) {
      39     2978898 :                 if ((code < STORED_LINES) && (Moves_[code] + ply) < Moves_[code +1]) {
      40     2968026 :                         return Moves_[code][ply];
      41             :                 }
      42             :                 return FullMove();
      43             :         }
      44             : 
      45             : private:
      46             :         int matches_ [STORED_LINES];
      47             :         static const FullMove* Moves_ [STORED_LINES +1];
      48             : };
      49             : 
      50             : #endif  // #ifndef SCID_STORED_H
      51             : 
      52             : //////////////////////////////////////////////////////////////////////
      53             : //  EOF:    stored.h
      54             : //////////////////////////////////////////////////////////////////////

Generated by: LCOV version 1.12