aboutsummaryrefslogtreecommitdiffstats
path: root/src/chess_board.cpp
diff options
context:
space:
mode:
authorzedarider <ymherklotz@gmail.com>2016-11-08 22:55:51 +0000
committerzedarider <ymherklotz@gmail.com>2016-11-08 22:55:51 +0000
commitc8bd95bd2905a512cbdab87cf25f3f250acf60ec (patch)
tree037bd45cdb7beb47b2e7f444c84cc4cc76b94538 /src/chess_board.cpp
parentf39a4463efa9deeaa6ec1f7986964f5baad784c2 (diff)
downloadChessAI-c8bd95bd2905a512cbdab87cf25f3f250acf60ec.tar.gz
ChessAI-c8bd95bd2905a512cbdab87cf25f3f250acf60ec.zip
saving files as backup
Diffstat (limited to 'src/chess_board.cpp')
-rw-r--r--src/chess_board.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/chess_board.cpp b/src/chess_board.cpp
index 9a6848b..badd585 100644
--- a/src/chess_board.cpp
+++ b/src/chess_board.cpp
@@ -1,14 +1,10 @@
#include "../include/chess_ai.hpp"
-typedef std::vector<std::vector<chess_ai::chess_piece>>::
-iterator vector_iterator;
-typedef std::vector<chess_ai::chess_piece>::iterator square_iterator;
-
-chess_ai::chess_board::chess_board() {
+chess_ai::chess_board::chess_board() : SIZE(CHESS_BOARD_SIZE) {
init_board_vector();
}
-chess_ai::chess_board::chess_board(board_state state) {
+chess_ai::chess_board::chess_board(board_state state) : SIZE(CHESS_BOARD_SIZE){
unsigned vec_index, sqr_index;
init_board_vector();
@@ -155,3 +151,23 @@ void chess_ai::chess_board::remove_piece(unsigned x, unsigned y) {
}
}
}
+
+void chess_ai::chess_board::move_piece(chess_piece piece) {
+
+}
+
+void chess_ai::chess_board::iterate_board(unsigned x, unsigned y,
+ square_iterator& it) {
+ unsigned vec_index, sqr_index;
+ for(vector_iterator it_vec = grid.begin(); it_vec != grid.end(); ++it_vec) {
+ for(square_iterator it_sqr = (*it_vec).begin();
+ it_sqr != (*it_vec).end(); ++it_sqr) {
+ vec_index = it_vec - grid.begin();
+ sqr_index = it_sqr - (*it_vec).begin();
+
+ if(vec_index == y && sqr_index == x) {
+ it = it_sqr;
+ }
+ }
+ }
+}