WillFlame14 / hanabi-bot

A bot that plays on the hanab.live interface.
GNU General Public License v3.0
14 stars 9 forks source link

Assume identity based on waiting connections. #313

Closed flackr closed 5 days ago

flackr commented 1 week ago

This fixes a case that I've seen cause some bombs in self play. An ambiguous finesse is given, but one of the players who doesn't realize they're part of the ambiguous finesse gives a finesse based on it assuming that the card is known.

flackr commented 1 week ago

Here's an example game before the fix seed=9 players=4 variant=Black (6 Suits) level=11 seed 9, score: 13/30, strikeout :

{"players":["Alice","Bob","Cathy","Donald"],"deck":[{"suitIndex":1,"rank":4},{"suitIndex":0,"rank":4},{"suitIndex":3,"rank":1},{"suitIndex":1,"rank":3},{"suitIndex":2,"rank":4},{"suitIndex":2,"rank":1},{"suitIndex":3,"rank":3},{"suitIndex":3,"rank":4},{"suitIndex":1,"rank":1},{"suitIndex":3,"rank":3},{"suitIndex":5,"rank":3},{"suitIndex":0,"rank":1},{"suitIndex":1,"rank":2},{"suitIndex":4,"rank":1},{"suitIndex":0,"rank":3},{"suitIndex":4,"rank":1},{"suitIndex":0,"rank":3},{"suitIndex":3,"rank":5},{"suitIndex":1,"rank":2},{"suitIndex":4,"rank":4},{"suitIndex":3,"rank":2},{"suitIndex":5,"rank":2},{"suitIndex":0,"rank":1},{"suitIndex":1,"rank":1},{"suitIndex":2,"rank":1},{"suitIndex":2,"rank":2},{"suitIndex":1,"rank":5},{"suitIndex":2,"rank":4},{"suitIndex":0,"rank":2},{"suitIndex":1,"rank":1},{"suitIndex":3,"rank":2},{"suitIndex":4,"rank":3},{"suitIndex":4,"rank":1},{"suitIndex":2,"rank":5},{"suitIndex":3,"rank":1},{"suitIndex":2,"rank":1},{"suitIndex":4,"rank":2},{"suitIndex":0,"rank":2},{"suitIndex":5,"rank":1},{"suitIndex":4,"rank":4},{"suitIndex":1,"rank":4},{"suitIndex":0,"rank":4},{"suitIndex":0,"rank":1},{"suitIndex":3,"rank":4},{"suitIndex":5,"rank":5},{"suitIndex":2,"rank":3},{"suitIndex":4,"rank":5},{"suitIndex":4,"rank":3},{"suitIndex":3,"rank":1},{"suitIndex":1,"rank":3},{"suitIndex":4,"rank":2},{"suitIndex":5,"rank":4},{"suitIndex":2,"rank":2},{"suitIndex":0,"rank":5},{"suitIndex":2,"rank":3}],"actions":[{"type":3,"target":2,"value":1},{"type":2,"target":0,"value":3},{"type":0,"target":11,"value":0},{"type":3,"target":1,"value":1},{"type":0,"target":2,"value":0},{"type":0,"target":5,"value":0},{"type":0,"target":8,"value":0},{"type":3,"target":0,"value":3},{"type":1,"target":0,"value":0},{"type":3,"target":2,"value":3},{"type":3,"target":0,"value":5},{"type":3,"target":0,"value":5},{"type":0,"target":20,"value":0},{"type":0,"target":18,"value":0},{"type":2,"target":0,"value":5},{"type":0,"target":15,"value":0},{"type":0,"target":3,"value":0},{"type":0,"target":7,"value":0},{"type":0,"target":9,"value":0},{"type":1,"target":13,"value":0},{"type":2,"target":2,"value":0},{"type":0,"target":25,"value":0},{"type":3,"target":0,"value":4},{"type":1,"target":14,"value":0},{"type":2,"target":3,"value":2},{"type":0,"target":28,"value":0},{"type":0,"target":16,"value":0},{"type":0,"target":27,"value":0},{"type":0,"target":1,"value":0},{"type":0,"target":22,"value":0},{"type":4,"target":1,"value":2}],"notes":[["","t12: [cm] [...] | t13: [cm] [[f] [y4]]","t3: b1","t9: y3","","t5: ...","","","t2: ... | t7: y1,p1,NaN","t11: ... | t15: b3","t11: ... | t22: g3,p3,NaN","t2: ...","t4: [cm] [...]","","","t16: [f] [...]","t11: ... | t22: r3","t12: ... | t13: y5 | t30: ...","t9: [f] [y2]","","t11: [f] [b2]","t16: ... | t18: NaN","","","","t22: [f] [...]","","t26: g3,g4 | t28: g4","t26: [f] [...]"],["","t12: [cm] [...] | t24: [cm] [r4,y4,g4] | t28: [cm] [r4]","t3: b1","t9: r3,y3,g3 | t16: y3","","t5: g1,p1,NaN","t13: [f] [b4]","t13: [f] [b3]","t2: ... | t7: y1,p1,NaN","t11: b3,p3 | t15: b3","t11: ... | t22: g3,p3,NaN","t2: ...","t4: [cm] [...]","","","t16: [f] [...]","t11: ... | t22: r3","t12: ... | t13: r5,y5,b5 | t19: ...","t9: [f] [y2]","","t11: [f] [b2]","t16: ... | t18: NaN","t26: [f] [...]","","","t22: [f] [...]","","t26: g4","t24: [f] [r2]"],["","t24: r4,y4 | t28: r4","t3: b1,b2","t9: y3","","t5: ...","","t13: [f] [b4]","t2: ... | t7: y1,p1,NaN","t11: b3,p3 | t15: b3","t11: ... | t22: g3,p3,NaN | t26: g3","t2: ...","t4: [cm] [...]","","","t11: [f] [p1] | t16: [f] [...]","t11: ... | t13: b3 | t15: ... | t22: r3","t12: ... | t13: b5,p5 | t22: b5","t9: [f] [y2]","t11: [f] [p2]","t11: [f] [b2]","t16: NaN,NaN | t18: NaN","","","","t22: [f] [...]","","t26: g4","t24: [f] [r2]"],["","t12: [cm] [...] | t24: [cm] [r4,y4] | t28: [cm] [r4]","t3: b1","t9: y3","","t5: ...","","t13: [f] [b4]","t2: ... | t7: y1,p1,NaN","t11: b3","t11: ... | t22: g3,p3,NaN | t27: p3,NaN | t29: g3,p3,NaN","t2: ...","t4: [cm] [...]","","","t16: [f] [...]","t11: ... | t22: r3","t12: ... | t13: b5 | t19: ...","t9: [f] [y2]","","t11: [f] [b2]","t16: NaN | t17: ... | t18: NaN","","","","t22: [f] [...]","","t26: g3","t24: [f] [r2]"]],"options":{"variant":"Black (6 Suits)"}}

