{"action":"created","comment":{"url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/pulls/comments/72921382","id":72921382,"diff_hunk":"@@ -0,0 +1,346 @@\n+//\n+//  RubiksCube.h\n+//  rubiks-cube-solver\n+//\n+//  Created by Yanyan Tran on 2016-07-31.\n+//  Copyright © 2016 Yanyan Tran. All rights reserved.\n+//\n+\n+#ifndef RubiksCube_h\n+#define RubiksCube_h\n+\n+#include <iostream>\n+#include <string>\n+\n+/** Array representation of a Rubiks Cube.\n+ 0 = F\n+ 1 = L\n+ 2 = R\n+ 3 = U\n+ 4 = D\n+ 5 = B\n+ */\n+struct RubiksCube {\n+    \n+private:\n+    char cube[6][3][3];\n+    \n+    // Helper functions\n+    \n+    void shiftRow (int face, int row, char& a, char& b, char& c);\n+    void shiftRowReverse (int face, int row, char& a, char& b, char& c);\n+    void shiftCol (int face, int col, char& a, char& b, char& c);\n+    void shiftColReverse (int face, int col, char& a, char& b, char& c);\n+    \n+    void rotateFaceClockwise (int face);\n+    void rotateFaceAntiClockwise (int face);\n+public:\n+    RubiksCube(char cube[6][3][3]);\n+    \n+    void turnFrontClockwise();\n+    void turnFrontAntiClockwise();\n+    void turnLeftClockwise();\n+    void turnLeftAntiClockwise();\n+    void turnRightClockwise();\n+    void turnRightAntiClockwise();\n+    void turnUpClockwise();\n+    void turnUpAntiClockwise();\n+    void turnDownClockwise();\n+    void turnDownAntiClockwise();\n+    void turnBackClockwise();\n+    void turnBackAntiClockwise();\n+    \n+    std::string toString();\n+};\n+\n+\n+RubiksCube::RubiksCube(char cube[6][3][3]) {\n+    for (int i = 0; i < 6; i++){\n+        for (int j = 0; j < 6; j++){\n+            for (int k = 0; k < 6; k++){\n+                this -> cube[i][j][k] = cube[i][j][k];\n+            }\n+        }\n+    }\n+}\n+\n+\n+/** Replaces a row on a face of the cube using data from another row/column */\n+void RubiksCube::shiftRow(int face, int row, char& a, char& b, char& c){\n+    char a2, b2, c2;\n+    a2 = cube[face][row][0];\n+    b2 = cube[face][row][1];\n+    c2 = cube[face][row][2];\n+    \n+    cube[face][row][0] = a;\n+    cube[face][row][1] = b;\n+    cube[face][row][2] = c;\n+    \n+    a = a2;\n+    b = b2;\n+    c = c2;\n+}\n+\n+/** Replaces a row on a face of the cube using data from another row/column in reverse order */\n+void RubiksCube::shiftRowReverse(int face, int row, char& a, char& b, char& c){\n+    char a2, b2, c2;\n+    a2 = cube[face][row][0];\n+    b2 = cube[face][row][1];\n+    c2 = cube[face][row][2];\n+    \n+    cube[face][row][0] = c;\n+    cube[face][row][1] = b;\n+    cube[face][row][2] = a;\n+    \n+    a = a2;\n+    b = b2;\n+    c = c2;\n+}\n+\n+/** Replaces a column on a face of the cube using data from another row/column */\n+void RubiksCube::shiftCol(int face, int col, char& a, char& b, char& c){\n+    char a2, b2, c2;\n+    a2 = cube[face][0][col];\n+    b2 = cube[face][1][col];\n+    c2 = cube[face][1][col];","path":"RubiksCube.h","position":105,"original_position":105,"commit_id":"7259b20d26b0daa3d63fc19aa8894f97e7907299","original_commit_id":"7259b20d26b0daa3d63fc19aa8894f97e7907299","user":{"login":"ahmedsabie","id":16299227,"avatar_url":"https://avatars.githubusercontent.com/u/16299227?v=3","gravatar_id":"","url":"https://api.github.com/users/ahmedsabie","html_url":"https://github.com/ahmedsabie","followers_url":"https://api.github.com/users/ahmedsabie/followers","following_url":"https://api.github.com/users/ahmedsabie/following{/other_user}","gists_url":"https://api.github.com/users/ahmedsabie/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmedsabie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmedsabie/subscriptions","organizations_url":"https://api.github.com/users/ahmedsabie/orgs","repos_url":"https://api.github.com/users/ahmedsabie/repos","events_url":"https://api.github.com/users/ahmedsabie/events{/privacy}","received_events_url":"https://api.github.com/users/ahmedsabie/received_events","type":"User","site_admin":false},"body":"second index should be 2","created_at":"2016-08-01T03:47:25Z","updated_at":"2016-08-01T03:47:25Z","html_url":"https://github.com/ahmedsabie/rubiks-cube-solver/pull/1#discussion_r72921382","pull_request_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/pulls/comments/72921382"},"html":{"href":"https://github.com/ahmedsabie/rubiks-cube-solver/pull/1#discussion_r72921382"},"pull_request":{"href":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/pulls/1","id":79508019,"html_url":"https://github.com/ahmedsabie/rubiks-cube-solver/pull/1","diff_url":"https://github.com/ahmedsabie/rubiks-cube-solver/pull/1.diff","patch_url":"https://github.com/ahmedsabie/rubiks-cube-solver/pull/1.patch","issue_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/issues/1","number":1,"state":"open","locked":false,"title":"Apply rotations and track state of cube","user":{"login":"tran-yy","id":20644092,"avatar_url":"https://avatars.githubusercontent.com/u/20644092?v=3","gravatar_id":"","url":"https://api.github.com/users/tran-yy","html_url":"https://github.com/tran-yy","followers_url":"https://api.github.com/users/tran-yy/followers","following_url":"https://api.github.com/users/tran-yy/following{/other_user}","gists_url":"https://api.github.com/users/tran-yy/gists{/gist_id}","starred_url":"https://api.github.com/users/tran-yy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tran-yy/subscriptions","organizations_url":"https://api.github.com/users/tran-yy/orgs","repos_url":"https://api.github.com/users/tran-yy/repos","events_url":"https://api.github.com/users/tran-yy/events{/privacy}","received_events_url":"https://api.github.com/users/tran-yy/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-01T03:16:14Z","updated_at":"2016-08-01T03:47:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d2ef2b10079101ce6a53dd3743a1a691e1440a64","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/pulls/1/commits","review_comments_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/pulls/1/comments","review_comment_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/issues/1/comments","statuses_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/statuses/7259b20d26b0daa3d63fc19aa8894f97e7907299","head":{"label":"tran-yy:master","ref":"master","sha":"7259b20d26b0daa3d63fc19aa8894f97e7907299","user":{"login":"tran-yy","id":20644092,"avatar_url":"https://avatars.githubusercontent.com/u/20644092?v=3","gravatar_id":"","url":"https://api.github.com/users/tran-yy","html_url":"https://github.com/tran-yy","followers_url":"https://api.github.com/users/tran-yy/followers","following_url":"https://api.github.com/users/tran-yy/following{/other_user}","gists_url":"https://api.github.com/users/tran-yy/gists{/gist_id}","starred_url":"https://api.github.com/users/tran-yy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tran-yy/subscriptions","organizations_url":"https://api.github.com/users/tran-yy/orgs","repos_url":"https://api.github.com/users/tran-yy/repos","events_url":"https://api.github.com/users/tran-yy/events{/privacy}","received_events_url":"https://api.github.com/users/tran-yy/received_events","type":"User","site_admin":false},"repo":{"id":64613322,"name":"rubiks-cube-solver","full_name":"tran-yy/rubiks-cube-solver","owner":{"login":"tran-yy","id":20644092,"avatar_url":"https://avatars.githubusercontent.com/u/20644092?v=3","gravatar_id":"","url":"https://api.github.com/users/tran-yy","html_url":"https://github.com/tran-yy","followers_url":"https://api.github.com/users/tran-yy/followers","following_url":"https://api.github.com/users/tran-yy/following{/other_user}","gists_url":"https://api.github.com/users/tran-yy/gists{/gist_id}","starred_url":"https://api.github.com/users/tran-yy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tran-yy/subscriptions","organizations_url":"https://api.github.com/users/tran-yy/orgs","repos_url":"https://api.github.com/users/tran-yy/repos","events_url":"https://api.github.com/users/tran-yy/events{/privacy}","received_events_url":"https://api.github.com/users/tran-yy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tran-yy/rubiks-cube-solver","description":"Solves the rubiks cube for you, no thinking required.","fork":true,"url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver","forks_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/forks","keys_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/teams","hooks_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/hooks","issue_events_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/issues/events{/number}","events_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/events","assignees_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/assignees{/user}","branches_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/branches{/branch}","tags_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/tags","blobs_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/git/refs{/sha}","trees_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/statuses/{sha}","languages_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/languages","stargazers_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/stargazers","contributors_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/contributors","subscribers_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/subscribers","subscription_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/subscription","commits_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/commits{/sha}","git_commits_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/git/commits{/sha}","comments_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/comments{/number}","issue_comment_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/issues/comments{/number}","contents_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/contents/{+path}","compare_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/merges","archive_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/downloads","issues_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/issues{/number}","pulls_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/pulls{/number}","milestones_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/milestones{/number}","notifications_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/labels{/name}","releases_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/releases{/id}","deployments_url":"https://api.github.com/repos/tran-yy/rubiks-cube-solver/deployments","created_at":"2016-07-31T20:17:01Z","updated_at":"2016-08-01T03:03:36Z","pushed_at":"2016-08-01T03:07:14Z","git_url":"git://github.com/tran-yy/rubiks-cube-solver.git","ssh_url":"git@github.com:tran-yy/rubiks-cube-solver.git","clone_url":"https://github.com/tran-yy/rubiks-cube-solver.git","svn_url":"https://github.com/tran-yy/rubiks-cube-solver","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ahmedsabie:master","ref":"master","sha":"fc805fd84861a19ff7066a8cd1ce7005d37db5a4","user":{"login":"ahmedsabie","id":16299227,"avatar_url":"https://avatars.githubusercontent.com/u/16299227?v=3","gravatar_id":"","url":"https://api.github.com/users/ahmedsabie","html_url":"https://github.com/ahmedsabie","followers_url":"https://api.github.com/users/ahmedsabie/followers","following_url":"https://api.github.com/users/ahmedsabie/following{/other_user}","gists_url":"https://api.github.com/users/ahmedsabie/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmedsabie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmedsabie/subscriptions","organizations_url":"https://api.github.com/users/ahmedsabie/orgs","repos_url":"https://api.github.com/users/ahmedsabie/repos","events_url":"https://api.github.com/users/ahmedsabie/events{/privacy}","received_events_url":"https://api.github.com/users/ahmedsabie/received_events","type":"User","site_admin":false},"repo":{"id":64603667,"name":"rubiks-cube-solver","full_name":"ahmedsabie/rubiks-cube-solver","owner":{"login":"ahmedsabie","id":16299227,"avatar_url":"https://avatars.githubusercontent.com/u/16299227?v=3","gravatar_id":"","url":"https://api.github.com/users/ahmedsabie","html_url":"https://github.com/ahmedsabie","followers_url":"https://api.github.com/users/ahmedsabie/followers","following_url":"https://api.github.com/users/ahmedsabie/following{/other_user}","gists_url":"https://api.github.com/users/ahmedsabie/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmedsabie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmedsabie/subscriptions","organizations_url":"https://api.github.com/users/ahmedsabie/orgs","repos_url":"https://api.github.com/users/ahmedsabie/repos","events_url":"https://api.github.com/users/ahmedsabie/events{/privacy}","received_events_url":"https://api.github.com/users/ahmedsabie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ahmedsabie/rubiks-cube-solver","description":"Solves the rubiks cube for you, no thinking required.","fork":false,"url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver","forks_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/forks","keys_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/teams","hooks_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/hooks","issue_events_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/issues/events{/number}","events_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/events","assignees_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/assignees{/user}","branches_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/branches{/branch}","tags_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/tags","blobs_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/git/refs{/sha}","trees_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/statuses/{sha}","languages_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/languages","stargazers_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/stargazers","contributors_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/contributors","subscribers_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/subscribers","subscription_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/subscription","commits_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/commits{/sha}","git_commits_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/git/commits{/sha}","comments_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/comments{/number}","issue_comment_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/issues/comments{/number}","contents_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/contents/{+path}","compare_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/merges","archive_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/downloads","issues_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/issues{/number}","pulls_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/pulls{/number}","milestones_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/milestones{/number}","notifications_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/labels{/name}","releases_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/releases{/id}","deployments_url":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/deployments","created_at":"2016-07-31T16:26:31Z","updated_at":"2016-08-01T00:52:44Z","pushed_at":"2016-08-01T03:16:16Z","git_url":"git://github.com/ahmedsabie/rubiks-cube-solver.git","ssh_url":"git@github.com:ahmedsabie/rubiks-cube-solver.git","clone_url":"https://github.com/ahmedsabie/rubiks-cube-solver.git","svn_url":"https://github.com/ahmedsabie/rubiks-cube-solver","homepage":null,"size":2,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/pulls/1"},"html":{"href":"https://github.com/ahmedsabie/rubiks-cube-solver/pull/1"},"issue":{"href":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/issues/1"},"comments":{"href":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/ahmedsabie/rubiks-cube-solver/statuses/7259b20d26b0daa3d63fc19aa8894f97e7907299"}}}}
{"actor":{"display_login":"ahmedsabie"}}