{"action":"created","issue":{"url":"https://api.github.com/repos/clux/duel/issues/8","labels_url":"https://api.github.com/repos/clux/duel/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/clux/duel/issues/8/comments","events_url":"https://api.github.com/repos/clux/duel/issues/8/events","html_url":"https://github.com/clux/duel/issues/8","id":109633963,"number":8,"title":"how do I know what match is next?","user":{"login":"seiyria","id":763609,"avatar_url":"https://avatars.githubusercontent.com/u/763609?v=3","gravatar_id":"","url":"https://api.github.com/users/seiyria","html_url":"https://github.com/seiyria","followers_url":"https://api.github.com/users/seiyria/followers","following_url":"https://api.github.com/users/seiyria/following{/other_user}","gists_url":"https://api.github.com/users/seiyria/gists{/gist_id}","starred_url":"https://api.github.com/users/seiyria/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seiyria/subscriptions","organizations_url":"https://api.github.com/users/seiyria/orgs","repos_url":"https://api.github.com/users/seiyria/repos","events_url":"https://api.github.com/users/seiyria/events{/privacy}","received_events_url":"https://api.github.com/users/seiyria/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2015-10-03T17:09:52Z","updated_at":"2015-10-06T10:10:43Z","closed_at":"2015-10-03T21:31:30Z","body":"Suppose I have a 5 player single elimination tournament:\r\n\r\n![](http://puu.sh/kx8jB/c4c1a19e26.png)\r\n\r\n0 and 1 have to face off first to determine who can face 4. How do I know what the next match for 0 and 1 is? I want to draw a line between them.\r\n\r\nI've tried `duelInst.right(0)`, `duelInst.down(0)`, and `duelInst.upcoming(0)` (as well as for 1), but none of these seem to give me the `id` of the next match. Did I miss something?\r\n"},"comment":{"url":"https://api.github.com/repos/clux/duel/issues/comments/145811078","html_url":"https://github.com/clux/duel/issues/8#issuecomment-145811078","issue_url":"https://api.github.com/repos/clux/duel/issues/8","id":145811078,"user":{"login":"clux","id":134092,"avatar_url":"https://avatars.githubusercontent.com/u/134092?v=3","gravatar_id":"","url":"https://api.github.com/users/clux","html_url":"https://github.com/clux","followers_url":"https://api.github.com/users/clux/followers","following_url":"https://api.github.com/users/clux/following{/other_user}","gists_url":"https://api.github.com/users/clux/gists{/gist_id}","starred_url":"https://api.github.com/users/clux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clux/subscriptions","organizations_url":"https://api.github.com/users/clux/orgs","repos_url":"https://api.github.com/users/clux/repos","events_url":"https://api.github.com/users/clux/events{/privacy}","received_events_url":"https://api.github.com/users/clux/received_events","type":"User","site_admin":false},"created_at":"2015-10-06T10:10:43Z","updated_at":"2015-10-06T10:10:43Z","body":"Hm. You shouldn't get anything higher than round 8 in a 10 player. Both `down` and `right` are returning sensible things for me:\r\n\r\n```js\r\nvar Duel = require('duel');\r\nvar d = new Duel(10, {last: Duel.LB});\r\nconsole.log(d.matches);\r\nd.matches.forEach(function(m) {\r\n  var right = d.right(m.id) ? d.right(m.id)[0] : null;\r\n  var down = d.down(m.id) ? d.down(m.id)[0] : null;\r\n  console.log(m.id + ' has right: ' +  right + ' and dn: ' + down);\r\n});\r\n```\r\n\r\noutput:\r\n\r\n```\r\n[ { id: { s: 1, r: 1, m: 1 }, p: [ 1, -1 ], m: [ 1, 0 ] },\r\n  { id: { s: 1, r: 1, m: 2 }, p: [ 9, 8 ] },\r\n  { id: { s: 1, r: 1, m: 3 }, p: [ 5, -1 ], m: [ 1, 0 ] },\r\n  { id: { s: 1, r: 1, m: 4 }, p: [ -1, 4 ], m: [ 0, 1 ] },\r\n  { id: { s: 1, r: 1, m: 5 }, p: [ 3, -1 ], m: [ 1, 0 ] },\r\n  { id: { s: 1, r: 1, m: 6 }, p: [ -1, 6 ], m: [ 0, 1 ] },\r\n  { id: { s: 1, r: 1, m: 7 }, p: [ 7, 10 ] },\r\n  { id: { s: 1, r: 1, m: 8 }, p: [ -1, 2 ], m: [ 0, 1 ] },\r\n  { id: { s: 1, r: 2, m: 1 }, p: [ 1, 0 ] },\r\n  { id: { s: 1, r: 2, m: 2 }, p: [ 5, 4 ] },\r\n  { id: { s: 1, r: 2, m: 3 }, p: [ 3, 6 ] },\r\n  { id: { s: 1, r: 2, m: 4 }, p: [ 0, 2 ] },\r\n  { id: { s: 1, r: 3, m: 1 }, p: [ 0, 0 ] },\r\n  { id: { s: 1, r: 3, m: 2 }, p: [ 0, 0 ] },\r\n  { id: { s: 1, r: 4, m: 1 }, p: [ 0, 0 ] },\r\n  { id: { s: 2, r: 1, m: 1 }, p: [ -1, 0 ], m: [ 0, 1 ] },\r\n  { id: { s: 2, r: 1, m: 2 }, p: [ -1, -1 ], m: [ 0, 1 ] },\r\n  { id: { s: 2, r: 1, m: 3 }, p: [ -1, -1 ], m: [ 0, 1 ] },\r\n  { id: { s: 2, r: 1, m: 4 }, p: [ 0, -1 ], m: [ 1, 0 ] },\r\n  { id: { s: 2, r: 2, m: 1 }, p: [ 0, 0 ] },\r\n  { id: { s: 2, r: 2, m: 2 }, p: [ -1, 0 ] },\r\n  { id: { s: 2, r: 2, m: 3 }, p: [ 0, -1 ] },\r\n  { id: { s: 2, r: 2, m: 4 }, p: [ 0, 0 ] },\r\n  { id: { s: 2, r: 3, m: 1 }, p: [ 0, 0 ] },\r\n  { id: { s: 2, r: 3, m: 2 }, p: [ 0, 0 ] },\r\n  { id: { s: 2, r: 4, m: 1 }, p: [ 0, 0 ] },\r\n  { id: { s: 2, r: 4, m: 2 }, p: [ 0, 0 ] },\r\n  { id: { s: 2, r: 5, m: 1 }, p: [ 0, 0 ] },\r\n  { id: { s: 2, r: 6, m: 1 }, p: [ 0, 0 ] },\r\n  { id: { s: 2, r: 7, m: 1 }, p: [ 0, 0 ] },\r\n  { id: { s: 2, r: 8, m: 1 }, p: [ 0, 0 ] } ]\r\nWB R1 M1 has right: WB R2 M1 and dn: LB R1 M1\r\nWB R1 M2 has right: WB R2 M1 and dn: LB R1 M1\r\nWB R1 M3 has right: WB R2 M2 and dn: LB R1 M2\r\nWB R1 M4 has right: WB R2 M2 and dn: LB R1 M2\r\nWB R1 M5 has right: WB R2 M3 and dn: LB R1 M3\r\nWB R1 M6 has right: WB R2 M3 and dn: LB R1 M3\r\nWB R1 M7 has right: WB R2 M4 and dn: LB R1 M4\r\nWB R1 M8 has right: WB R2 M4 and dn: LB R1 M4\r\nWB R2 M1 has right: WB R3 M1 and dn: LB R2 M1\r\nWB R2 M2 has right: WB R3 M1 and dn: LB R2 M2\r\nWB R2 M3 has right: WB R3 M2 and dn: LB R2 M3\r\nWB R2 M4 has right: WB R3 M2 and dn: LB R2 M4\r\nWB R3 M1 has right: WB R4 M1 and dn: LB R4 M1\r\nWB R3 M2 has right: WB R4 M1 and dn: LB R4 M2\r\nWB R4 M1 has right: LB R7 M1 and dn: LB R6 M1\r\nLB R1 M1 has right: LB R2 M1 and dn: null\r\nLB R1 M2 has right: LB R2 M2 and dn: null\r\nLB R1 M3 has right: LB R2 M3 and dn: null\r\nLB R1 M4 has right: LB R2 M4 and dn: null\r\nLB R2 M1 has right: LB R3 M1 and dn: null\r\nLB R2 M2 has right: LB R3 M1 and dn: null\r\nLB R2 M3 has right: LB R3 M2 and dn: null\r\nLB R2 M4 has right: LB R3 M2 and dn: null\r\nLB R3 M1 has right: LB R4 M1 and dn: null\r\nLB R3 M2 has right: LB R4 M2 and dn: null\r\nLB R4 M1 has right: LB R5 M1 and dn: null\r\nLB R4 M2 has right: LB R5 M1 and dn: null\r\nLB R5 M1 has right: LB R6 M1 and dn: null\r\nLB R6 M1 has right: LB R7 M1 and dn: null\r\nLB R7 M1 has right: LB R8 M1 and dn: LB R8 M1\r\nLB R8 M1 has right: null and dn: null\r\n```\r\n\r\nEssentially the only weird cases here should be \r\n\r\n1. where loser of the first grand final game in round 7,  sometimes moves to grand final game to in round 8. But that's only if the player that came from LB actually won.\r\n2. Where winner of WB final (round 4) actually moves right into round 7 LB (grand final)."}}