File: pvVector.cc

package info (click to toggle)
gpsshogi 0.7.0-3.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 111,280 kB
  • sloc: cpp: 80,962; perl: 12,610; ruby: 3,929; javascript: 1,631; makefile: 1,202; sh: 473; tcl: 166; ansic: 67
file content (34 lines) | stat: -rw-r--r-- 751 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "pvVector.h"
#include "osl/numEffectState.h"
#include "osl/eval/ptypeEval.h"
#include <iostream>

int gpsshogi::PVVector::pieceValue() const
{
  static const osl::NumEffectState dummy;
  int sum = 0;
  for (osl::Move move: *this)
    if (move.isNormal())
      sum += osl::eval::Ptype_Eval_Table.diffWithMove(dummy, move);
  return sum;
}

int gpsshogi::PVVector::pieceValueOfTurn() const
{
  if (empty())
    return 0;
  return pieceValue() * sign(front().player());
}

std::ostream& gpsshogi::operator<<(std::ostream& os, const PVVector& moves)
{
  os<< "PVVector" << std::endl;
  for (osl::Move m: moves) {
    os << m << std::endl;
  }
  return os<<std::endl;
}
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End: