GitHub PullRequestReviewCommentEvent at 2014-09-30 20:53:34
Repository: piconot
Actor: matthewcook333
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/pulls/comments/18246405","id":18246405,"diff_hunk":"@@ -0,0 +1,236 @@\n+package piconot\n+\n+\n+import java.io.File\n+\n+import picolib.maze.Maze\n+import picolib.semantics._\n+import scalafx.application.JFXApp\n+\n+/**\n+ * @author Alejandro Frias and Tyler Marklyn\n+ * @version 4.2.9.26\n+ * \n+ * This DSL for picobot is how it Ought to be written (see what we did there, eh eh?).\n+ * How to use:\n+ *  1. create an object that extends PicoOught and passes in the file name for the map\n+ *          object YourBot extends PicoOught(\"filename\")\n+ *  2. Program easily using named sections, powerful Go (i.e. move) commands, directional \n+ *     based commands, and even simple one line If statements\n+ *\n+ * Notes:\n+ *  1. Remember to predeclare all the section names at the top like so:\n+ *          Sections(\"Section 1\", \"Other section\", \"You get it\", etc.)\n+ *  2. If statements simply skip the next line if the surroundings don't match. \n+ *     You can make it skip chunk by moving that chunk into a separate section\n+ *  3. It might not work if you have more than 99 sections and more than 99 lines within a section.\n+ */\n+class PicoOught(val mapFile: String) {\n+    // The global state:\n+    private var section_number = 0                // The section we're currently making rules for\n+    private var line_number = 0                   // The line within the section\n+    private var rules: List[Rule] = List()        // The rules generated so far\n+    private var sections: List[String] = List()   // The list of section names\n+\n+    // predeclares the sections to be used\n+    def Sections(args: String*): Unit = {\n+        sections = args.toList\n+    }\n+\n+    // Start Section \"section name\"\n+    object Start {\n+        def Section(label: String): Unit = {\n+            section_number = sections.indexOf(label) + 1\n+            line_number = 0\n+        }\n+    }\n+\n+    // Do Section \"section name\"\n+    object Do {\n+        def Section(label: String): Unit = {\n+            line_number = line_number + 1\n+            val new_section = sections.indexOf(label) + 1\n+            if (new_section == -1) println(\"It looks like you forgot to predeclare a section. :(\")\n+            val newRules = List.range(1,5).map( dir =>\n+                makeRule(section_number, line_number, dir,\n+                anySurroundings, StayHere,\n+                new_section, 1, dir) )\n+            rules = rules ++ newRules\n+        }\n+    }\n+\n+    // Face (up | right | down | left)\n+    object Face {\n+        def up = genFace(1)\n+        def right = genFace(2)\n+        def down = genFace(3)\n+        def left = genFace(4)\n+\n+        def genFace(toFace: Int): Unit = {\n+        line_number = line_number + 1\n+        val newRules = List.range(1,5).map(dir => makeRule(\n+            section_number, line_number, dir,\n+            anySurroundings, StayHere,\n+            section_number, line_number + 1, toFace\n+            ))\n+        rules = rules ++ newRules\n+        }\n+    }\n+\n+    // Turn (left | right | around) \n+    object Turn {\n+        def left = genTurn(3)\n+        def right = genTurn(1)\n+        def around = genTurn(2)\n+\n+        def genTurn(turnAmount: Int): Unit = {\n+            line_number = line_number + 1;\n+            val newRules = List.range(1,5).map(dir => makeRule(\n+                section_number, line_number, dir,\n+                anySurroundings, StayHere,\n+                section_number, line_number + 1, toDir(dir + turnAmount)\n+                ))\n+            rules = rules ++ newRules\n+        }\n+    }\n+\n+    // Go direction (once | whilst(conditions))\n+    // conditions: (wall | open) (in_front | behind | on_left | on_right)\n+    object Go {\n+        def forwards(conds: List[Surroundings]) = makeGo(0, conds)\n+\n+        def right(conds: List[Surroundings]) = makeGo(1, conds)\n+\n+        def backwards(conds: List[Surroundings]) = makeGo(2, conds)\n+\n+        def left(conds: List[Surroundings]) = makeGo(3, conds)\n+\n+        private def makeGo(dirDiff: Int, conds: List[Surroundings]) = {\n+            line_number = line_number + 1\n+            conds match {\n+                case Nil => rules = rules ++ List.range(1,5).map( dir => \n+                                makeRule(section_number, line_number, dir,\n+                                         anySurroundings, dirToMoveDirection(toDir(dir + dirDiff)),\n+                                         section_number, line_number + 1, dir))\n+\n+                \n+                case any => rules = rules ++ List.range(1,5).flatMap( dir =>\n+                    rulesFromDirAndSurr(dir, toDir(dir + dirDiff), conds(dir-1)))\n+            }\n+        }\n+                               \n+\n+        private def rulesFromDirAndSurr(dirFacing: Int, moveDir: Int, surr: Surroundings): List[Rule] = {\n+            var someRules: List[Rule] = List(makeRule(section_number, line_number, dirFacing,\n+                                             surr, dirToMoveDirection(moveDir),\n+                                             section_number, line_number, dirFacing))\n+            if(surr.north != Anything) {","path":"src/main/scala/piconot/FriasMarklynAPI.scala","position":127,"original_position":127,"commit_id":"2a483af8993f2b30a685a7e2dde64c4cf3ac272c","original_commit_id":"2a483af8993f2b30a685a7e2dde64c4cf3ac272c","user":{"login":"matthewcook333","id":4873536,"avatar_url":"https://avatars.githubusercontent.com/u/4873536?v=2","gravatar_id":"","url":"https://api.github.com/users/matthewcook333","html_url":"https://github.com/matthewcook333","followers_url":"https://api.github.com/users/matthewcook333/followers","following_url":"https://api.github.com/users/matthewcook333/following{/other_user}","gists_url":"https://api.github.com/users/matthewcook333/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewcook333/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewcook333/subscriptions","organizations_url":"https://api.github.com/users/matthewcook333/orgs","repos_url":"https://api.github.com/users/matthewcook333/repos","events_url":"https://api.github.com/users/matthewcook333/events{/privacy}","received_events_url":"https://api.github.com/users/matthewcook333/received_events","type":"User","site_admin":false},"body":"If north does not equal \"Anything\"? It isn't exactly clear from this part of the code what would then be \"Nothing\" (or the opposite of anything). This makes more sense when I look at the mapping from Anything to Anything, and so this must mean whether it is Blocked or Open, but it could be a bit confusing what this is doing just looking at this part.","created_at":"2014-09-30T20:53:34Z","updated_at":"2014-09-30T20:53:34Z","html_url":"https://github.com/hmc-cs111-fall2014/piconot/pull/8#discussion_r18246405","pull_request_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/pulls/comments/18246405"},"html":{"href":"https://github.com/hmc-cs111-fall2014/piconot/pull/8#discussion_r18246405"},"pull_request":{"href":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/pulls/8","id":21978691,"html_url":"https://github.com/hmc-cs111-fall2014/piconot/pull/8","diff_url":"https://github.com/hmc-cs111-fall2014/piconot/pull/8.diff","patch_url":"https://github.com/hmc-cs111-fall2014/piconot/pull/8.patch","issue_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/issues/8","number":8,"state":"open","locked":false,"title":"Assignment 3 - Alejandro Frias and Tyler Marklyn (Team #9)","user":{"login":"Celimas","id":8561967,"avatar_url":"https://avatars.githubusercontent.com/u/8561967?v=2","gravatar_id":"","url":"https://api.github.com/users/Celimas","html_url":"https://github.com/Celimas","followers_url":"https://api.github.com/users/Celimas/followers","following_url":"https://api.github.com/users/Celimas/following{/other_user}","gists_url":"https://api.github.com/users/Celimas/gists{/gist_id}","starred_url":"https://api.github.com/users/Celimas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Celimas/subscriptions","organizations_url":"https://api.github.com/users/Celimas/orgs","repos_url":"https://api.github.com/users/Celimas/repos","events_url":"https://api.github.com/users/Celimas/events{/privacy}","received_events_url":"https://api.github.com/users/Celimas/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-09-30T02:47:37Z","updated_at":"2014-09-30T20:53:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5f313d71b0557834634393aa1b9ab29c01229fc6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/pulls/8/commits","review_comments_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/pulls/8/comments","review_comment_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/pulls/comments/{number}","comments_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/issues/8/comments","statuses_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/statuses/2a483af8993f2b30a685a7e2dde64c4cf3ac272c","head":{"label":"AlejandroFrias:master","ref":"master","sha":"2a483af8993f2b30a685a7e2dde64c4cf3ac272c","user":{"login":"AlejandroFrias","id":3598338,"avatar_url":"https://avatars.githubusercontent.com/u/3598338?v=2","gravatar_id":"","url":"https://api.github.com/users/AlejandroFrias","html_url":"https://github.com/AlejandroFrias","followers_url":"https://api.github.com/users/AlejandroFrias/followers","following_url":"https://api.github.com/users/AlejandroFrias/following{/other_user}","gists_url":"https://api.github.com/users/AlejandroFrias/gists{/gist_id}","starred_url":"https://api.github.com/users/AlejandroFrias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlejandroFrias/subscriptions","organizations_url":"https://api.github.com/users/AlejandroFrias/orgs","repos_url":"https://api.github.com/users/AlejandroFrias/repos","events_url":"https://api.github.com/users/AlejandroFrias/events{/privacy}","received_events_url":"https://api.github.com/users/AlejandroFrias/received_events","type":"User","site_admin":false},"repo":{"id":24392846,"name":"piconot","full_name":"AlejandroFrias/piconot","owner":{"login":"AlejandroFrias","id":3598338,"avatar_url":"https://avatars.githubusercontent.com/u/3598338?v=2","gravatar_id":"","url":"https://api.github.com/users/AlejandroFrias","html_url":"https://github.com/AlejandroFrias","followers_url":"https://api.github.com/users/AlejandroFrias/followers","following_url":"https://api.github.com/users/AlejandroFrias/following{/other_user}","gists_url":"https://api.github.com/users/AlejandroFrias/gists{/gist_id}","starred_url":"https://api.github.com/users/AlejandroFrias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlejandroFrias/subscriptions","organizations_url":"https://api.github.com/users/AlejandroFrias/orgs","repos_url":"https://api.github.com/users/AlejandroFrias/repos","events_url":"https://api.github.com/users/AlejandroFrias/events{/privacy}","received_events_url":"https://api.github.com/users/AlejandroFrias/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AlejandroFrias/piconot","description":"","fork":true,"url":"https://api.github.com/repos/AlejandroFrias/piconot","forks_url":"https://api.github.com/repos/AlejandroFrias/piconot/forks","keys_url":"https://api.github.com/repos/AlejandroFrias/piconot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AlejandroFrias/piconot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AlejandroFrias/piconot/teams","hooks_url":"https://api.github.com/repos/AlejandroFrias/piconot/hooks","issue_events_url":"https://api.github.com/repos/AlejandroFrias/piconot/issues/events{/number}","events_url":"https://api.github.com/repos/AlejandroFrias/piconot/events","assignees_url":"https://api.github.com/repos/AlejandroFrias/piconot/assignees{/user}","branches_url":"https://api.github.com/repos/AlejandroFrias/piconot/branches{/branch}","tags_url":"https://api.github.com/repos/AlejandroFrias/piconot/tags","blobs_url":"https://api.github.com/repos/AlejandroFrias/piconot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AlejandroFrias/piconot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AlejandroFrias/piconot/git/refs{/sha}","trees_url":"https://api.github.com/repos/AlejandroFrias/piconot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AlejandroFrias/piconot/statuses/{sha}","languages_url":"https://api.github.com/repos/AlejandroFrias/piconot/languages","stargazers_url":"https://api.github.com/repos/AlejandroFrias/piconot/stargazers","contributors_url":"https://api.github.com/repos/AlejandroFrias/piconot/contributors","subscribers_url":"https://api.github.com/repos/AlejandroFrias/piconot/subscribers","subscription_url":"https://api.github.com/repos/AlejandroFrias/piconot/subscription","commits_url":"https://api.github.com/repos/AlejandroFrias/piconot/commits{/sha}","git_commits_url":"https://api.github.com/repos/AlejandroFrias/piconot/git/commits{/sha}","comments_url":"https://api.github.com/repos/AlejandroFrias/piconot/comments{/number}","issue_comment_url":"https://api.github.com/repos/AlejandroFrias/piconot/issues/comments/{number}","contents_url":"https://api.github.com/repos/AlejandroFrias/piconot/contents/{+path}","compare_url":"https://api.github.com/repos/AlejandroFrias/piconot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AlejandroFrias/piconot/merges","archive_url":"https://api.github.com/repos/AlejandroFrias/piconot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AlejandroFrias/piconot/downloads","issues_url":"https://api.github.com/repos/AlejandroFrias/piconot/issues{/number}","pulls_url":"https://api.github.com/repos/AlejandroFrias/piconot/pulls{/number}","milestones_url":"https://api.github.com/repos/AlejandroFrias/piconot/milestones{/number}","notifications_url":"https://api.github.com/repos/AlejandroFrias/piconot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AlejandroFrias/piconot/labels{/name}","releases_url":"https://api.github.com/repos/AlejandroFrias/piconot/releases{/id}","created_at":"2014-09-23T23:14:16Z","updated_at":"2014-09-24T00:10:04Z","pushed_at":"2014-09-30T02:46:02Z","git_url":"git://github.com/AlejandroFrias/piconot.git","ssh_url":"git@github.com:AlejandroFrias/piconot.git","clone_url":"https://github.com/AlejandroFrias/piconot.git","svn_url":"https://github.com/AlejandroFrias/piconot","homepage":null,"size":295,"stargazers_count":0,"watchers_count":0,"language":"Scala","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":"hmc-cs111-fall2014:master","ref":"master","sha":"316a4679fc9ae7c219a13ffef87dfa53fd7f4b3a","user":{"login":"hmc-cs111-fall2014","id":8164020,"avatar_url":"https://avatars.githubusercontent.com/u/8164020?v=2","gravatar_id":"","url":"https://api.github.com/users/hmc-cs111-fall2014","html_url":"https://github.com/hmc-cs111-fall2014","followers_url":"https://api.github.com/users/hmc-cs111-fall2014/followers","following_url":"https://api.github.com/users/hmc-cs111-fall2014/following{/other_user}","gists_url":"https://api.github.com/users/hmc-cs111-fall2014/gists{/gist_id}","starred_url":"https://api.github.com/users/hmc-cs111-fall2014/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmc-cs111-fall2014/subscriptions","organizations_url":"https://api.github.com/users/hmc-cs111-fall2014/orgs","repos_url":"https://api.github.com/users/hmc-cs111-fall2014/repos","events_url":"https://api.github.com/users/hmc-cs111-fall2014/events{/privacy}","received_events_url":"https://api.github.com/users/hmc-cs111-fall2014/received_events","type":"Organization","site_admin":false},"repo":{"id":24044276,"name":"piconot","full_name":"hmc-cs111-fall2014/piconot","owner":{"login":"hmc-cs111-fall2014","id":8164020,"avatar_url":"https://avatars.githubusercontent.com/u/8164020?v=2","gravatar_id":"","url":"https://api.github.com/users/hmc-cs111-fall2014","html_url":"https://github.com/hmc-cs111-fall2014","followers_url":"https://api.github.com/users/hmc-cs111-fall2014/followers","following_url":"https://api.github.com/users/hmc-cs111-fall2014/following{/other_user}","gists_url":"https://api.github.com/users/hmc-cs111-fall2014/gists{/gist_id}","starred_url":"https://api.github.com/users/hmc-cs111-fall2014/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmc-cs111-fall2014/subscriptions","organizations_url":"https://api.github.com/users/hmc-cs111-fall2014/orgs","repos_url":"https://api.github.com/users/hmc-cs111-fall2014/repos","events_url":"https://api.github.com/users/hmc-cs111-fall2014/events{/privacy}","received_events_url":"https://api.github.com/users/hmc-cs111-fall2014/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hmc-cs111-fall2014/piconot","description":"","fork":false,"url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot","forks_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/forks","keys_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/teams","hooks_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/hooks","issue_events_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/issues/events{/number}","events_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/events","assignees_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/assignees{/user}","branches_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/branches{/branch}","tags_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/tags","blobs_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/statuses/{sha}","languages_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/languages","stargazers_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/stargazers","contributors_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/contributors","subscribers_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/subscribers","subscription_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/subscription","commits_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/issues/comments/{number}","contents_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/contents/{+path}","compare_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/merges","archive_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/downloads","issues_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/issues{/number}","pulls_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/pulls{/number}","milestones_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/milestones{/number}","notifications_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/labels{/name}","releases_url":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/releases{/id}","created_at":"2014-09-15T05:39:16Z","updated_at":"2014-09-17T19:51:22Z","pushed_at":"2014-09-30T04:02:19Z","git_url":"git://github.com/hmc-cs111-fall2014/piconot.git","ssh_url":"git@github.com:hmc-cs111-fall2014/piconot.git","clone_url":"https://github.com/hmc-cs111-fall2014/piconot.git","svn_url":"https://github.com/hmc-cs111-fall2014/piconot","homepage":null,"size":971,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":9,"forks":11,"open_issues":9,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/pulls/8"},"html":{"href":"https://github.com/hmc-cs111-fall2014/piconot/pull/8"},"issue":{"href":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/issues/8"},"comments":{"href":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/hmc-cs111-fall2014/piconot/statuses/2a483af8993f2b30a685a7e2dde64c4cf3ac272c"}}}}