{"action":"created","issue":{"url":"https://api.github.com/repos/Taeir/ContextProject-MIGI2/issues/402","repository_url":"https://api.github.com/repos/Taeir/ContextProject-MIGI2","labels_url":"https://api.github.com/repos/Taeir/ContextProject-MIGI2/issues/402/labels{/name}","comments_url":"https://api.github.com/repos/Taeir/ContextProject-MIGI2/issues/402/comments","events_url":"https://api.github.com/repos/Taeir/ContextProject-MIGI2/issues/402/events","html_url":"https://github.com/Taeir/ContextProject-MIGI2/pull/402","id":159049276,"number":402,"title":"Feature maze generation update fixed","user":{"login":"Diocruel","id":9715288,"avatar_url":"https://avatars.githubusercontent.com/u/9715288?v=3","gravatar_id":"","url":"https://api.github.com/users/Diocruel","html_url":"https://github.com/Diocruel","followers_url":"https://api.github.com/users/Diocruel/followers","following_url":"https://api.github.com/users/Diocruel/following{/other_user}","gists_url":"https://api.github.com/users/Diocruel/gists{/gist_id}","starred_url":"https://api.github.com/users/Diocruel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Diocruel/subscriptions","organizations_url":"https://api.github.com/users/Diocruel/orgs","repos_url":"https://api.github.com/users/Diocruel/repos","events_url":"https://api.github.com/users/Diocruel/events{/privacy}","received_events_url":"https://api.github.com/users/Diocruel/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Taeir/ContextProject-MIGI2/labels/review","name":"review","color":"00FF99"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-07T23:43:39Z","updated_at":"2016-06-08T14:33:40Z","closed_at":"2016-06-08T14:33:40Z","pull_request":{"url":"https://api.github.com/repos/Taeir/ContextProject-MIGI2/pulls/402","html_url":"https://github.com/Taeir/ContextProject-MIGI2/pull/402","diff_url":"https://github.com/Taeir/ContextProject-MIGI2/pull/402.diff","patch_url":"https://github.com/Taeir/ContextProject-MIGI2/pull/402.patch"},"body":"And here it is, just a small algorithm to generate maps. It seems that I lost about 94 commits during the “fix” of author, so please, DON’T delete the Maze-generation-update branch, as it contains the commits not counted in this PR!\r\n\r\nFirstly, maps are now saved in a different format. In this format each map is a folder with a .cmf file specifying what rooms to load. The folder also contains a map within for each room that can be loaded. The .crf files themselves now have a different layout as well, see the below list for the new notation of the tiles.\r\n* Corridor character for .crf files  = \"C\"\r\n* Floor character for .crf files  = \"O\"\r\n* Wall character for .crf files  = \"#\"\r\n* Door:Entrance character for .crf files  = \"I\"\r\n* Door:Exit character for .crf files = \"X\"\r\n* Empty tile character for .crf files = \"-\"\r\n\r\nSecondly, a lot of extra data structures have been created. These data structures all contain javadoc entailing their purpose, so their purpose won't be explained thoroughly here. The main idea is to transfer the information saved in the .cmf and .crf files in collections of objects, so that the algorithms can easily deal with the data. Remember Datastructures and Algorithms from the first year? Well each algorithm has data structures it can easily deal with, so transforming the .crf files into data structures that are fast and handy greatly improves the algorithm speed.\r\n\r\nThirdly, the algorithm itself is created. There is no real existing algorithm that is widespread and does exactly what we want to do with the maze creation: use predefined rooms with entrances and exits that creates a random cave, in which each exit is connected to an entrance.\r\n\r\nThe algorithm works in six steps:\r\n\r\n1. Place start and treasure room randomly in space, though ensure some distance between them.\r\n2. For a number of attempts place random other rooms till desired density has been found, keep track of every room's it's connections and the type of connection (in/out)\r\n3. Create a connection (edge) from every in-connection to every out-connection that is not in the same room. \r\n4. Use the Reverse Delete algorithm to create a Minimum Spanning Tree of this connected graph, but enforce extra connectifity such that every exit is connected to an entrance.\r\n5. For each remaining edge use breadth first search to construct actual corridor in the maze.\r\n6. Place corridors walls so the maze is closed of.\r\n\r\nIt seems that this algorithm works cleanly and fast for mazes til about 20 to 30 rooms, after this, the algorithm starts taking a lot of time to complete, since it has to do a ton of comparisons to keep the maze structured. Though mazes of 200 to 300 rooms look stunning and can still be generated in about 1 minute of serious computing time on my laptop.\r\n\r\nAnd finally, \r\nAll PMD, Findbug and CheckStyle warnings have been dealt with or explained. \r\nThe test coverage is wel over 80% in all added classes, except for the RandomUtil class, since it only contains two lines, with one being a private constructor....\r\n\r\nSee for the entire coverage:\r\n[Coverage of all packages.](https://gyazo.com/7570e37f64458fcc621f1308976c08fd)\r\nThe coverage in the level package:\r\n[Coverage of entire level package.](https://gyazo.com/0717614c72704a40e153c5efe3ab9a7a)\r\nThe coverage in the level.RoomIO package:\r\n[Coverage of entire level.RoomIO package.](https://gyazo.com/2e07e3e9c5d689b76e86f0851495da79)\r\nThe coverage in the level.util package:\r\n[Coverage of entire level.util package.](https://gyazo.com/3fead70676669cad2b35373d8d8a3c49)\r\n\r\nI know it is a lot of lines, so I should have done this in separate pull request perhaps, but it was difficult to envision the entire algorithm before hand, so many changes have been made to it during its creation, which would have cost extra review time on code which was removed later.\r\n\r\nPlease ask any questions you have about the algorithm or the classes. Make sure you understand the algorithm while reviewing the code!\r\n\r\nThanks!\r\n\r\nAlmost forgot this Pull Request closes #151, closes #152, closes #153, closes #202, closes #293, closes #293, closes #294, closes #295, closes #296, closes #297, closes #298, closes #299 and closes #395 ."},"comment":{"url":"https://api.github.com/repos/Taeir/ContextProject-MIGI2/issues/comments/224608588","html_url":"https://github.com/Taeir/ContextProject-MIGI2/pull/402#issuecomment-224608588","issue_url":"https://api.github.com/repos/Taeir/ContextProject-MIGI2/issues/402","id":224608588,"user":{"login":"Diocruel","id":9715288,"avatar_url":"https://avatars.githubusercontent.com/u/9715288?v=3","gravatar_id":"","url":"https://api.github.com/users/Diocruel","html_url":"https://github.com/Diocruel","followers_url":"https://api.github.com/users/Diocruel/followers","following_url":"https://api.github.com/users/Diocruel/following{/other_user}","gists_url":"https://api.github.com/users/Diocruel/gists{/gist_id}","starred_url":"https://api.github.com/users/Diocruel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Diocruel/subscriptions","organizations_url":"https://api.github.com/users/Diocruel/orgs","repos_url":"https://api.github.com/users/Diocruel/repos","events_url":"https://api.github.com/users/Diocruel/events{/privacy}","received_events_url":"https://api.github.com/users/Diocruel/received_events","type":"User","site_admin":false},"created_at":"2016-06-08T14:33:40Z","updated_at":"2016-06-08T14:33:40Z","body":"Since I accidentally based this PR on master this PR should be closed. There will however be a reference to this PR as all the comments have been addressed."}}
{"actor":{"display_login":"Diocruel"}}