BlueBubble 1.0
A recommendation algorithm for movies based on a Netlfix database
Loading...
Searching...
No Matches
Public Member Functions
king Class Reference

the king piece class. More...

#include <king.h>

Inheritance diagram for king:
piece

Public Member Functions

 king (bool _white, coordinates _coord)
 
void needed_space (coordinates dest, std::vector< coordinates > *to_calculate) override
 calculate a list of empty space coordinates needed for the move to be legal, assuming the move is possible
 
void print_piece () override
 print the piece to the standard output
 
void canonical_print_piece () override
 print the piece to the standard output in canonical form
 
- Public Member Functions inherited from piece
 piece (bool _white, coordinates _coord)
 the constructor for the piece class
 
bool is_possible (coordinates dest)
 verify if a move is within piece range
 
virtual bool is_possible_attack (coordinates dest)
 verify if a move is within piece attack range
 
virtual void move (coordinates dest, bool debug_info)
 called to move the piece
 
coordinates get_coord ()
 retrieve the piece's coordinates
 
bool get_color ()
 retrieve the piece's color
 
bool get_has_moved ()
 retrieve if the piece has already moved during the game
 
piece_type get_type ()
 retrieve the piece's type
 
virtual std::vector< coordinatesget_legals ()
 retrieve the piece's legal moves
 

Additional Inherited Members

- Protected Attributes inherited from piece
bool white
 
coordinates coord
 
std::vector< coordinateslegals
 
bool has_moved
 
piece_type type
 

Detailed Description

the king piece class.

Definition at line 9 of file king.h.

Constructor & Destructor Documentation

◆ king()

king::king ( bool _white,
coordinates _coord )
inline

Definition at line 11 of file king.h.

11 :
12 piece(_white,_coord)
13 {
15 legals.push_back(coordinates(0,1));
16 legals.push_back(coordinates(0,-1));
17 legals.push_back(coordinates(1,0));
18 legals.push_back(coordinates(1,1));
19 legals.push_back(coordinates(1,-1));
20 legals.push_back(coordinates(-1,0));
21 legals.push_back(coordinates(-1,1));
22 legals.push_back(coordinates(-1,-1));
23 }
a class representing coordinates
Definition coordinates.h:5
piece_type type
Definition piece.h:17
piece(bool _white, coordinates _coord)
the constructor for the piece class
Definition piece.cc:8
std::vector< coordinates > legals
Definition piece.h:15
@ king_type
Definition piece.h:8

Member Function Documentation

◆ canonical_print_piece()

void king::canonical_print_piece ( )
overridevirtual

print the piece to the standard output in canonical form

Reimplemented from piece.

Definition at line 25 of file king.cc.

25 {
26 if(piece::white){
27 std::cout << "wK";
28 }else{
29 std::cout << "bK";
30 }
31}
bool white
Definition piece.h:13

◆ needed_space()

void king::needed_space ( coordinates dest,
std::vector< coordinates > * to_calculate )
overridevirtual

calculate a list of empty space coordinates needed for the move to be legal, assuming the move is possible

Parameters
destdestination coordinates
Returns
a vector containing all coordinates to be verified

Reimplemented from piece.

Definition at line 11 of file king.cc.

11 {
12 // The king doesn't need space
13}

◆ print_piece()

void king::print_piece ( )
overridevirtual

print the piece to the standard output

Reimplemented from piece.

Definition at line 16 of file king.cc.

16 {
17 if(piece::white){
18 std::cout << "\u2654";
19 }else{
20 std::cout << "\u265A";
21 }
22}

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