File: GembloQGeometry.h

package info (click to toggle)
pentobi 26.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 4,068 kB
  • sloc: cpp: 25,986; javascript: 897; xml: 57; makefile: 13; sh: 11
file content (60 lines) | stat: -rw-r--r-- 1,818 bytes parent folder | download | duplicates (6)
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
55
56
57
58
59
60
//-----------------------------------------------------------------------------
/** @file libpentobi_base/GembloQGeometry.h
    @author Markus Enzenberger
    @copyright GNU General Public License version 3 or later */
//-----------------------------------------------------------------------------

#ifndef LIBPENTOBI_BASE_GEMBLOQ_GEOMETRY_H
#define LIBPENTOBI_BASE_GEMBLOQ_GEOMETRY_H

#include "Geometry.h"

namespace libpentobi_base {

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

/** Geometry for the board game GembloQ.
    Each square on the board consists of four triangles, each half-square of
    two triangles. The coordinates are like this:
    <tt>
       0 1 2 3 4 5 6 7 8
    0 | / | \ | / | \ | /
    1 | \ | / | \ | / | \
    2 | / | \ | / | \ | /
    3 | \ | / | \ | / | \
    </tt>
    The point types are determined by the location of the right angle of the
    triangle: 0: top/left, 1=down/right, 2=down/left, 3=up/right. */
class GembloQGeometry final
    : public Geometry
{
public:
    /** Create or reuse an already created geometry.
        @param nu_players The number of players (2, 3, or 4). */
    static const GembloQGeometry& get(unsigned nu_players);


    explicit GembloQGeometry(unsigned nu_players);

    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_GEMBLOQ_GEOMETRY_H