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

the knight piece class. More...

#include <knight.h>

Inheritance diagram for knight:
piece

Public Member Functions

 knight (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 knight piece class.

Definition at line 9 of file knight.h.

Constructor & Destructor Documentation

◆ knight()

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

Definition at line 11 of file knight.h.

11 :
12 piece(_white,_coord)
13 {
15 legals.push_back(coordinates(2,1));
16 legals.push_back(coordinates(2,-1));
17 legals.push_back(coordinates(-2,1));
18 legals.push_back(coordinates(-2,-1));
19 legals.push_back(coordinates(1,2));
20 legals.push_back(coordinates(-1,2));
21 legals.push_back(coordinates(1,-2));
22 legals.push_back(coordinates(-1,-2));
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
@ knight_type
Definition piece.h:8

Member Function Documentation

◆ canonical_print_piece()

void knight::canonical_print_piece ( )
overridevirtual

print the piece to the standard output in canonical form

Reimplemented from piece.

Definition at line 25 of file knight.cc.

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

◆ needed_space()

void knight::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 knight.cc.

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

◆ print_piece()

void knight::print_piece ( )
overridevirtual

print the piece to the standard output

Reimplemented from piece.

Definition at line 16 of file knight.cc.

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

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