File: CallistoGeometry.h

package info (click to toggle)
pentobi 29.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,892 kB
  • sloc: cpp: 25,719; javascript: 875; xml: 40; makefile: 13; sh: 6
file content (54 lines) | stat: -rw-r--r-- 1,678 bytes parent folder | download | duplicates (4)
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
48
49
50
51
52
53
54
//-----------------------------------------------------------------------------
/** @file libpentobi_base/CallistoGeometry.h
    @author Markus Enzenberger
    @copyright GNU General Public License version 3 or later */
//-----------------------------------------------------------------------------

#ifndef LIBPENTOBI_BASE_CALLISTO_GEOMETRY_H
#define LIBPENTOBI_BASE_CALLISTO_GEOMETRY_H

#include "Geometry.h"

namespace libpentobi_base {

//-----------------------------------------------------------------------------

/** Geometry for the board game Callisto.
    To fit in with the assumptions of the Blokus engine, points are "diagonal"
    to each other if they are actually adjacent on the real board and the
    "adjacent" relationship is not used. */
class CallistoGeometry final
    : public Geometry
{
public:
    /** Create or reuse an already created geometry.
        @param nu_colors The number of colors (2, 3, or 4). */
    static const CallistoGeometry& get(unsigned nu_colors);

    static bool is_center_section(unsigned x, unsigned y, unsigned nu_colors);


    explicit CallistoGeometry(unsigned nu_colors);

    AdjCoordList get_adj_coord(int x, int y) const override;

    DiagCoordList get_diag_coord(int x, int y) const override;

    unsigned get_point_type(int x, int y) const override;

    unsigned get_period_x() const override;

    unsigned get_period_y() const override;

protected:
    bool init_is_onboard(unsigned x, unsigned y) const override;

private:
    unsigned m_edge;
};

//-----------------------------------------------------------------------------

} // namespace libpentobi_base

#endif // LIBPENTOBI_BASE_CALLISTO_GEOMETRY_H