Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial creation #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions include/Bishop.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef BISHOP_H
#define BISHOP_H

#include <Chess_piece.h>


class Bishop : public Chess_piece
{
public:
Bishop(char color);
std::string get_repr() override;
int get_val() override;
virtual ~Bishop();

protected:

private:
};

#endif // BISHOP_H
21 changes: 21 additions & 0 deletions include/Chess_piece.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef CHESS_PIECE_H
#define CHESS_PIECE_H
#include <string>

class Chess_piece
{
public:
Chess_piece(char color);
virtual std::string get_repr() = 0;
virtual int get_val() = 0;
virtual ~Chess_piece();
Chess_piece(const Chess_piece& other);
Chess_piece& operator=(const Chess_piece& other);

protected:
char m_color;

private:
};

#endif // CHESS_PIECE_H
20 changes: 20 additions & 0 deletions include/King.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef KING_H
#define KING_H

#include <Chess_piece.h>


class King : public Chess_piece
{
public:
King(char color);
std::string get_repr() override;
int get_val() override;
virtual ~King();

protected:

private:
};

#endif // KING_H
20 changes: 20 additions & 0 deletions include/Knight.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef KNIGHT_H
#define KNIGHT_H

#include <Chess_piece.h>


class Knight : public Chess_piece
{
public:
Knight(char color);
std::string get_repr() override;
int get_val() override;
virtual ~Knight();

protected:

private:
};

#endif // KNIGHT_H
20 changes: 20 additions & 0 deletions include/Pawn.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef PAWN_H
#define PAWN_H

#include <Chess_piece.h>


class Pawn : public Chess_piece
{
public:
Pawn(char color);
std::string get_repr() override;
int get_val() override;
virtual ~Pawn();

protected:

private:
};

#endif // PAWN_H
20 changes: 20 additions & 0 deletions include/Queen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef QUEEN_H
#define QUEEN_H

#include <Chess_piece.h>


class Queen : public Chess_piece
{
public:
Queen(char color);
std::string get_repr() override;
int get_val() override;
virtual ~Queen();

protected:

private:
};

#endif // QUEEN_H
20 changes: 20 additions & 0 deletions include/Rook.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef ROOK_H
#define ROOK_H

#include <Chess_piece.h>


class Rook : public Chess_piece
{
public:
Rook(char color);
std::string get_repr() override;
int get_val() override;
virtual ~Rook();

protected:

private:
};

#endif // ROOK_H
19 changes: 19 additions & 0 deletions src/Bishop.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "Bishop.h"

Bishop::Bishop(char color) : Chess_piece(color)
{
//ctor
}

int Bishop::get_val(){
return 3;
}

std::string Bishop::get_repr(){
return "B"+m_color;
}

Bishop::~Bishop()
{
//dtor
}
23 changes: 23 additions & 0 deletions src/Chess_piece.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "Chess_piece.h"

Chess_piece::Chess_piece(char color) : m_color(color)
{
//ctor
}

Chess_piece::~Chess_piece()
{
//dtor
}

Chess_piece::Chess_piece(const Chess_piece& other)
{
//copy ctor
}

Chess_piece& Chess_piece::operator=(const Chess_piece& rhs)
{
if (this == &rhs) return *this; // handle self assignment
//assignment operator
return *this;
}
19 changes: 19 additions & 0 deletions src/King.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "King.h"

King::King(char color) : Chess_piece(color)
{
//ctor
}

int King::get_val(){
return 9999999;
}

std::string King::get_repr(){
return "K"+m_color;
}

King::~King()
{
//dtor
}
19 changes: 19 additions & 0 deletions src/Knight.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "Knight.h"

Knight::Knight(char color) : Chess_piece(color)
{
//ctor
}

int Knight::get_val(){
return 3;
}

std::string Knight::get_repr(){
return "N"+m_color;
}

Knight::~Knight()
{
//dtor
}
16 changes: 16 additions & 0 deletions src/Pawn.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "Pawn.h"

Pawn::Pawn(char color): Chess_piece(color){

}

int Pawn::get_val(){
return 1;
}

std::string Pawn::get_repr(){
return "P"+m_color;
}

Pawn::~Pawn()
{}
19 changes: 19 additions & 0 deletions src/Queen.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "Queen.h"

Queen::Queen(char color) : Chess_piece(color)
{
//ctor
}

int Queen::get_val(){
return 10;
}

std::string Queen::get_repr(){
return "Q"+m_color;
}

Queen::~Queen()
{
//dtor
}
19 changes: 19 additions & 0 deletions src/Rook.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "Rook.h"

Rook::Rook(char color) : Chess_piece(color)
{
//ctor
}

int Rook::get_val(){
return 5;
}

std::string Rook::get_repr(){
return "R"+m_color;
}

Rook::~Rook()
{
//dtor
}