BlueBubble 1.0
A recommendation algorithm for movies based on a Netlfix database
Loading...
Searching...
No Matches
bishop.cc
Go to the documentation of this file.
3#include "piece.h"
4#include "bishop.h"
5#include <vector>
6#include <iostream>
7
11void bishop::needed_space(coordinates dest, std::vector<coordinates> *to_calculate){
12 int diff_x = dest.get_x() - piece::coord.get_x();
13 int diff_y = dest.get_y() - piece::coord.get_y();
14 int coord_x = -1;
15 int coord_y = -1;
16 for(int i = 1; i < abs(diff_x); i++){
17 if(diff_x > 0){
18 coord_x = piece::coord.get_x() + i;
19 }else{
20 coord_x = piece::coord.get_x() - i;
21 }
22 if(diff_y > 0){
23 coord_y = piece::coord.get_y() + i;
24 }else{
25 coord_y = piece::coord.get_y() - i;
26 }
27 to_calculate->push_back(coordinates(coord_x,coord_y));
28 }
29}
30
33 if(piece::white){
34 std::cout << "\u2657";
35 }else{
36 std::cout << "\u265D";
37 }
38}
39
42 if(piece::white){
43 std::cout << "wB";
44 }else{
45 std::cout << "bB";
46 }
47}
void canonical_print_piece() override
print the piece to the standard output in canonical form
Definition bishop.cc:41
void print_piece() override
print the piece to the standard output
Definition bishop.cc:32
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 pos...
Definition bishop.cc:11
a class representing coordinates
Definition coordinates.h:5
int get_x()
a function to get the x-axis attribute
Definition coordinates.cc:6
int get_y()
a function to get the y-axis attribute
coordinates coord
Definition piece.h:14
bool white
Definition piece.h:13