Conquer Chess
Chess and Starcraft combined
Loading...
Searching...
No Matches
Classes | Functions
piece_action.h File Reference
#include "piece_action_type.h"
#include "square.h"
#include "piece_type.h"
#include <iosfwd>
#include <string>
#include <vector>
Include dependency graph for piece_action.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  piece_action
 An action to be done by a piece. More...
 

Functions

std::string describe_action (const piece_action &p)
 Describe the 'piece_action' in words, e.g. 'move to (3, 4)'.
 
piece_action get_test_piece_action () noexcept
 Get a piece_action to be used in testing.
 
bool has_action_of_type (const std::vector< piece_action > &actions, const piece_action_type t)
 Is there at least one action of the specified type?
 
bool is_double_move (const piece_action &a) noexcept
 Is this a pawn moving two squares forward?
 
bool is_atomic (const piece_action &a) noexcept
 Is the action atomic, i.e.
 
void test_piece_action ()
 Test the 'piece_action' class and its free functions.
 
std::vector< piece_actionto_atomic (const piece_action &a)
 Convert an action to one or more atomic actions.
 
std::string to_str (const piece_action &a) noexcept
 Convert to string.
 
std::string to_str (const std::vector< piece_action > &a) noexcept
 Convert to string, one line per action, no newline at the end.
 
bool operator== (const piece_action &lhs, const piece_action &rhs) noexcept
 
bool operator!= (const piece_action &lhs, const piece_action &rhs) noexcept
 
std::ostream & operator<< (std::ostream &os, const piece_action &p) noexcept
 

Function Documentation

◆ describe_action()

std::string describe_action ( const piece_action p)

Describe the 'piece_action' in words, e.g. 'move to (3, 4)'.

◆ get_test_piece_action()

piece_action get_test_piece_action ( )
noexcept

Get a piece_action to be used in testing.

◆ has_action_of_type()

bool has_action_of_type ( const std::vector< piece_action > &  actions,
const piece_action_type  t 
)

Is there at least one action of the specified type?

◆ is_atomic()

bool is_atomic ( const piece_action a)
noexcept

Is the action atomic, i.e.

it cannot be split up further. For example, moving a queen d1 to d3 is not atomic, as it is split up in d1 -> d2 -> d3

◆ is_double_move()

bool is_double_move ( const piece_action a)
noexcept

Is this a pawn moving two squares forward?

◆ operator!=()

bool operator!= ( const piece_action lhs,
const piece_action rhs 
)
noexcept

◆ operator<<()

std::ostream & operator<< ( std::ostream &  os,
const piece_action p 
)
noexcept

◆ operator==()

bool operator== ( const piece_action lhs,
const piece_action rhs 
)
noexcept

◆ test_piece_action()

void test_piece_action ( )

Test the 'piece_action' class and its free functions.

◆ to_atomic()

std::vector< piece_action > to_atomic ( const piece_action a)

Convert an action to one or more atomic actions.

◆ to_str() [1/2]

std::string to_str ( const piece_action a)
noexcept

Convert to string.

◆ to_str() [2/2]

std::string to_str ( const std::vector< piece_action > &  a)
noexcept

Convert to string, one line per action, no newline at the end.