BlueBubble 1.0
A recommendation algorithm for movies based on a Netlfix database
Loading...
Searching...
No Matches
Data Structures | Functions
board.h File Reference
#include <iostream>
#include <vector>
#include "utilities.h"
#include "coordinates.h"
#include "../pieces/piece.h"
#include "../pieces/pawn.h"
#include "../pieces/bishop.h"
#include "../pieces/knight.h"
#include "../pieces/rook.h"
#include "../pieces/queen.h"
#include "../pieces/king.h"
#include <regex>
#include <string>
#include "config.h"

Go to the source code of this file.

Data Structures

class  board
 A class representing the chess board. More...
 

Functions

void print_neutral_endl ()
 print a neutral font color and background color new line
 
void print_line_separator (bool inverted)
 print a line separator with board matching background colors
 
coordinates get_coord_from_string (std::string move)
 Retrieve coordinates from a string.
 

Function Documentation

◆ get_coord_from_string()

coordinates get_coord_from_string ( std::string move)

Retrieve coordinates from a string.

Parameters
movea string with the pattern "a6" (half a input)
Returns
coordinates corresponding to the string

Definition at line 366 of file board.cc.

366 {
367 int result_y = atoi(&move[1]) - 1;
368 int result_x = 0;
369 std::vector<char> x_traduction = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'};
370 for(int i = 0; i < 8; i++){
371 if(move[0] == x_traduction[i]){
372 result_x = i;
373 }
374 }
375 return coordinates(result_x,result_y);
376}
a class representing coordinates
Definition coordinates.h:5

◆ print_line_separator()

void print_line_separator ( bool inverted)

print a line separator with board matching background colors

Parameters
invertedindicate if the line is inverted or not. Every even line is inverted to create the chess board

Definition at line 136 of file board.cc.

136 {
137 bool switcher = false;
138 for(int i = 0; i < 8; i++){
140 if((switcher&&!inverted)||(!switcher&&inverted)){
142 }else{
144 }
145 std::cout << " ";
146 switcher = !switcher;
147 }
148}
#define BACKGROUND_COLOR2
Definition config.h:9
#define BACKGROUND_COLOR1
Definition config.h:8
#define PIECES_COLOR
Definition config.h:10
void terminal_set_background_color(terminal_color color)
set the terminal background color to the input
Definition utilities.cc:48
void terminal_set_text_color(terminal_color color)
set the terminal font color to the input
Definition utilities.cc:16

◆ print_neutral_endl()

void print_neutral_endl ( )

print a neutral font color and background color new line

Definition at line 129 of file board.cc.

129 {
131 std::cout << std::endl;
132}
void terminal_reset_all()
reset all terminal attributes
Definition utilities.cc:79