This commit is contained in:
Alexander Huddleston 2015-10-27 12:26:13 -05:00
parent d874a13d99
commit 6a867cd780
2 changed files with 10 additions and 8 deletions

View file

@ -242,23 +242,23 @@ bool Board::isThisMovePossible(int r, int c, string moveType){
if (moveType == "FWD"){
if (isPiece(r+reflector, c))
return true;
else
return false;
else
return true;
}
else if (moveType == "RIGHT"){
if (isPiece(r+reflector, c+1) && (r+reflector >= 0) && (r+reflector <= 7) && (c+1 <= 7))
return true;
else
return false;
else
return true;
}
else if (moveType == "LEFT"){
if (isPiece(r+reflector, c+1) && (r+reflector >= 0) && (r+reflector <= 7) && (c+1 >= 0))
return true;
else
return false;
else
return true;
}
else return false;

View file

@ -104,7 +104,7 @@ int main(int argc, char *argv[])
{
b.displayBoard();//Display the board on the server
string boardState = b.boardToString();
final_move = b.boardToString();
//final_move = b.boardToString();
write(newsockfd, boardState.c_str(), boardState.length());//Display the board to the client (line by line)
cout<<"\nWaiting for client: ";
n = read(newsockfd,buffer,255);
@ -126,14 +126,16 @@ int main(int argc, char *argv[])
b.easyAI();
}
/*
string final_move = b.boardToString();
write(newsockfd, final_move.c_str(), final_move.length());//Display the board to the client (line by line)
write(newsockfd, final_move.c_str(), final_move.length());
cout << "\n\nGAME OVER!!!";
usleep(1);
*/
close(newsockfd);
close(sockfd);
break;
}
return 0;