{"action":"created","issue":{"url":"https://api.github.com/repos/CSIS221Longview/AdamBattle/issues/2","repository_url":"https://api.github.com/repos/CSIS221Longview/AdamBattle","labels_url":"https://api.github.com/repos/CSIS221Longview/AdamBattle/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/CSIS221Longview/AdamBattle/issues/2/comments","events_url":"https://api.github.com/repos/CSIS221Longview/AdamBattle/issues/2/events","html_url":"https://github.com/CSIS221Longview/AdamBattle/issues/2","id":191741302,"number":2,"title":"Placing ships","user":{"login":"ABoehm4","id":22873607,"avatar_url":"https://avatars.githubusercontent.com/u/22873607?v=3","gravatar_id":"","url":"https://api.github.com/users/ABoehm4","html_url":"https://github.com/ABoehm4","followers_url":"https://api.github.com/users/ABoehm4/followers","following_url":"https://api.github.com/users/ABoehm4/following{/other_user}","gists_url":"https://api.github.com/users/ABoehm4/gists{/gist_id}","starred_url":"https://api.github.com/users/ABoehm4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ABoehm4/subscriptions","organizations_url":"https://api.github.com/users/ABoehm4/orgs","repos_url":"https://api.github.com/users/ABoehm4/repos","events_url":"https://api.github.com/users/ABoehm4/events{/privacy}","received_events_url":"https://api.github.com/users/ABoehm4/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-11-25T17:00:36Z","updated_at":"2016-11-28T19:06:55Z","closed_at":null,"body":"```\r\npublic void setShips() {\r\n\tfor (int ship = 0; ship < ships.length; ship++) {\r\n\t\tRandom rand = new Random();\r\n\t\tint direction = rand.nextInt(2)+1;\r\n\t\tint coordX;\r\n\t\tint coordY;\r\n\t\tcoordX = rand.nextInt(this.BOARD_SIZE);\r\n\t\tcoordY= rand.nextInt(this.BOARD_SIZE);\r\n\t\tint shiplength = ships[ship];\r\n\t\t\r\n\t\t\r\n\t\r\n\t\tif (board[coordX][coordY] != -1)\r\n\t\t\tcontinue;\r\n\t\t\r\n\t\t\t// Horizontal placement if direction = 1\r\n\t\tif (direction == 1) {\r\n\t\t\tif (shiplength + coordX > this.BOARD_SIZE)\r\n\t\t\t\tcontinue;\r\n\t\t\tfor (int i = 0; i < shiplength; i++) {\r\n\t\t\t\tboard[coordX + i][coordY] = -3;\r\n\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t// Vertical placement if direction = 2\r\n\t\telse if (direction == 2) {\r\n\t\t\tif (shiplength + coordY > this.BOARD_SIZE)\r\n\t\t\t\tcontinue;\r\n\t\t\tfor (int i = 0; i < shiplength; i++) {\r\n\t\t\t\tboard[coordX][coordY + i] = -3;\r\n\t\t\t\t\r\n\t\t\t\t}\t\r\n\t\t\t}\r\n\t\t\r\n\t}\r\n}\r\n```\r\n\r\nSo far that's my code for placing ships. It's not pretty, and it doesn't seem to work for playing the smaller board. This is early coding, so 'S' just means a ship is there, I haven't gotten to the point of specifying the character on a per ship basis. My problem now is getting them to not overlap.\r\n```\r\n    1  2  3  4  5  6  7  8  9 10 11 12\r\n  A ~| ~| S| S| S| S| S| ~| ~| ~| ~| ~|\r\n  B ~| ~| S| ~| ~| ~| ~| ~| S| S| S| ~|\r\n  C ~| ~| S| ~| ~| ~| ~| ~| ~| ~| ~| ~|\r\n  D ~| ~| S| S| S| S| S| ~| ~| ~| ~| ~|\r\n  E ~| ~| ~| ~| S| ~| ~| ~| ~| ~| ~| ~|\r\n  F ~| ~| ~| ~| S| ~| ~| ~| ~| ~| ~| ~|\r\n  G ~| ~| ~| ~| ~| ~| ~| ~| ~| ~| ~| ~|\r\n  H ~| ~| ~| ~| ~| ~| ~| ~| ~| ~| ~| ~|\r\n  I ~| ~| ~| ~| ~| ~| ~| ~| ~| ~| ~| ~|\r\n  J ~| ~| ~| ~| ~| ~| ~| ~| ~| ~| ~| ~|\r\n  K ~| ~| ~| ~| ~| ~| ~| ~| ~| ~| ~| ~|\r\n  L ~| ~| ~| ~| ~| ~| ~| ~| ~| ~| ~| ~|\r\n```"},"comment":{"url":"https://api.github.com/repos/CSIS221Longview/AdamBattle/issues/comments/263362700","html_url":"https://github.com/CSIS221Longview/AdamBattle/issues/2#issuecomment-263362700","issue_url":"https://api.github.com/repos/CSIS221Longview/AdamBattle/issues/2","id":263362700,"user":{"login":"ABoehm4","id":22873607,"avatar_url":"https://avatars.githubusercontent.com/u/22873607?v=3","gravatar_id":"","url":"https://api.github.com/users/ABoehm4","html_url":"https://github.com/ABoehm4","followers_url":"https://api.github.com/users/ABoehm4/followers","following_url":"https://api.github.com/users/ABoehm4/following{/other_user}","gists_url":"https://api.github.com/users/ABoehm4/gists{/gist_id}","starred_url":"https://api.github.com/users/ABoehm4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ABoehm4/subscriptions","organizations_url":"https://api.github.com/users/ABoehm4/orgs","repos_url":"https://api.github.com/users/ABoehm4/repos","events_url":"https://api.github.com/users/ABoehm4/events{/privacy}","received_events_url":"https://api.github.com/users/ABoehm4/received_events","type":"User","site_admin":false},"created_at":"2016-11-28T19:06:55Z","updated_at":"2016-11-28T19:06:55Z","body":"```\r\n\tpublic void placeShips() {\r\n\t\tcreateShips();\r\n\t\tint size = getBoardSize();\t\r\n\t\tfor (int i = 0; i < ships.length; i++) {\r\n\t\t\tboolean placed = false;\r\n\t\twhile (!placed) {\r\n\t\t\tint direction = r.nextInt(2);\r\n\t\t\tint row = r.nextInt(size);\r\n\t\t\tint col = r.nextInt(size);\r\n\t\t\t\r\n\t\t\tif (board[row][col] != -1)\r\n\t\t\t\tcontinue;\r\n\t\t\t\r\n\t\t\t// HORIZONTAL\r\n\t\t\tif (direction == 0) {\r\n\t\t\t\t\tif (row + ships[i].size > size || row - ships[i].size < 0)\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\tfor (int j = 0; j < ships[i].size; j++) {\r\n\t\t\t\t\t\tboard[row + j][col] = -3;\r\n\t\t\t\t\t\tplaced = true;\r\n\t\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// VERTICAL\t\r\n\t\t\telse if (direction == 1) {\r\n\t\t\t\tif (col + ships[i].size > size || col - ships[i].size < 0)\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\tfor (int j = 0; j < ships[i].size; j++) {\r\n\t\t\t\t\tboard[row][col + j] = -3;\r\n\t\t\t\t\tplaced = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} \r\n\t\t\r\n\t\t} \r\n\r\n\t}\t\r\n```\r\n\r\nGot it to place all 5 ships on the larger board, but now the standard and beginner boards aren't even generating.\r\n\r\n```\r\n     1   2   3   4   5   6   7   8   9  10  11  12\r\n  A  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|\r\n  B  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|\r\n  C  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|\r\n  D  ~|  ~|  ~|  ~|  ~|  ~|  S|  S|  S|  S|  ~|  ~|\r\n  E  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|\r\n  F  ~|  ~|  ~|  ~|  ~|  ~|  S|  ~|  ~|  ~|  ~|  ~|\r\n  G  ~|  ~|  ~|  ~|  ~|  ~|  S|  ~|  ~|  ~|  ~|  ~|\r\n  H  ~|  ~|  ~|  ~|  ~|  ~|  S|  ~|  S|  ~|  ~|  S|\r\n  I  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  S|  ~|  S|  S|\r\n  J  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  S|  ~|  S|  S|\r\n  K  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  S|  ~|  ~|  S|\r\n  L  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  ~|  S|\r\n```"}}
{"actor":{"display_login":"ABoehm4"}}