BenBot 1.7.5
A chess engine
Loading...
Searching...
No Matches
Modeling of the chess game
Collaboration diagram for Modeling of the chess game:

Files

file  CastlingRights.hpp
file  Position.hpp
file  Result.hpp
file  ThreefoldChecker.hpp

Namespaces

namespace  chess
namespace  chess::game

Classes

struct  chess::game::CastlingRights
struct  chess::game::Position
struct  chess::game::ThreefoldChecker

Enumerations

enum class  chess::game::Result : std::uint_least8_t { chess::game::Result::Draw , chess::game::Result::WhiteWon , chess::game::Result::BlackWon }

Functions

auto after_move (const Position &starting, Move move) -> Position
auto after_null_move (const Position &starting) -> Position
auto flipped (const Position &starting) -> Position
auto print_ascii (const Position &position) -> std::string
auto print_utf8 (const Position &position) -> std::string

Detailed Description

Classes to model the state of a game of chess.

Enumeration Type Documentation

◆ Result

enum class chess::game::Result : std::uint_least8_t
strong

This enumeration defines possible game results.

Enumerator
Draw 

A draw result.

WhiteWon 

A White win result.

BlackWon 

A Black win result.

Definition at line 29 of file Result.hpp.

Function Documentation

◆ after_move()

auto after_move ( const Position & starting,
Move move ) -> Position
related

Returns a copy of the starting position with the given move applied.

Note
This function does not verify that the given move is legal.
See also
after_null_move()

Definition at line 540 of file Position.hpp.

◆ after_null_move()

auto after_null_move ( const Position & starting) -> Position
related

Returns a copy of the starting position with the side to move flipped.

See also
after_move(), flipped()

Definition at line 551 of file Position.hpp.

◆ flipped()

auto flipped ( const Position & starting) -> Position
related

Returns a copy of the starting position with colors flipped.

See also
after_null_move()

Definition at line 560 of file Position.hpp.

◆ print_ascii()

auto print_ascii ( const Position & position) -> std::string
related

Creates an ASCII representation of the given position. The returned string is meant to be interpreted visually by a human, probably for debugging purposes. The board is drawn as a simple set of cells separated by | characters. Pieces are represented using letters (uppercase for white, lowercase for black).

See also
print_utf8()

◆ print_utf8()

auto print_utf8 ( const Position & position) -> std::string
related

Creates a UTF8 representation of the given position. The returned string is meant to be interpreted visually by a human, probably for debugging purposes. The board is drawn as a simple set of cells separated by | characters. Pieces are drawn using their UTF8-encoded symbols.

See also
print_ascii()