From ed598d0c8b6db12d90fc7465844023dc4a2cf721 Mon Sep 17 00:00:00 2001 From: scho4077 Date: Mon, 19 Oct 2015 16:31:22 -0500 Subject: [PATCH 1/3] Delete GameEngine.cpp --- GameEngine.cpp | 560 ------------------------------------------------- 1 file changed, 560 deletions(-) delete mode 100755 GameEngine.cpp diff --git a/GameEngine.cpp b/GameEngine.cpp deleted file mode 100755 index a5c7506..0000000 --- a/GameEngine.cpp +++ /dev/null @@ -1,560 +0,0 @@ -#include -#include -#include -#include -#include "GameEngine.h" - -using namespace std; - -string myToUpper(string input) -{ - string output; - - for (int i = 0 ; i < input.size(); ++i) - { - int numeric; - - if ((input[i] - 0 >= 97) && (input[i] - 0 <= 122)) - { - numeric = input[i] - 32; - output.push_back((char)numeric);// = 'Q';//(char) numeric; - } - else output.push_back(input[i]); - } - - for (int i = 0; i < output.size(); ++i) - { - cout< 8 || row < 0 || kolumn > 8 || kolumn < 0) - { - cout<<"ERROR: index out of bound!"< 8 || row < 0 || kolumn > 8 || kolumn < 0) - { - cout<<"ERROR: index out of bound!"<= 0) && (r+reflector <= 7) && (c+1 <= 7) ) return true; - else return false; - } - - else if (moveType == "LEFT") - { - if (boardArray[r+reflector][c-1] != pieceToMove && (r+reflector >= 0) && (r+reflector <= 7) && (c+1 >= 0) ) return true; - else return false; - } - - else return false; - } - } - - - - - vector viewPossibleMoves() - { - vector output; - - for (int r = 0; r < 8; ++r) - { - for (int c = 0; c < 8; ++c) - { - if (boardArray[r][c] == turn) - { - if (isThisMovePossible(r,c,"FWD")) - { - moves temp(8-r,intToCharColumn(c+1),"FWD"); - output.push_back(temp); - } - - if (isThisMovePossible(r,c,"LEFT")) - { - moves temp(8-r,intToCharColumn(c+1),"LEFT"); - output.push_back(temp); - } - - if (isThisMovePossible(r,c,"RIGHT")) - { - moves temp(8-r,intToCharColumn(c+1),"RIGHT"); - output.push_back(temp); - } - - } - } - } - - return output; - } - - - void easyAI() - { - - //1) see all possible movements - - vector listOfMoves = viewPossibleMoves(); - - //2) pick a movement - - srand(time(NULL)); - int randomChoice = rand() % (listOfMoves.size()-1) - 0; // choose a move betwen listOfMoves[0] to last element - - //3) execute movement - - int temp = randomChoice; - - move(listOfMoves[randomChoice]); - - //cout<<"\n\nMove executed by AI: "< input) -{ - cout<<"\n\nList of possible Moves:"< Date: Mon, 19 Oct 2015 16:31:31 -0500 Subject: [PATCH 2/3] Delete GameEngine.h --- GameEngine.h | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100755 GameEngine.h diff --git a/GameEngine.h b/GameEngine.h deleted file mode 100755 index ec74850..0000000 --- a/GameEngine.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include -#include "Board.h" - -using namespace std; - -string myToUpper(string input); - -struct moves -{ - int row; - char column; - string moveType; - - moves(int linea, int columna, string m) - { - row = linea; - column = columna; - moveType = m; - } -}; - - - - -void displayPossibleMoves(vector input) -{ - cout<<"\n\nList of possible Moves:"< Date: Tue, 27 Oct 2015 11:56:25 -0500 Subject: [PATCH 3/3] Added makefile for test.cpp --- makefile | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 makefile diff --git a/makefile b/makefile new file mode 100755 index 0000000..fc3a027 --- /dev/null +++ b/makefile @@ -0,0 +1,9 @@ +# makefile + +all: test + +test: test.o + g++ -std=c++11 -o test test.o Engine.o Piece.o Board.o + +test.o: test.cpp Engine.cpp Board.cpp Piece.cpp + g++ -std=c++11 -c -g test.cpp Engine.cpp Board.cpp Piece.cpp \ No newline at end of file