-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComponent.cpp
More file actions
42 lines (39 loc) · 829 Bytes
/
Component.cpp
File metadata and controls
42 lines (39 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// Component.cpp
// Chess
//
// Created by mustafa tok on 29.11.2011.
//
#include <iostream>
#include "Component.h"
#include "Iterators.h"
using namespace std;
Component::Component(Board* board, int color){
this->color = color;
this->parent = board;
this->touched = false;
}
bool Component::isWhite(){
return (color == WHITE) ? true : false;
}
bool Component::isBlack(){
return (color == BLACK) ? true : false;
}
bool Component::isSameColor(Component* x){
if(x == NULL)
return false;
if(this->isBlack() && x->isBlack())
return true;
if(this->isWhite() && x->isWhite())
return true;
return false;
}
bool Component::isTouched(){
return this->touched;
}
void Component::setTouched(){
this->touched = true;
}
int Component::getValue(){
return value;
}