square.cc
Go to the documentation of this file.
1 /* square.cc
2  */
4 #include "osl/bits/ptypeTable.h"
5 #include <sstream>
6 
7 const std::string osl::rating::
8 RelativeKingX::name(int x, int old_x, bool /*attack*/, Ptype ptype)
9 {
10  std::ostringstream os;
11  os << "X";
12  if (old_x == 9)
13  os << "d";
14  else
15  os << old_x << "->";
16  os << x << Ptype_Table.getCsaName(ptype);
17  return os.str();
18 }
19 
20 const std::string osl::rating::
21 RelativeKingY::name(int y, int old_y, bool /*attack*/, Ptype ptype)
22 {
23  std::ostringstream os;
24  os << "Y";
25  if (old_y == 9)
26  os << "d";
27  else
28  os << old_y << "->";
29  os << y << Ptype_Table.getCsaName(ptype);
30  return os.str();
31 }
32 
33 const std::string osl::rating::SquareX::name(int x)
34 {
35  std::ostringstream os;
36  os << "PX" << x << "-";
37  return os.str();
38 }
39 const std::string osl::rating::SquareY::name(int y)
40 {
41  std::ostringstream os;
42  os << "PY" << y << "-";
43  return os.str();
44 }
45 
46 /* ------------------------------------------------------------------------- */
const char * getCsaName(Ptype ptype) const
Definition: ptypeTable.h:80
Ptype
駒の種類を4ビットでコード化する
Definition: basic_type.h:83
const PtypeTable Ptype_Table
Definition: tables.cc:97
const std::string & name() const