{"action":"created","comment":{"url":"https://api.github.com/repos/mspaeth/GameOfLife/pulls/comments/52922260","id":52922260,"diff_hunk":"@@ -11,83 +11,39 @@\n include_once(\"lib/external/vendor/autoload.php\");\n \n foreach (glob('lib/output/*.php') as $file) include( $file );\n+foreach (glob('lib/input/*.php') as $file) include( $file );\n \n use Ulrichsg\\Getopt;\n $options = new Getopt(array(\n-            array('o','output',Getopt::REQUIRED_ARGUMENT,'Output in console, as png or gif'),\n-            array('w','width',Getopt::REQUIRED_ARGUMENT,'Length of x-axis of the gamefield 1-*'),\n-            array('h','height',Getopt::REQUIRED_ARGUMENT,'Length of the y-axis of the gamefield 1-*'),\n-            array('c','numCycles',Getopt::REQUIRED_ARGUMENT, 'Number of rounds the game should play 1-*'),\n-            array('t','type',Getopt::REQUIRED_ARGUMENT, 'Figure that should be set, blinker, glider, or lws'),\n-            array('H', 'help', Getopt::NO_ARGUMENT)\n+    array('i','input',Getopt::REQUIRED_ARGUMENT,'Input type (for now only txt is implemented'),\n+    array('f','filepath',Getopt::OPTIONAL_ARGUMENT,'Path to txt file(only required if txt is choosen as input'),\n+    array('o','output',Getopt::REQUIRED_ARGUMENT,'Output in console, as png or gif'),\n+    array('c','numCycles',Getopt::REQUIRED_ARGUMENT, 'Number of rounds the game should play 1-*'),\n+    array('H', 'help', Getopt::NO_ARGUMENT)\n \n ));\n \n $options->parse();\n \n-if ($options->getOption('width')) $x = $options->getOption('h');\n-else echo \"Argument --width is missing\\n\";\n-\n-if ($options->getOption('height')) $y = $options->getOption('h');\n-else echo \"Argument --height is missing\\n\";\n-\n-if (isset($x) && isset($y))\n+if ($options->getOption('input'))\n {\n-    $gameField = new GameField($x,$y);\n-\n-    if($options->getOption('type')) {\n-\n-        switch ($options->getOption('type'))\n-        {\n-            case \"blinker\":\n-                $gameField->getCellByCoords(3, 2)->life();\n-                $gameField->getCellByCoords(3, 3)->life();\n-                $gameField->getCellByCoords(3, 4)->life();\n-                break;\n-\n-            case \"glider\":\n-                $gameField->getCellByCoords(2, 1)->life();\n-                $gameField->getCellByCoords(3, 2)->life();\n-                $gameField->getCellByCoords(3, 3)->life();\n-                $gameField->getCellByCoords(2, 3)->life();\n-                $gameField->getCellByCoords(1, 3)->life();\n-                break;\n+    if ($options->getOption(\"filepath\")) $config = array('filePath' => $options->getOption('filepath'));\n+    $inputClass = $options->getOption(\"input\").\"Input\";\n+    $input = new $inputClass($config);","path":"v1/runGame.php","position":54,"original_position":54,"commit_id":"52469c7973f3e9d6736468adf50b2cbd18870675","original_commit_id":"52469c7973f3e9d6736468adf50b2cbd18870675","user":{"login":"mspaeth","id":8329841,"avatar_url":"https://avatars.githubusercontent.com/u/8329841?v=3","gravatar_id":"","url":"https://api.github.com/users/mspaeth","html_url":"https://github.com/mspaeth","followers_url":"https://api.github.com/users/mspaeth/followers","following_url":"https://api.github.com/users/mspaeth/following{/other_user}","gists_url":"https://api.github.com/users/mspaeth/gists{/gist_id}","starred_url":"https://api.github.com/users/mspaeth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mspaeth/subscriptions","organizations_url":"https://api.github.com/users/mspaeth/orgs","repos_url":"https://api.github.com/users/mspaeth/repos","events_url":"https://api.github.com/users/mspaeth/events{/privacy}","received_events_url":"https://api.github.com/users/mspaeth/received_events","type":"User","site_admin":false},"body":"Yes but i wrote as default value of the parameter NULL in the baseclass, so NULL is delivered. This is because (i said it already above) for example a console output plugin wouldn't need the config.","created_at":"2016-02-15T16:59:14Z","updated_at":"2016-02-15T16:59:14Z","html_url":"https://github.com/mspaeth/GameOfLife/pull/7#discussion_r52922260","pull_request_url":"https://api.github.com/repos/mspaeth/GameOfLife/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/mspaeth/GameOfLife/pulls/comments/52922260"},"html":{"href":"https://github.com/mspaeth/GameOfLife/pull/7#discussion_r52922260"},"pull_request":{"href":"https://api.github.com/repos/mspaeth/GameOfLife/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/mspaeth/GameOfLife/pulls/7","id":59383343,"html_url":"https://github.com/mspaeth/GameOfLife/pull/7","diff_url":"https://github.com/mspaeth/GameOfLife/pull/7.diff","patch_url":"https://github.com/mspaeth/GameOfLife/pull/7.patch","issue_url":"https://api.github.com/repos/mspaeth/GameOfLife/issues/7","number":7,"state":"open","locked":false,"title":"Merge feature/create-input-from-txt-as-plugin","user":{"login":"mspaeth","id":8329841,"avatar_url":"https://avatars.githubusercontent.com/u/8329841?v=3","gravatar_id":"","url":"https://api.github.com/users/mspaeth","html_url":"https://github.com/mspaeth","followers_url":"https://api.github.com/users/mspaeth/followers","following_url":"https://api.github.com/users/mspaeth/following{/other_user}","gists_url":"https://api.github.com/users/mspaeth/gists{/gist_id}","starred_url":"https://api.github.com/users/mspaeth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mspaeth/subscriptions","organizations_url":"https://api.github.com/users/mspaeth/orgs","repos_url":"https://api.github.com/users/mspaeth/repos","events_url":"https://api.github.com/users/mspaeth/events{/privacy}","received_events_url":"https://api.github.com/users/mspaeth/received_events","type":"User","site_admin":false},"body":"You now have to specify an --input parameter for choosing the input mode.\r\nThe first plugin i implemented now is the txt plugin.\r\nTo use it, you also have to specify a path with --filepath which contains a txt file with the starting gamefield for example like this:\r\n\r\n![txtprev](https://cloud.githubusercontent.com/assets/8329841/13053690/17512786-d406-11e5-9790-32abe45b3440.JPG)\r\n\r\nThe \"0\" are dead cells and the \"1\" living cells.\r\n\r\nThe game is now called with the following parameters for example:\r\n\r\nphp rungame.php --input txt --filepath D:\\testfield.txt --output Console --numCycles 3\r\n\r\nThis will do the following:\r\n\r\n- Using txt mode as input.\r\n- Reading the file D:\\textfield.txt which contains the starting field.\r\n- Outputs it into the console.\r\n- Plays 3 rounds.\r\n\r\nFor more help run the game with --help parameter.\r\n\r\n**Tests done**\r\n- Create example txt file and print the output to console","created_at":"2016-02-15T16:09:27Z","updated_at":"2016-02-15T16:59:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a25b3a52d90ea0e1d5a6ecc7ef4a768c2ae91e4e","assignee":{"login":"mspaeth","id":8329841,"avatar_url":"https://avatars.githubusercontent.com/u/8329841?v=3","gravatar_id":"","url":"https://api.github.com/users/mspaeth","html_url":"https://github.com/mspaeth","followers_url":"https://api.github.com/users/mspaeth/followers","following_url":"https://api.github.com/users/mspaeth/following{/other_user}","gists_url":"https://api.github.com/users/mspaeth/gists{/gist_id}","starred_url":"https://api.github.com/users/mspaeth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mspaeth/subscriptions","organizations_url":"https://api.github.com/users/mspaeth/orgs","repos_url":"https://api.github.com/users/mspaeth/repos","events_url":"https://api.github.com/users/mspaeth/events{/privacy}","received_events_url":"https://api.github.com/users/mspaeth/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/mspaeth/GameOfLife/pulls/7/commits","review_comments_url":"https://api.github.com/repos/mspaeth/GameOfLife/pulls/7/comments","review_comment_url":"https://api.github.com/repos/mspaeth/GameOfLife/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mspaeth/GameOfLife/issues/7/comments","statuses_url":"https://api.github.com/repos/mspaeth/GameOfLife/statuses/52469c7973f3e9d6736468adf50b2cbd18870675","head":{"label":"mspaeth:feature/create-input-from-txt-as-plugin","ref":"feature/create-input-from-txt-as-plugin","sha":"52469c7973f3e9d6736468adf50b2cbd18870675","user":{"login":"mspaeth","id":8329841,"avatar_url":"https://avatars.githubusercontent.com/u/8329841?v=3","gravatar_id":"","url":"https://api.github.com/users/mspaeth","html_url":"https://github.com/mspaeth","followers_url":"https://api.github.com/users/mspaeth/followers","following_url":"https://api.github.com/users/mspaeth/following{/other_user}","gists_url":"https://api.github.com/users/mspaeth/gists{/gist_id}","starred_url":"https://api.github.com/users/mspaeth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mspaeth/subscriptions","organizations_url":"https://api.github.com/users/mspaeth/orgs","repos_url":"https://api.github.com/users/mspaeth/repos","events_url":"https://api.github.com/users/mspaeth/events{/privacy}","received_events_url":"https://api.github.com/users/mspaeth/received_events","type":"User","site_admin":false},"repo":{"id":49637123,"name":"GameOfLife","full_name":"mspaeth/GameOfLife","owner":{"login":"mspaeth","id":8329841,"avatar_url":"https://avatars.githubusercontent.com/u/8329841?v=3","gravatar_id":"","url":"https://api.github.com/users/mspaeth","html_url":"https://github.com/mspaeth","followers_url":"https://api.github.com/users/mspaeth/followers","following_url":"https://api.github.com/users/mspaeth/following{/other_user}","gists_url":"https://api.github.com/users/mspaeth/gists{/gist_id}","starred_url":"https://api.github.com/users/mspaeth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mspaeth/subscriptions","organizations_url":"https://api.github.com/users/mspaeth/orgs","repos_url":"https://api.github.com/users/mspaeth/repos","events_url":"https://api.github.com/users/mspaeth/events{/privacy}","received_events_url":"https://api.github.com/users/mspaeth/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mspaeth/GameOfLife","description":"","fork":false,"url":"https://api.github.com/repos/mspaeth/GameOfLife","forks_url":"https://api.github.com/repos/mspaeth/GameOfLife/forks","keys_url":"https://api.github.com/repos/mspaeth/GameOfLife/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mspaeth/GameOfLife/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mspaeth/GameOfLife/teams","hooks_url":"https://api.github.com/repos/mspaeth/GameOfLife/hooks","issue_events_url":"https://api.github.com/repos/mspaeth/GameOfLife/issues/events{/number}","events_url":"https://api.github.com/repos/mspaeth/GameOfLife/events","assignees_url":"https://api.github.com/repos/mspaeth/GameOfLife/assignees{/user}","branches_url":"https://api.github.com/repos/mspaeth/GameOfLife/branches{/branch}","tags_url":"https://api.github.com/repos/mspaeth/GameOfLife/tags","blobs_url":"https://api.github.com/repos/mspaeth/GameOfLife/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mspaeth/GameOfLife/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mspaeth/GameOfLife/git/refs{/sha}","trees_url":"https://api.github.com/repos/mspaeth/GameOfLife/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mspaeth/GameOfLife/statuses/{sha}","languages_url":"https://api.github.com/repos/mspaeth/GameOfLife/languages","stargazers_url":"https://api.github.com/repos/mspaeth/GameOfLife/stargazers","contributors_url":"https://api.github.com/repos/mspaeth/GameOfLife/contributors","subscribers_url":"https://api.github.com/repos/mspaeth/GameOfLife/subscribers","subscription_url":"https://api.github.com/repos/mspaeth/GameOfLife/subscription","commits_url":"https://api.github.com/repos/mspaeth/GameOfLife/commits{/sha}","git_commits_url":"https://api.github.com/repos/mspaeth/GameOfLife/git/commits{/sha}","comments_url":"https://api.github.com/repos/mspaeth/GameOfLife/comments{/number}","issue_comment_url":"https://api.github.com/repos/mspaeth/GameOfLife/issues/comments{/number}","contents_url":"https://api.github.com/repos/mspaeth/GameOfLife/contents/{+path}","compare_url":"https://api.github.com/repos/mspaeth/GameOfLife/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mspaeth/GameOfLife/merges","archive_url":"https://api.github.com/repos/mspaeth/GameOfLife/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mspaeth/GameOfLife/downloads","issues_url":"https://api.github.com/repos/mspaeth/GameOfLife/issues{/number}","pulls_url":"https://api.github.com/repos/mspaeth/GameOfLife/pulls{/number}","milestones_url":"https://api.github.com/repos/mspaeth/GameOfLife/milestones{/number}","notifications_url":"https://api.github.com/repos/mspaeth/GameOfLife/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mspaeth/GameOfLife/labels{/name}","releases_url":"https://api.github.com/repos/mspaeth/GameOfLife/releases{/id}","deployments_url":"https://api.github.com/repos/mspaeth/GameOfLife/deployments","created_at":"2016-01-14T09:29:11Z","updated_at":"2016-01-18T15:46:33Z","pushed_at":"2016-02-15T16:09:28Z","git_url":"git://github.com/mspaeth/GameOfLife.git","ssh_url":"git@github.com:mspaeth/GameOfLife.git","clone_url":"https://github.com/mspaeth/GameOfLife.git","svn_url":"https://github.com/mspaeth/GameOfLife","homepage":null,"size":499,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"mspaeth:master","ref":"master","sha":"16f3c02b1b62dfcb4e217054ff0c461616996222","user":{"login":"mspaeth","id":8329841,"avatar_url":"https://avatars.githubusercontent.com/u/8329841?v=3","gravatar_id":"","url":"https://api.github.com/users/mspaeth","html_url":"https://github.com/mspaeth","followers_url":"https://api.github.com/users/mspaeth/followers","following_url":"https://api.github.com/users/mspaeth/following{/other_user}","gists_url":"https://api.github.com/users/mspaeth/gists{/gist_id}","starred_url":"https://api.github.com/users/mspaeth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mspaeth/subscriptions","organizations_url":"https://api.github.com/users/mspaeth/orgs","repos_url":"https://api.github.com/users/mspaeth/repos","events_url":"https://api.github.com/users/mspaeth/events{/privacy}","received_events_url":"https://api.github.com/users/mspaeth/received_events","type":"User","site_admin":false},"repo":{"id":49637123,"name":"GameOfLife","full_name":"mspaeth/GameOfLife","owner":{"login":"mspaeth","id":8329841,"avatar_url":"https://avatars.githubusercontent.com/u/8329841?v=3","gravatar_id":"","url":"https://api.github.com/users/mspaeth","html_url":"https://github.com/mspaeth","followers_url":"https://api.github.com/users/mspaeth/followers","following_url":"https://api.github.com/users/mspaeth/following{/other_user}","gists_url":"https://api.github.com/users/mspaeth/gists{/gist_id}","starred_url":"https://api.github.com/users/mspaeth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mspaeth/subscriptions","organizations_url":"https://api.github.com/users/mspaeth/orgs","repos_url":"https://api.github.com/users/mspaeth/repos","events_url":"https://api.github.com/users/mspaeth/events{/privacy}","received_events_url":"https://api.github.com/users/mspaeth/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mspaeth/GameOfLife","description":"","fork":false,"url":"https://api.github.com/repos/mspaeth/GameOfLife","forks_url":"https://api.github.com/repos/mspaeth/GameOfLife/forks","keys_url":"https://api.github.com/repos/mspaeth/GameOfLife/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mspaeth/GameOfLife/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mspaeth/GameOfLife/teams","hooks_url":"https://api.github.com/repos/mspaeth/GameOfLife/hooks","issue_events_url":"https://api.github.com/repos/mspaeth/GameOfLife/issues/events{/number}","events_url":"https://api.github.com/repos/mspaeth/GameOfLife/events","assignees_url":"https://api.github.com/repos/mspaeth/GameOfLife/assignees{/user}","branches_url":"https://api.github.com/repos/mspaeth/GameOfLife/branches{/branch}","tags_url":"https://api.github.com/repos/mspaeth/GameOfLife/tags","blobs_url":"https://api.github.com/repos/mspaeth/GameOfLife/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mspaeth/GameOfLife/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mspaeth/GameOfLife/git/refs{/sha}","trees_url":"https://api.github.com/repos/mspaeth/GameOfLife/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mspaeth/GameOfLife/statuses/{sha}","languages_url":"https://api.github.com/repos/mspaeth/GameOfLife/languages","stargazers_url":"https://api.github.com/repos/mspaeth/GameOfLife/stargazers","contributors_url":"https://api.github.com/repos/mspaeth/GameOfLife/contributors","subscribers_url":"https://api.github.com/repos/mspaeth/GameOfLife/subscribers","subscription_url":"https://api.github.com/repos/mspaeth/GameOfLife/subscription","commits_url":"https://api.github.com/repos/mspaeth/GameOfLife/commits{/sha}","git_commits_url":"https://api.github.com/repos/mspaeth/GameOfLife/git/commits{/sha}","comments_url":"https://api.github.com/repos/mspaeth/GameOfLife/comments{/number}","issue_comment_url":"https://api.github.com/repos/mspaeth/GameOfLife/issues/comments{/number}","contents_url":"https://api.github.com/repos/mspaeth/GameOfLife/contents/{+path}","compare_url":"https://api.github.com/repos/mspaeth/GameOfLife/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mspaeth/GameOfLife/merges","archive_url":"https://api.github.com/repos/mspaeth/GameOfLife/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mspaeth/GameOfLife/downloads","issues_url":"https://api.github.com/repos/mspaeth/GameOfLife/issues{/number}","pulls_url":"https://api.github.com/repos/mspaeth/GameOfLife/pulls{/number}","milestones_url":"https://api.github.com/repos/mspaeth/GameOfLife/milestones{/number}","notifications_url":"https://api.github.com/repos/mspaeth/GameOfLife/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mspaeth/GameOfLife/labels{/name}","releases_url":"https://api.github.com/repos/mspaeth/GameOfLife/releases{/id}","deployments_url":"https://api.github.com/repos/mspaeth/GameOfLife/deployments","created_at":"2016-01-14T09:29:11Z","updated_at":"2016-01-18T15:46:33Z","pushed_at":"2016-02-15T16:09:28Z","git_url":"git://github.com/mspaeth/GameOfLife.git","ssh_url":"git@github.com:mspaeth/GameOfLife.git","clone_url":"https://github.com/mspaeth/GameOfLife.git","svn_url":"https://github.com/mspaeth/GameOfLife","homepage":null,"size":499,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mspaeth/GameOfLife/pulls/7"},"html":{"href":"https://github.com/mspaeth/GameOfLife/pull/7"},"issue":{"href":"https://api.github.com/repos/mspaeth/GameOfLife/issues/7"},"comments":{"href":"https://api.github.com/repos/mspaeth/GameOfLife/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/mspaeth/GameOfLife/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/mspaeth/GameOfLife/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mspaeth/GameOfLife/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/mspaeth/GameOfLife/statuses/52469c7973f3e9d6736468adf50b2cbd18870675"}}}}