And after, seed 9, score: 25/30, discarded critical, out of pace

{"players":["Alice","Bob","Cathy","Donald"],"deck":[{"suitIndex":1,"rank":4},{"suitIndex":0,"rank":4},{"suitIndex":3,"rank":1},{"suitIndex":1,"rank":3},{"suitIndex":2,"rank":4},{"suitIndex":2,"rank":1},{"suitIndex":3,"rank":3},{"suitIndex":3,"rank":4},{"suitIndex":1,"rank":1},{"suitIndex":3,"rank":3},{"suitIndex":5,"rank":3},{"suitIndex":0,"rank":1},{"suitIndex":1,"rank":2},{"suitIndex":4,"rank":1},{"suitIndex":0,"rank":3},{"suitIndex":4,"rank":1},{"suitIndex":0,"rank":3},{"suitIndex":3,"rank":5},{"suitIndex":1,"rank":2},{"suitIndex":4,"rank":4},{"suitIndex":3,"rank":2},{"suitIndex":5,"rank":2},{"suitIndex":0,"rank":1},{"suitIndex":1,"rank":1},{"suitIndex":2,"rank":1},{"suitIndex":2,"rank":2},{"suitIndex":1,"rank":5},{"suitIndex":2,"rank":4},{"suitIndex":0,"rank":2},{"suitIndex":1,"rank":1},{"suitIndex":3,"rank":2},{"suitIndex":4,"rank":3},{"suitIndex":4,"rank":1},{"suitIndex":2,"rank":5},{"suitIndex":3,"rank":1},{"suitIndex":2,"rank":1},{"suitIndex":4,"rank":2},{"suitIndex":0,"rank":2},{"suitIndex":5,"rank":1},{"suitIndex":4,"rank":4},{"suitIndex":1,"rank":4},{"suitIndex":0,"rank":4},{"suitIndex":0,"rank":1},{"suitIndex":3,"rank":4},{"suitIndex":5,"rank":5},{"suitIndex":2,"rank":3},{"suitIndex":4,"rank":5},{"suitIndex":4,"rank":3},{"suitIndex":3,"rank":1},{"suitIndex":1,"rank":3},{"suitIndex":4,"rank":2},{"suitIndex":5,"rank":4},{"suitIndex":2,"rank":2},{"suitIndex":0,"rank":5},{"suitIndex":2,"rank":3}],"actions":[{"type":3,"target":2,"value":1},{"type":2,"target":0,"value":3},{"type":0,"target":11,"value":0},{"type":3,"target":1,"value":1},{"type":0,"target":2,"value":0},{"type":0,"target":5,"value":0},{"type":0,"target":8,"value":0},{"type":3,"target":0,"value":3},{"type":1,"target":0,"value":0},{"type":3,"target":2,"value":3},{"type":3,"target":0,"value":5},{"type":3,"target":0,"value":5},{"type":0,"target":20,"value":0},{"type":0,"target":18,"value":0},{"type":2,"target":0,"value":5},{"type":0,"target":15,"value":0},{"type":1,"target":21,"value":0},{"type":2,"target":2,"value":5},{"type":0,"target":9,"value":0},{"type":2,"target":2,"value":2},{"type":0,"target":3,"value":0},{"type":0,"target":7,"value":0},{"type":0,"target":25,"value":0},{"type":1,"target":13,"value":0},{"type":3,"target":1,"value":1},{"type":1,"target":22,"value":0},{"type":3,"target":3,"value":1},{"type":1,"target":29,"value":0},{"type":0,"target":17,"value":0},{"type":3,"target":0,"value":4},{"type":0,"target":28,"value":0},{"type":1,"target":23,"value":0},{"type":3,"target":3,"value":1},{"type":3,"target":2,"value":5},{"type":0,"target":16,"value":0},{"type":1,"target":34,"value":0},{"type":0,"target":1,"value":0},{"type":3,"target":2,"value":4},{"type":1,"target":10,"value":0},{"type":0,"target":36,"value":0},{"type":1,"target":24,"value":0},{"type":2,"target":0,"value":1},{"type":1,"target":35,"value":0},{"type":0,"target":31,"value":0},{"type":0,"target":40,"value":0},{"type":1,"target":27,"value":0},{"type":0,"target":19,"value":0},{"type":0,"target":14,"value":0},{"type":3,"target":1,"value":4},{"type":0,"target":6,"value":0},{"type":0,"target":45,"value":0},{"type":2,"target":2,"value":3},{"type":0,"target":26,"value":0},{"type":0,"target":4,"value":0},{"type":2,"target":1,"value":5},{"type":1,"target":39,"value":0},{"type":2,"target":3,"value":4},{"type":2,"target":3,"value":5},{"type":0,"target":33,"value":0},{"type":0,"target":46,"value":0},{"type":3,"target":3,"value":5},{"type":1,"target":44,"value":0},{"type":1,"target":48,"value":0},{"type":0,"target":53,"value":0},{"type":1,"target":32,"value":0},{"type":1,"target":30,"value":0},{"type":4,"target":1,"value":1}],"notes":[["","t12: [cm] [...] | t31: [cm] [r4,y4,g4] | t33: [cm] [r4,g4]","t3: b1","t9: y3","t26: [cm] [...] | t50: [cm] [g4]","t5: ...","t26: [cm] [...]","t13: [f] [b4]","t2: ... | t7: y1,p1,NaN","t11: ... | t13: b3","t11: ... | t19: NaN","t2: ...","t4: [cm] [...]","","t28: [cm] [...]","t16: [f] [...]","t11: ... | t20: r3,g3,p3 | t21: r3,p3 | t31: r3","t12: ... | t13: b5","t9: [f] [y2]","t35: [cm] [...] | t38: [cm] [y4,p2,p4] | t39: [cm] [y4,p4] | t42: [cm] [p4]","t11: [f] [b2]","t16: ...","t26: ...","t28: ...","","t21: g2","t43: y5","","t31: [f] [r2]","t28: ...","","t34: [cm] [...] | t39: [cm] [[f] [p3]]","","t35: ... | t43: r5,g5,p5 | t58: r5,g5","t34: ...","","t39: [f] [p2]","","t53: [cm] [r5,g5,p5] | t58: [cm] [r5,g5] | t60: [cm] [r5] | t62: [cm] [...]","","t43: y4","t53: [cm] [r5,g5,p5] | t58: [cm] [r5] | t62: [cm] [...]","","","t56: ??","t50: [f] [g3]","t58: p5","","t53: b1,b2,b4","","","t59: ??","","t62: r5"],["","t12: [cm] [...] | t31: [cm] [r4,y4,g4] | t33: [cm] [r4,g4]","t3: b1","t9: r3,y3,g3 | t16: y3","t26: [cm] [...] | t50: [cm] [g4]","t5: g1,p1,NaN","t26: [cm] [...]","t13: [f] [b4]","t2: ... | t7: y1,p1,NaN","t11: b3,p3 | t13: b3","t11: ... | t19: NaN","t2: ...","t4: [cm] [...]","","t28: [cm] [...]","t16: [f] [...]","t11: ... | t20: r3,g3,p3 | t21: r3,p3 | t31: r3","t12: ... | t13: y5,b5 | t19: b5","t9: [f] [y2]","t35: [cm] [...] | t39: [cm] [y4,p4] | t42: [cm] [p4]","t11: [f] [b2]","t16: ...","t26: ...","t28: ...","","t21: g2","t43: y5","","t31: [f] [r2]","t28: ...","","t34: [cm] [...] | t39: [cm] [[f] [p3]]","","t35: ... | t43: r5,g5,p5 | t58: r5,g5","t34: ...","","t39: [f] [p2]","","t53: [cm] [r5,g5,p5] | t58: [cm] [r5,g5] | t60: [cm] [r5] | t62: [cm] [...]","","t43: y4","t53: [cm] [r5,g5,p5] | t58: [cm] [r5] | t62: [cm] [...]","","","t56: ??","t50: [f] [g3]","t58: p5","","t53: b1,b2,b4","","","t59: ??","","t62: r5"],["","t31: ... | t32: r4,y4 | t33: r4","t3: b1,b2","t9: y3","t26: [cm] [...] | t50: [cm] [g4]","t5: ...","t26: [cm] [...]","t13: [f] [b4]","t2: ... | t7: y1,p1,NaN","t11: b3,p3 | t13: b3","t11: ... | t19: NaN","t2: ...","t4: [cm] [...]","","t28: [cm] [...]","t11: [f] [p1] | t16: [f] [...]","t11: ... | t20: r3,g3,p3 | t21: r3,p3 | t31: r3","t12: ... | t13: b5,p5 | t24: b5","t9: [f] [y2]","t11: [f] [p2] | t35: [cm] [y4,p2,p4] | t39: [cm] [y4,p4] | t42: [cm] [p4]","t11: [f] [b2]","t16: NaN,NaN","t26: ...","t28: ...","","t21: g2","t43: y5","","t31: [f] [...]","t28: ...","","t34: [cm] [...] | t39: [cm] [[f] [p3]]","","t35: ... | t43: r5,g5,p5 | t58: r5,g5","t34: ...","","t39: [f] [p2]","","t53: [cm] [r5,g5,p5] | t58: [cm] [r5,g5] | t60: [cm] [r5] | t62: [cm] [...]","","t43: y4","t53: [cm] [r5,g5,p5] | t58: [cm] [r5] | t62: [cm] [...]","","","t56: ??","t50: [f] [g3]","t58: p5","","t53: b1,b2,b4","","","t59: ??","","t62: r5"],["","t12: [cm] [...] | t31: [cm] [r4,y4,g4] | t33: [cm] [r4,g4]","t3: b1","t9: y3","t26: [cm] [...] | t50: [cm] [g4]","t5: ...","t26: [cm] [...]","t13: [f] [b4]","t2: ... | t7: y1,p1,NaN","t11: b3","t11: ... | t19: NaN","t2: ...","t4: [cm] [...]","","t28: [cm] [...]","t16: [f] [...]","t11: ... | t19: r3,g3,p3 | t21: r3,p3 | t31: r3","t12: ... | t13: b5","t9: [f] [y2]","t35: [cm] [...] | t39: [cm] [y4,p4] | t42: [cm] [p4]","t11: [f] [b2]","t16: NaN | t17: ...","t26: ...","t28: ...","","t21: g2","t43: y5","","t31: [f] [r2]","t28: ...","","t34: [cm] [...] | t39: [cm] [[f] [p3]]","","t35: ... | t43: r5,g5,p5 | t58: r5,g5","t34: ...","","t39: [f] [p2]","","t53: [cm] [r5,g5,p5] | t60: [cm] [r5,p5] | t61: [cm] [r5] | t62: [cm] [...]","","t43: y4","t53: [cm] [r5,g5,p5] | t60: [cm] [r5,p5] | t61: [cm] [r5] | t62: [cm] [...]","","","t56: ??","t50: [f] [g3]","t58: p5","","t53: b1,b2,b4","","","t59: ??","","t62: r5"]],"options":{"variant":"Black (6 Suits)"}}

Note to reproduce this specific play you may need all my other PRs.

WillFlame14 commented 5 days ago

Thanks! :pray: