1#ifndef GAME_COORDINATE_H
2#define GAME_COORDINATE_H
36 double get_x() const noexcept {
return m_x; }
37 double get_y() const noexcept {
return m_y; }
54 std::default_random_engine& rng_engine
chess_color
A chess piece color.
Definition chess_color.h:10
An exact coordinate anywhere on the board.
Definition game_coordinate.h:32
double get_x() const noexcept
Definition game_coordinate.h:36
double get_y() const noexcept
Definition game_coordinate.h:37
A chess square.
Definition square.h:58
game_coordinate create_random_game_coordinate(std::default_random_engine &rng_engine)
Create a random game_coordinate.
Definition game_coordinate.cpp:44
game_coordinate center_on_center(const game_coordinate &coordinat)
center a coordinat on the center of a square, i.e.
Definition game_coordinate.cpp:36
game_coordinate & operator+=(game_coordinate &lhs, const game_coordinate &rhs) noexcept
Definition game_coordinate.cpp:351
game_coordinate get_left(const game_coordinate &coordinat) noexcept
Get the game coordinat one square left of this one, i.e.
Definition game_coordinate.cpp:71
std::string to_notation(const game_coordinate &g)
Convert to coordinat to chess notation, e.g.
Definition game_coordinate.cpp:289
bool operator!=(const game_coordinate &lhs, const game_coordinate &rhs) noexcept
Definition game_coordinate.cpp:324
game_coordinate operator+(const game_coordinate &lhs, const game_coordinate &rhs) noexcept
Definition game_coordinate.cpp:343
std::ostream & operator<<(std::ostream &os, const game_coordinate &coordinat)
Definition game_coordinate.cpp:329
double calc_distance(const game_coordinate &lhs, const game_coordinate &rhs) noexcept
Calculate the euclidean distance between two points.
Definition game_coordinate.cpp:21
game_coordinate operator-(const game_coordinate &lhs, const game_coordinate &rhs) noexcept
Definition game_coordinate.cpp:335
game_coordinate get_below(const game_coordinate &coordinat) noexcept
Get the game coordinat one square below this one, i.e.
Definition game_coordinate.cpp:61
game_coordinate operator/(const game_coordinate &coordinat, const double factor) noexcept
Definition game_coordinate.cpp:357
bool operator==(const game_coordinate &lhs, const game_coordinate &rhs) noexcept
Definition game_coordinate.cpp:317
game_coordinate operator*(const game_coordinate &c, const double x) noexcept
Definition game_coordinate.cpp:366
game_coordinate get_above(const game_coordinate &coordinat) noexcept
Get the game coordinat one square above this one, i.e.
Definition game_coordinate.cpp:51
void test_game_coordinate()
Test this class and its free function.
Definition game_coordinate.cpp:121
double calc_length(const game_coordinate &coordinat) noexcept
Calculate the length of the vector, a.k.a.
Definition game_coordinate.cpp:28
bool is_coordinat_on_board(const game_coordinate &c) noexcept
Determine if the coordinat is on the chess board.
Definition game_coordinate.cpp:99
std::string to_str(const game_coordinate &c) noexcept
Converts the coordinate to a string.
Definition game_coordinate.cpp:302
bool is_forward(const chess_color color, const square &from, const square &to)
Is the 'to' coordinat forward, i.e.
Definition game_coordinate.cpp:109
game_coordinate get_rotated_coordinat(const game_coordinate &coordinat) noexcept
Rotate the coordinat, i.e.
Definition game_coordinate.cpp:91
game_coordinate get_right(const game_coordinate &coordinat) noexcept
Get the game coordinat one square right of this one, i.e.
Definition game_coordinate.cpp:81