{"action":"created","comment":{"url":"https://api.github.com/repos/ChessGameProject/chessGame/pulls/comments/46231223","id":46231223,"diff_hunk":"@@ -1,49 +1,606 @@\n #include \"game.h\"\n+#include \"piece.h\"\n+#include <iostream>\n+\n+using namespace std;\n+/*\n+TO DO:\n+- En Passant\n+- setup() function\n+- clearGame()\n+*/\n+\n+\n \n Game::Game(){\n+\t//Sets all pieces in Board to NULL\n+\tfor(int i = 0; i < 8; i++){\n+\t\tfor (int j = 0; j < 8; j++){\n+\t\t\ttheBoard[i][j] = NULL;\n+\t\t}\n+\t}\n \n+\tfor (int i = 0; i < 25; i++){\n+\t\tplayerWhite[i] = NULL;\n+\t\tplayerBlack[i] = NULL;\n+\t}\n+\t\n+\tp1Score = 0;\n+\tp2Score = 0;\n+\tcurrentPlayer = WHITE;\n }\n \n Game::~Game(){\n+\tclearGame();\n+}\n \n+void Game::notify(int x, int y, char c){\n+\tnotifications->notify(x,y,c);\n }\n \n void Game::clearGame(){\n-\n+\tdelete [] playerWhite;\n+\tdelete [] playerBlack;\n+\tdelete [] theBoard;\n+\tnotifications = NULL;\n+\tp1Score = 0;\n+\tp2Score = 0;\n }\n \n+bool Game::isCheckAfterMove(int startX, int startY, int endX, int endY, int player){\n+\tPiece* temp = theBoard[endX][endY];\n+\tmakeMove(startX,startY,endX,endY,' ',false);\n+\tbool output = false;\n+\tif (isCheck(player) == true) output = true;\n+\tmakeMove(endX,endY,startX,startY,' ',false);\n+\ttheBoard[endX][endY] = temp;\n+\treturn output;\n+}\n \n-bool Game::isPossibleMove(int startX, int startY, int endX, int endY){\n-\n-\t// Fail safe if none of the if statements are called, then it just returns false\n-\treturn false;\n+bool Game::isCheckAfterMove(int startX, int startY, int endX, int endY){\n+\tisCheckAfterMove(startX,startY, endX, endY, currentPlayer);\n }\n \n bool Game::isValidMove(int startX, int startY, int endX, int endY){\n+\t//Checks if input is valid\n+\tif (startX > 7 || startX < 0 || startY > 7 || startY < 0 || endX < 0 || endX > 7 || endY > 7 || endY < 0) return false;\n+\tif (startX == endX && startY == endY) return false;\n+\n+\t//If there is no piece at the specified location, returns false\n+\tif (isOccupied(startX,startY) == false) return false;\n+\n+\t//Check is Move is invalid from the Piece class\n+\tif (theBoard[startX][startY]->isMoveValid(endX,endY) == false) return false;\n+\n \n-\treturn false;\n \t//Check for castle\n+\tif (currentPlayer = WHITE){\n+\n+\t}\n+\telse{\n+\n+\t}\n \n-\t//Check for en passant\n \n-\t//Check for moving into check\n+\t//Check for en passant\n \n }\n \n bool Game::isOccupied(int x, int y){\n-\treturn false;\n+\tif (theBoard[x][y] == NULL) return false;\n+\telse return true;\n }\n \n-bool Game::isCheckmate(int player){\n-\treturn false;\n+bool Game::isCheckmate(){\n+\t//Finds the Location the the King the the array of pieces and create pointer to it\n+\tint player;\n+\tPiece *king;\n+\tif (getCurrentPlayer() == WHITE){\n+\t\tfor (int i = 0; i < 25; i++){\n+\t\t\tif (playerBlack[i] != NULL && playerBlack[i]->getWorth() == KING){\n+\t\t\t\tking = playerBlack[i];\n+\t\t\t\tplayer = BLACK;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\t}\n+\telse{\n+\t\tfor (int i = 0; i < 25; i++){\n+\t\t\tif (playerWhite[i] != NULL && playerWhite[i]->getWorth() == KING){\n+\t\t\t\tking = playerWhite[i];\n+\t\t\t\tplayer = WHITE;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\t//For all possible moves around the king, it checks if after moving the king there would result in a Check position\n+\tfor (int x = -1; x <= 1; x++){\n+\t\tfor (int y = -1; y <= 1; y++){\n+\t\t\tif (isCheckAfterMove(king->getX(),king->getY(),king->getX() + x,king->getY() + y, player) == false) return false;\n+\t\t}\n+\t}\n+\treturn true;\n+}\n+\n+bool Game::isStalemate(){","path":"game.cc","position":137,"original_position":137,"commit_id":"808b8c784ec2e8b1187b7c477f534bea94d708fb","original_commit_id":"808b8c784ec2e8b1187b7c477f534bea94d708fb","user":{"login":"jaydez","id":1278694,"avatar_url":"https://avatars.githubusercontent.com/u/1278694?v=3","gravatar_id":"","url":"https://api.github.com/users/jaydez","html_url":"https://github.com/jaydez","followers_url":"https://api.github.com/users/jaydez/followers","following_url":"https://api.github.com/users/jaydez/following{/other_user}","gists_url":"https://api.github.com/users/jaydez/gists{/gist_id}","starred_url":"https://api.github.com/users/jaydez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaydez/subscriptions","organizations_url":"https://api.github.com/users/jaydez/orgs","repos_url":"https://api.github.com/users/jaydez/repos","events_url":"https://api.github.com/users/jaydez/events{/privacy}","received_events_url":"https://api.github.com/users/jaydez/received_events","type":"User","site_admin":false},"body":"Also stalemates with 3 move check (i.e. they are just repeating moves)","created_at":"2015-12-01T01:44:52Z","updated_at":"2015-12-01T01:44:52Z","html_url":"https://github.com/ChessGameProject/chessGame/pull/28#discussion_r46231223","pull_request_url":"https://api.github.com/repos/ChessGameProject/chessGame/pulls/28","_links":{"self":{"href":"https://api.github.com/repos/ChessGameProject/chessGame/pulls/comments/46231223"},"html":{"href":"https://github.com/ChessGameProject/chessGame/pull/28#discussion_r46231223"},"pull_request":{"href":"https://api.github.com/repos/ChessGameProject/chessGame/pulls/28"}}},"pull_request":{"url":"https://api.github.com/repos/ChessGameProject/chessGame/pulls/28","id":52034797,"html_url":"https://github.com/ChessGameProject/chessGame/pull/28","diff_url":"https://github.com/ChessGameProject/chessGame/pull/28.diff","patch_url":"https://github.com/ChessGameProject/chessGame/pull/28.patch","issue_url":"https://api.github.com/repos/ChessGameProject/chessGame/issues/28","number":28,"state":"open","locked":false,"title":"Development","user":{"login":"dmamujee","id":7897180,"avatar_url":"https://avatars.githubusercontent.com/u/7897180?v=3","gravatar_id":"","url":"https://api.github.com/users/dmamujee","html_url":"https://github.com/dmamujee","followers_url":"https://api.github.com/users/dmamujee/followers","following_url":"https://api.github.com/users/dmamujee/following{/other_user}","gists_url":"https://api.github.com/users/dmamujee/gists{/gist_id}","starred_url":"https://api.github.com/users/dmamujee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmamujee/subscriptions","organizations_url":"https://api.github.com/users/dmamujee/orgs","repos_url":"https://api.github.com/users/dmamujee/repos","events_url":"https://api.github.com/users/dmamujee/events{/privacy}","received_events_url":"https://api.github.com/users/dmamujee/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-28T06:43:32Z","updated_at":"2015-12-01T01:44:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f6f282afed4bbdc268d4206bb9d7ba257e1e5d69","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ChessGameProject/chessGame/pulls/28/commits","review_comments_url":"https://api.github.com/repos/ChessGameProject/chessGame/pulls/28/comments","review_comment_url":"https://api.github.com/repos/ChessGameProject/chessGame/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ChessGameProject/chessGame/issues/28/comments","statuses_url":"https://api.github.com/repos/ChessGameProject/chessGame/statuses/808b8c784ec2e8b1187b7c477f534bea94d708fb","head":{"label":"ChessGameProject:development","ref":"development","sha":"808b8c784ec2e8b1187b7c477f534bea94d708fb","user":{"login":"ChessGameProject","id":15974142,"avatar_url":"https://avatars.githubusercontent.com/u/15974142?v=3","gravatar_id":"","url":"https://api.github.com/users/ChessGameProject","html_url":"https://github.com/ChessGameProject","followers_url":"https://api.github.com/users/ChessGameProject/followers","following_url":"https://api.github.com/users/ChessGameProject/following{/other_user}","gists_url":"https://api.github.com/users/ChessGameProject/gists{/gist_id}","starred_url":"https://api.github.com/users/ChessGameProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChessGameProject/subscriptions","organizations_url":"https://api.github.com/users/ChessGameProject/orgs","repos_url":"https://api.github.com/users/ChessGameProject/repos","events_url":"https://api.github.com/users/ChessGameProject/events{/privacy}","received_events_url":"https://api.github.com/users/ChessGameProject/received_events","type":"Organization","site_admin":false},"repo":{"id":46695008,"name":"chessGame","full_name":"ChessGameProject/chessGame","owner":{"login":"ChessGameProject","id":15974142,"avatar_url":"https://avatars.githubusercontent.com/u/15974142?v=3","gravatar_id":"","url":"https://api.github.com/users/ChessGameProject","html_url":"https://github.com/ChessGameProject","followers_url":"https://api.github.com/users/ChessGameProject/followers","following_url":"https://api.github.com/users/ChessGameProject/following{/other_user}","gists_url":"https://api.github.com/users/ChessGameProject/gists{/gist_id}","starred_url":"https://api.github.com/users/ChessGameProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChessGameProject/subscriptions","organizations_url":"https://api.github.com/users/ChessGameProject/orgs","repos_url":"https://api.github.com/users/ChessGameProject/repos","events_url":"https://api.github.com/users/ChessGameProject/events{/privacy}","received_events_url":"https://api.github.com/users/ChessGameProject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ChessGameProject/chessGame","description":"","fork":false,"url":"https://api.github.com/repos/ChessGameProject/chessGame","forks_url":"https://api.github.com/repos/ChessGameProject/chessGame/forks","keys_url":"https://api.github.com/repos/ChessGameProject/chessGame/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ChessGameProject/chessGame/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ChessGameProject/chessGame/teams","hooks_url":"https://api.github.com/repos/ChessGameProject/chessGame/hooks","issue_events_url":"https://api.github.com/repos/ChessGameProject/chessGame/issues/events{/number}","events_url":"https://api.github.com/repos/ChessGameProject/chessGame/events","assignees_url":"https://api.github.com/repos/ChessGameProject/chessGame/assignees{/user}","branches_url":"https://api.github.com/repos/ChessGameProject/chessGame/branches{/branch}","tags_url":"https://api.github.com/repos/ChessGameProject/chessGame/tags","blobs_url":"https://api.github.com/repos/ChessGameProject/chessGame/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ChessGameProject/chessGame/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ChessGameProject/chessGame/git/refs{/sha}","trees_url":"https://api.github.com/repos/ChessGameProject/chessGame/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ChessGameProject/chessGame/statuses/{sha}","languages_url":"https://api.github.com/repos/ChessGameProject/chessGame/languages","stargazers_url":"https://api.github.com/repos/ChessGameProject/chessGame/stargazers","contributors_url":"https://api.github.com/repos/ChessGameProject/chessGame/contributors","subscribers_url":"https://api.github.com/repos/ChessGameProject/chessGame/subscribers","subscription_url":"https://api.github.com/repos/ChessGameProject/chessGame/subscription","commits_url":"https://api.github.com/repos/ChessGameProject/chessGame/commits{/sha}","git_commits_url":"https://api.github.com/repos/ChessGameProject/chessGame/git/commits{/sha}","comments_url":"https://api.github.com/repos/ChessGameProject/chessGame/comments{/number}","issue_comment_url":"https://api.github.com/repos/ChessGameProject/chessGame/issues/comments{/number}","contents_url":"https://api.github.com/repos/ChessGameProject/chessGame/contents/{+path}","compare_url":"https://api.github.com/repos/ChessGameProject/chessGame/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ChessGameProject/chessGame/merges","archive_url":"https://api.github.com/repos/ChessGameProject/chessGame/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ChessGameProject/chessGame/downloads","issues_url":"https://api.github.com/repos/ChessGameProject/chessGame/issues{/number}","pulls_url":"https://api.github.com/repos/ChessGameProject/chessGame/pulls{/number}","milestones_url":"https://api.github.com/repos/ChessGameProject/chessGame/milestones{/number}","notifications_url":"https://api.github.com/repos/ChessGameProject/chessGame/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ChessGameProject/chessGame/labels{/name}","releases_url":"https://api.github.com/repos/ChessGameProject/chessGame/releases{/id}","created_at":"2015-11-23T03:42:27Z","updated_at":"2015-11-26T02:24:20Z","pushed_at":"2015-12-01T01:15:05Z","git_url":"git://github.com/ChessGameProject/chessGame.git","ssh_url":"git@github.com:ChessGameProject/chessGame.git","clone_url":"https://github.com/ChessGameProject/chessGame.git","svn_url":"https://github.com/ChessGameProject/chessGame","homepage":null,"size":462,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":19,"forks":0,"open_issues":19,"watchers":1,"default_branch":"master"}},"base":{"label":"ChessGameProject:master","ref":"master","sha":"64693eede716f81aa0a4a665a28fb8c8e1229ac1","user":{"login":"ChessGameProject","id":15974142,"avatar_url":"https://avatars.githubusercontent.com/u/15974142?v=3","gravatar_id":"","url":"https://api.github.com/users/ChessGameProject","html_url":"https://github.com/ChessGameProject","followers_url":"https://api.github.com/users/ChessGameProject/followers","following_url":"https://api.github.com/users/ChessGameProject/following{/other_user}","gists_url":"https://api.github.com/users/ChessGameProject/gists{/gist_id}","starred_url":"https://api.github.com/users/ChessGameProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChessGameProject/subscriptions","organizations_url":"https://api.github.com/users/ChessGameProject/orgs","repos_url":"https://api.github.com/users/ChessGameProject/repos","events_url":"https://api.github.com/users/ChessGameProject/events{/privacy}","received_events_url":"https://api.github.com/users/ChessGameProject/received_events","type":"Organization","site_admin":false},"repo":{"id":46695008,"name":"chessGame","full_name":"ChessGameProject/chessGame","owner":{"login":"ChessGameProject","id":15974142,"avatar_url":"https://avatars.githubusercontent.com/u/15974142?v=3","gravatar_id":"","url":"https://api.github.com/users/ChessGameProject","html_url":"https://github.com/ChessGameProject","followers_url":"https://api.github.com/users/ChessGameProject/followers","following_url":"https://api.github.com/users/ChessGameProject/following{/other_user}","gists_url":"https://api.github.com/users/ChessGameProject/gists{/gist_id}","starred_url":"https://api.github.com/users/ChessGameProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChessGameProject/subscriptions","organizations_url":"https://api.github.com/users/ChessGameProject/orgs","repos_url":"https://api.github.com/users/ChessGameProject/repos","events_url":"https://api.github.com/users/ChessGameProject/events{/privacy}","received_events_url":"https://api.github.com/users/ChessGameProject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ChessGameProject/chessGame","description":"","fork":false,"url":"https://api.github.com/repos/ChessGameProject/chessGame","forks_url":"https://api.github.com/repos/ChessGameProject/chessGame/forks","keys_url":"https://api.github.com/repos/ChessGameProject/chessGame/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ChessGameProject/chessGame/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ChessGameProject/chessGame/teams","hooks_url":"https://api.github.com/repos/ChessGameProject/chessGame/hooks","issue_events_url":"https://api.github.com/repos/ChessGameProject/chessGame/issues/events{/number}","events_url":"https://api.github.com/repos/ChessGameProject/chessGame/events","assignees_url":"https://api.github.com/repos/ChessGameProject/chessGame/assignees{/user}","branches_url":"https://api.github.com/repos/ChessGameProject/chessGame/branches{/branch}","tags_url":"https://api.github.com/repos/ChessGameProject/chessGame/tags","blobs_url":"https://api.github.com/repos/ChessGameProject/chessGame/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ChessGameProject/chessGame/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ChessGameProject/chessGame/git/refs{/sha}","trees_url":"https://api.github.com/repos/ChessGameProject/chessGame/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ChessGameProject/chessGame/statuses/{sha}","languages_url":"https://api.github.com/repos/ChessGameProject/chessGame/languages","stargazers_url":"https://api.github.com/repos/ChessGameProject/chessGame/stargazers","contributors_url":"https://api.github.com/repos/ChessGameProject/chessGame/contributors","subscribers_url":"https://api.github.com/repos/ChessGameProject/chessGame/subscribers","subscription_url":"https://api.github.com/repos/ChessGameProject/chessGame/subscription","commits_url":"https://api.github.com/repos/ChessGameProject/chessGame/commits{/sha}","git_commits_url":"https://api.github.com/repos/ChessGameProject/chessGame/git/commits{/sha}","comments_url":"https://api.github.com/repos/ChessGameProject/chessGame/comments{/number}","issue_comment_url":"https://api.github.com/repos/ChessGameProject/chessGame/issues/comments{/number}","contents_url":"https://api.github.com/repos/ChessGameProject/chessGame/contents/{+path}","compare_url":"https://api.github.com/repos/ChessGameProject/chessGame/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ChessGameProject/chessGame/merges","archive_url":"https://api.github.com/repos/ChessGameProject/chessGame/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ChessGameProject/chessGame/downloads","issues_url":"https://api.github.com/repos/ChessGameProject/chessGame/issues{/number}","pulls_url":"https://api.github.com/repos/ChessGameProject/chessGame/pulls{/number}","milestones_url":"https://api.github.com/repos/ChessGameProject/chessGame/milestones{/number}","notifications_url":"https://api.github.com/repos/ChessGameProject/chessGame/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ChessGameProject/chessGame/labels{/name}","releases_url":"https://api.github.com/repos/ChessGameProject/chessGame/releases{/id}","created_at":"2015-11-23T03:42:27Z","updated_at":"2015-11-26T02:24:20Z","pushed_at":"2015-12-01T01:15:05Z","git_url":"git://github.com/ChessGameProject/chessGame.git","ssh_url":"git@github.com:ChessGameProject/chessGame.git","clone_url":"https://github.com/ChessGameProject/chessGame.git","svn_url":"https://github.com/ChessGameProject/chessGame","homepage":null,"size":462,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":19,"forks":0,"open_issues":19,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ChessGameProject/chessGame/pulls/28"},"html":{"href":"https://github.com/ChessGameProject/chessGame/pull/28"},"issue":{"href":"https://api.github.com/repos/ChessGameProject/chessGame/issues/28"},"comments":{"href":"https://api.github.com/repos/ChessGameProject/chessGame/issues/28/comments"},"review_comments":{"href":"https://api.github.com/repos/ChessGameProject/chessGame/pulls/28/comments"},"review_comment":{"href":"https://api.github.com/repos/ChessGameProject/chessGame/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ChessGameProject/chessGame/pulls/28/commits"},"statuses":{"href":"https://api.github.com/repos/ChessGameProject/chessGame/statuses/808b8c784ec2e8b1187b7c477f534bea94d708fb"}}}}