{"action":"created","issue":{"url":"https://api.github.com/repos/rynatk/assignments/issues/4","labels_url":"https://api.github.com/repos/rynatk/assignments/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/rynatk/assignments/issues/4/comments","events_url":"https://api.github.com/repos/rynatk/assignments/issues/4/events","html_url":"https://github.com/rynatk/assignments/issues/4","id":107052048,"number":4,"title":"Assignment 4-4 - Multi-player Tic-Tac-Toe","user":{"login":"ambethia","id":298,"avatar_url":"https://avatars.githubusercontent.com/u/298?v=3","gravatar_id":"","url":"https://api.github.com/users/ambethia","html_url":"https://github.com/ambethia","followers_url":"https://api.github.com/users/ambethia/followers","following_url":"https://api.github.com/users/ambethia/following{/other_user}","gists_url":"https://api.github.com/users/ambethia/gists{/gist_id}","starred_url":"https://api.github.com/users/ambethia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambethia/subscriptions","organizations_url":"https://api.github.com/users/ambethia/orgs","repos_url":"https://api.github.com/users/ambethia/repos","events_url":"https://api.github.com/users/ambethia/events{/privacy}","received_events_url":"https://api.github.com/users/ambethia/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"rynatk","id":13787517,"avatar_url":"https://avatars.githubusercontent.com/u/13787517?v=3","gravatar_id":"","url":"https://api.github.com/users/rynatk","html_url":"https://github.com/rynatk","followers_url":"https://api.github.com/users/rynatk/followers","following_url":"https://api.github.com/users/rynatk/following{/other_user}","gists_url":"https://api.github.com/users/rynatk/gists{/gist_id}","starred_url":"https://api.github.com/users/rynatk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rynatk/subscriptions","organizations_url":"https://api.github.com/users/rynatk/orgs","repos_url":"https://api.github.com/users/rynatk/repos","events_url":"https://api.github.com/users/rynatk/events{/privacy}","received_events_url":"https://api.github.com/users/rynatk/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-09-17T19:06:09Z","updated_at":"2015-09-25T23:34:48Z","closed_at":"2015-09-24T18:37:10Z","body":"# Multi-player Tic-Tac-Toe\n\n## Description\n\nYour task is to work with your team (comprised of both the frontend and backend students) to build a tic-tac-toe game that lets players play over the network from two different browsers.\n\n### Explorer Mode\n\nThe front end should prompt the user for their name and either assign them X or O, or let the player choose. This is up to you.\n\nThe backend doesn't need to manage multiple games at once (so yes, if more than two people try connecting to it, it will probably get confusing).\n\nUse all the tools you've learned up to now!\n\n### Adventure Mode\n\nGames have a unique ID, the backend can track multiple games. You will have to modify the API to include the game's unique identifier so that it can figure out which game to operate on.\n\nThis could be tricksy!\n\n## Deliverables\n\n- [ ] Backend: A link to a single repository with commits from all backend team members\n\n- [ ] Frontend: A link to a single repository with commits from all frontend team members\n\n\n## API\n\nThis is a suggested API, you may find that something else works better for you. It may also not be entirely complete, you will likely need to add additional methods to complete the game.\n\n### `POST /game`\n\n#### Behavior\n\nCreates a new game with a blank board.\n\n#### Request:\n\n```json\n{\n  \"player_X_name\": \"String containing the name of player X\",\n  \"player_O_name\": \"String containing the name of player O\"\n}\n```\n\n#### Response:\n\nStatus code: `201`\n\nBody:\n\n```json\n{\n \"status\": \"ok\",\n \"board\": { \"state\": \"playing\",\n            \"positions\": { \"0\": \" \",\n                           \"1\": \" \",\n                           \"2\": \" \",\n                           \"3\": \" \",\n                           \"4\": \" \",\n                           \"5\": \" \",\n                           \"6\": \" \",\n                           \"7\": \" \",\n                           \"8\": \" \"\n                         }     \n         }\n}\n```\n\n### `POST /move`\n\n#### Behavior\n\nMakes a move for a specific player\n\n#### Request:\n\n##### Examples\n\n> X player moves to position 0  \n\nRequest:\n\n```json\n{\n  \"player\": \"X\",\n  \"position\": \"0\"\n}\n```\n\nResponse:\n\n```json\n{\n \"status\": \"ok\",\n \"board\": { \"state\": \"playing\",\n            \"positions\": { \"0\": \"X\",\n                           \"1\": \" \",\n                           \"2\": \" \",\n                           \"3\": \" \",\n                           \"4\": \" \",\n                           \"5\": \" \",\n                           \"6\": \" \",\n                           \"7\": \" \",\n                           \"8\": \" \"\n                         }     \n         }\n}\n```\n\n> O player moves to position 4\n\nRequest:\n\n```json\n {\n   \"player\": \"O\",\n   \"position\": \"4\"\n }\n```\n\n   Response:\n```json\n {\n   \"status\": \"ok\",\n   \"board\": { \"state\": \"playing\",\n              \"positions\": { \"0\": \"X\",\n                             \"1\": \" \",\n                             \"2\": \" \",\n                             \"3\": \" \",\n                             \"4\": \"O\",\n                             \"5\": \" \",\n                             \"6\": \" \",\n                             \"7\": \" \",\n                             \"8\": \" \"\n                           }     \n           }\n }\n```\n\n> X player moves to position 3\n\nRequest:\n\n```json\n{\n  \"player\": \"X\",\n  \"position\": \"3\"\n}\n```\n\nResponse:\n\n```json\n   {\n     \"status\": \"ok\",\n     \"board\": { \"state\": \"playing\",\n                \"positions\": { \"0\": \"X\",\n                               \"1\": \" \",\n                               \"2\": \" \",\n                               \"3\": \"X\",\n                               \"4\": \"O\",\n                               \"5\": \" \",\n                               \"6\": \" \",\n                               \"7\": \" \",\n                               \"8\": \" \"\n                             }     \n             }\n   }\n```\n\n- NOTE: The value for `player` is either an `\"X\"` or an `\"O\"`.\n- NOTE: The value for \"position\" is a `\"0\"`, `\"1\"`, `\"2\"` , `\"3\"`, `\"4\"`, `\"5\"`, `\"6\"`, `\"7\"`, or `\"8\"`\n\n#### Response:\n\n##### If the move is valid (the space is currently _unoccupied_)\n\nStatus code: `200`\n\n Body:\n\n```json\n {\n   \"status\": \"ok\",\n   \"board\": { \"state\": \"playing\",\n              \"positions\": { \"0\": \" \",\n                             \"1\": \" \",\n                             \"2\": \" \",\n                             \"3\": \" \",\n                             \"4\": \" \",\n                             \"5\": \" \",\n                             \"6\": \" \",\n                             \"7\": \" \",\n                             \"8\": \" \"\n                           }     \n           }\n }\n```\n\n- NOTE: The board should be updated with an `X` or an `O` depending on which player made the move.\n- NOTE: The `state` should be updated with one of these values:\n  - `playing` - the game is ongoing\n  - `tie` - the game is a tie\n  - `player X wins` - player X has won\n  - `player Y wins` - player Y has won\n\n##### If the move is invalid (the space is currently _occupied_)\n\nStatus code: `409`\n\n```json\n {\n   \"status\": \"invalid\",\n   \"reason\": \"Already an (X or O) at this space\",\n   \"board\": { \"state\": \"playing\",\n              \"positions\": { \"0\": \" \",\n                             \"1\": \" \",\n                             \"2\": \" \",\n                             \"3\": \" \",\n                             \"4\": \" \",\n                             \"5\": \" \",\n                             \"6\": \" \",\n                             \"7\": \" \",\n                             \"8\": \" \"\n                           }     \n           }\n }\n```\n\n- NOTE: The `reason` should say either \"Already an X at this space\" or \"Already an O at this space\"\n- NOTE: The board should be the previous board state _without_ the requested move\n\n# Resources\nTest your API responses locally: (if running `Sinatra`)\n\nbrew install httpie\n\n`http http://localhost:4567/game player_X_name=Gavin player_O_name=Jason --form`\n"},"comment":{"url":"https://api.github.com/repos/rynatk/assignments/issues/comments/143375857","html_url":"https://github.com/rynatk/assignments/issues/4#issuecomment-143375857","issue_url":"https://api.github.com/repos/rynatk/assignments/issues/4","id":143375857,"user":{"login":"ambethia","id":298,"avatar_url":"https://avatars.githubusercontent.com/u/298?v=3","gravatar_id":"","url":"https://api.github.com/users/ambethia","html_url":"https://github.com/ambethia","followers_url":"https://api.github.com/users/ambethia/followers","following_url":"https://api.github.com/users/ambethia/following{/other_user}","gists_url":"https://api.github.com/users/ambethia/gists{/gist_id}","starred_url":"https://api.github.com/users/ambethia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambethia/subscriptions","organizations_url":"https://api.github.com/users/ambethia/orgs","repos_url":"https://api.github.com/users/ambethia/repos","events_url":"https://api.github.com/users/ambethia/events{/privacy}","received_events_url":"https://api.github.com/users/ambethia/received_events","type":"User","site_admin":false},"created_at":"2015-09-25T23:34:48Z","updated_at":"2015-09-25T23:34:48Z","body":"![Awesome Work!](http://media.giphy.com/media/o7H9mn7R9SIIE/200w_d.gif)"}}