{"action":"created","issue":{"url":"https://api.github.com/repos/ondras/rot.js/issues/121","repository_url":"https://api.github.com/repos/ondras/rot.js","labels_url":"https://api.github.com/repos/ondras/rot.js/issues/121/labels{/name}","comments_url":"https://api.github.com/repos/ondras/rot.js/issues/121/comments","events_url":"https://api.github.com/repos/ondras/rot.js/issues/121/events","html_url":"https://github.com/ondras/rot.js/issues/121","id":246270454,"number":121,"title":"Possible indeterminism in Digger._findWall","user":{"login":"airstruck","id":12876237,"avatar_url":"https://avatars3.githubusercontent.com/u/12876237?v=4","gravatar_id":"","url":"https://api.github.com/users/airstruck","html_url":"https://github.com/airstruck","followers_url":"https://api.github.com/users/airstruck/followers","following_url":"https://api.github.com/users/airstruck/following{/other_user}","gists_url":"https://api.github.com/users/airstruck/gists{/gist_id}","starred_url":"https://api.github.com/users/airstruck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airstruck/subscriptions","organizations_url":"https://api.github.com/users/airstruck/orgs","repos_url":"https://api.github.com/users/airstruck/repos","events_url":"https://api.github.com/users/airstruck/events{/privacy}","received_events_url":"https://api.github.com/users/airstruck/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-07-28T07:39:15Z","updated_at":"2017-08-02T10:46:31Z","closed_at":null,"body":"Found this bug in a Lua port of rot.js (bug report [here](https://github.com/paulofmandown/rotLove/issues/46)) and noticed it probably also affects rot.js.\r\n\r\nIn Digger's _findWall, `for..in` is used to build up an array, and then a random element is selected from that array. The problem is that iteration order of `for..in` isn't predictable (according to ES5 section [12.6.4](https://es5.github.io/#x12.6.4), the \"mechanics and order of enumerating the properties is not specified\").\r\n\r\nNot sure how much this actually affects rot.js. In the Lua port, it caused Digger to produce different maps given the same seed over a single run of the program. It was easy to spot in Lua.\r\n\r\nIn most implementations, the JS `for..in` construct seems more predictable than its Lua counterpart, so I suspect it will be more subtle in JS. Wouldn't expect it to generate the same map on two different UAs, even if it seems determinate on one UA, for example.\r\n\r\nAnyway, just a heads-up.\r\n\r\n<bountysource-plugin>\r\n\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/47691656-possible-indeterminism-in-digger-_findwall?utm_campaign=plugin&utm_content=tracker%2F297828&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F297828&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/ondras/rot.js/issues/comments/319637424","html_url":"https://github.com/ondras/rot.js/issues/121#issuecomment-319637424","issue_url":"https://api.github.com/repos/ondras/rot.js/issues/121","id":319637424,"user":{"login":"ondras","id":192172,"avatar_url":"https://avatars3.githubusercontent.com/u/192172?v=4","gravatar_id":"","url":"https://api.github.com/users/ondras","html_url":"https://github.com/ondras","followers_url":"https://api.github.com/users/ondras/followers","following_url":"https://api.github.com/users/ondras/following{/other_user}","gists_url":"https://api.github.com/users/ondras/gists{/gist_id}","starred_url":"https://api.github.com/users/ondras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ondras/subscriptions","organizations_url":"https://api.github.com/users/ondras/orgs","repos_url":"https://api.github.com/users/ondras/repos","events_url":"https://api.github.com/users/ondras/events{/privacy}","received_events_url":"https://api.github.com/users/ondras/received_events","type":"User","site_admin":false},"created_at":"2017-08-02T10:46:31Z","updated_at":"2017-08-02T10:46:31Z","body":"Fixed in https://github.com/ondras/rot.js/commit/6d9d163c1638d43483b50743700e35f7e9e627ae."}}
{"actor":{"display_login":"ondras"}}