BlueBubble 1.0
A recommendation algorithm for movies based on a Netlfix database
Loading...
Searching...
No Matches
rook.cc
Go to the documentation of this file.
3#include "piece.h"
4#include "rook.h"
5#include <vector>
6#include <iostream>
7
11void rook::needed_space(coordinates dest, std::vector<coordinates> *to_calculate){
12 if(dest.get_x() > piece::coord.get_x()){
13 //Moving right
14 for(int i = piece::coord.get_x() + 1; i < dest.get_x(); i++){
15 to_calculate->push_back(coordinates(i,piece::coord.get_y()));
16 }
17 }
18 if(dest.get_x() < piece::coord.get_x()){
19 //Moving left
20 for(int i = piece::coord.get_x() - 1; i > dest.get_x(); i--){
21 to_calculate->push_back(coordinates(i,piece::coord.get_y()));
22 }
23 }
24 if(dest.get_y() > piece::coord.get_y()){
25 //Moving right
26 for(int i = piece::coord.get_y() + 1; i < dest.get_y(); i++){
27 to_calculate->push_back(coordinates(piece::coord.get_x(),i));
28 }
29 }
30 if(dest.get_y() < piece::coord.get_y()){
31 //Moving left
32 for(int i = piece::coord.get_y() - 1; i > dest.get_y(); i--){
33 to_calculate->push_back(coordinates(piece::coord.get_x(),i));
34 }
35 }
36}
37
40 if(piece::white){
41 std::cout << "\u2656";
42 }else{
43 std::cout << "\u265C";
44 }
45}
46
49 if(piece::white){
50 std::cout << "wR";
51 }else{
52 std::cout << "bR";
53 }
54}
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
void canonical_print_piece() override
print the piece to the standard output in canonical form
Definition rook.cc:48
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 rook.cc:11
void print_piece() override
print the piece to the standard output
Definition rook.cc:39