Conquer Chess
Chess and Starcraft combined
Loading...
Searching...
No Matches
Public Member Functions | List of all members
square Class Reference

A chess square. More...

#include <square.h>

Public Member Functions

 square (const std::string &pos)
 
 square (const game_coordinate &g)
 
 square (const int x, const int y)
 Create a square from the x and y coordinate.
 
int get_x () const noexcept
 Get the x coordinat, starting from 0 for a1/b1/c1/etc.
 
int get_y () const noexcept
 Get the y coordinat, starting from 0 for a1/a2/a3/etc.
 

Detailed Description

A chess square.

A chess square, e.g. e4.

+--+--+--+--+--+--+--+--+
|A1|A2|A3|A4|A5|A6|A7|A8|
+--+--+--+--+--+--+--+--+
|B1|B2|B3|B4|B5|B6|B7|B8|
+--+--+--+--+--+--+--+--+
|C1|C2|C3|C4|C5|C6|C7|C8|
+--+--+--+--+--+--+--+--+
|D1|D2|D3|D4|D5|D6|D7|D8|
+--+--+--+--+--+--+--+--+
|E1|E2|E3|E4|E5|E6|E7|E8|
+--+--+--+--+--+--+--+--+
|F1|F2|F3|F4|F5|F6|F7|F8|
+--+--+--+--+--+--+--+--+
|G1|G2|G3|G4|G5|G6|G7|G8|
+--+--+--+--+--+--+--+--+
|H1|H2|H3|H4|H5|H6|H7|H8|
+--+--+--+--+--+--+--+--+
+--+--+--+--+--+--+--+--+
|00|10|20|30|40|50|60|70|
+--+--+--+--+--+--+--+--+
|01|11|21|31|41|51|61|71|
+--+--+--+--+--+--+--+--+
|02|12|22|32|42|52|62|72|
+--+--+--+--+--+--+--+--+
|03|13|23|33|43|53|63|73|
+--+--+--+--+--+--+--+--+
|04|14|24|34|44|54|64|74|
+--+--+--+--+--+--+--+--+
|05|15|25|35|45|55|65|75|
+--+--+--+--+--+--+--+--+
|06|16|26|36|46|56|66|76|
+--+--+--+--+--+--+--+--+
|07|17|27|37|47|57|67|77|
+--+--+--+--+--+--+--+--+

@seealso a square_layout} defines the layout of a square.

Constructor & Destructor Documentation

◆ square() [1/3]

square::square ( const std::string &  pos)
explicit

◆ square() [2/3]

square::square ( const game_coordinate g)
explicit

◆ square() [3/3]

square::square ( const int  x,
const int  y 
)
explicit

Create a square from the x and y coordinate.

For example, b7 is (6,1).

Parameters
xthe x coordinat, the index for the number of a square, starting from 0 for 1, 1 for 2, 2 for 3, etc.
ythe y coordinat, the index for the letter of a square, starting from 0 for a, 1 for b, 3 for cetc.

Member Function Documentation

◆ get_x()

int square::get_x ( ) const
inlinenoexcept

Get the x coordinat, starting from 0 for a1/b1/c1/etc.

As the board goes from a1 at top-left, to a8 at top-right, the x coordinat is the rank

◆ get_y()

int square::get_y ( ) const
inlinenoexcept

Get the y coordinat, starting from 0 for a1/a2/a3/etc.

As the board goes from a1 at top-left, to a8 at top-right, the y coordinat is the file


The documentation for this class was generated from the following files: