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 35 36 37 38 39 40 41 42 43 44 45 46 47
|
//-----------------------------------------------------------------------------
/** @file libpentobi_base/PentobiSgfUtil.cpp
@author Markus Enzenberger
@copyright GNU General Public License version 3 or later */
//-----------------------------------------------------------------------------
#include "PentobiSgfUtil.h"
#include "libboardgame_base/Assert.h"
namespace libpentobi_base {
//-----------------------------------------------------------------------------
const char* get_color_id(Variant variant, Color c)
{
static_assert(Color::range == 4);
if (get_nu_colors(variant) == 2)
return c == Color(0) ? "B" : "W";
if (c == Color(0))
return "1";
if (c == Color(1))
return "2";
if (c == Color(2))
return "3";
LIBBOARDGAME_ASSERT(c == Color(3));
return "4";
}
const char* get_setup_id(Variant variant, Color c)
{
static_assert(Color::range == 4);
if (get_nu_colors(variant) == 2)
return c == Color(0) ? "AB" : "AW";
if (c == Color(0))
return "A1";
if (c == Color(1))
return "A2";
if (c == Color(2))
return "A3";
LIBBOARDGAME_ASSERT(c == Color(3));
return "A4";
}
//-----------------------------------------------------------------------------
} // namespace libpentobi_base
|