WillFlame14 / hanabi-bot

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

Only scream discard for critical cards #318

Closed flackr closed 2 days ago

flackr commented 6 days ago

As a last resort, a scream discard should only be used for critical cards.

flackr commented 6 days ago

I've seen games lost because a SDCM was used to save a card that was in fact clued in the bot's hand, let alone not critical.

E.g.

{"players":["Alice","Bob","Cathy","Donald"],"deck":[{"suitIndex":1,"rank":5},{"suitIndex":0,"rank":4},{"suitIndex":0,"rank":5},{"suitIndex":4,"rank":4},{"suitIndex":3,"rank":1},{"suitIndex":3,"rank":3},{"suitIndex":3,"rank":1},{"suitIndex":1,"rank":1},{"suitIndex":0,"rank":1},{"suitIndex":1,"rank":2},{"suitIndex":3,"rank":4},{"suitIndex":2,"rank":4},{"suitIndex":1,"rank":4},{"suitIndex":4,"rank":5},{"suitIndex":3,"rank":2},{"suitIndex":2,"rank":4},{"suitIndex":2,"rank":1},{"suitIndex":4,"rank":1},{"suitIndex":2,"rank":2},{"suitIndex":1,"rank":3},{"suitIndex":3,"rank":4},{"suitIndex":3,"rank":5},{"suitIndex":3,"rank":3},{"suitIndex":0,"rank":4},{"suitIndex":1,"rank":1},{"suitIndex":0,"rank":3},{"suitIndex":2,"rank":5},{"suitIndex":4,"rank":3},{"suitIndex":2,"rank":1},{"suitIndex":3,"rank":1},{"suitIndex":2,"rank":1},{"suitIndex":4,"rank":1},{"suitIndex":1,"rank":4},{"suitIndex":2,"rank":3},{"suitIndex":1,"rank":1},{"suitIndex":0,"rank":1},{"suitIndex":0,"rank":1},{"suitIndex":0,"rank":2},{"suitIndex":1,"rank":3},{"suitIndex":0,"rank":3},{"suitIndex":3,"rank":2},{"suitIndex":4,"rank":2},{"suitIndex":1,"rank":2},{"suitIndex":4,"rank":2},{"suitIndex":0,"rank":2},{"suitIndex":4,"rank":4},{"suitIndex":2,"rank":3},{"suitIndex":2,"rank":2},{"suitIndex":4,"rank":3},{"suitIndex":4,"rank":1}],"actions":[{"type":3,"target":3,"value":2},{"type":0,"target":7,"value":0},{"type":3,"target":1,"value":3},{"type":3,"target":2,"value":2},{"type":2,"target":2,"value":0},{"type":0,"target":6,"value":0},{"type":0,"target":8,"value":0},{"type":0,"target":14,"value":0},{"type":3,"target":2,"value":2},{"type":0,"target":17,"value":0},{"type":0,"target":9,"value":0},{"type":3,"target":2,"value":4},{"type":2,"target":2,"value":3},{"type":0,"target":16,"value":0},{"type":0,"target":18,"value":0},{"type":3,"target":0,"value":5},{"type":1,"target":1,"value":0},{"type":0,"target":5,"value":0},{"type":2,"target":1,"value":0},{"type":0,"target":19,"value":0},{"type":1,"target":3,"value":0},{"type":2,"target":3,"value":1},{"type":0,"target":10,"value":0},{"type":0,"target":12,"value":0},{"type":1,"target":24,"value":0},{"type":3,"target":3,"value":5},{"type":1,"target":23,"value":0},{"type":2,"target":0,"value":0},{"type":0,"target":0,"value":0},{"type":3,"target":0,"value":1},{"type":0,"target":21,"value":0},{"type":3,"target":2,"value":4},{"type":1,"target":30,"value":0},{"type":1,"target":4,"value":0},{"type":0,"target":33,"value":0},{"type":1,"target":29,"value":0},{"type":2,"target":3,"value":0},{"type":1,"target":20,"value":0},{"type":0,"target":11,"value":0},{"type":0,"target":37,"value":0},{"type":1,"target":2,"value":0},{"type":0,"target":25,"value":0},{"type":3,"target":0,"value":3},{"type":1,"target":40,"value":0},{"type":0,"target":41,"value":0},{"type":1,"target":22,"value":0},{"type":2,"target":1,"value":4},{"type":1,"target":15,"value":0},{"type":0,"target":27,"value":0},{"type":0,"target":45,"value":0},{"type":3,"target":3,"value":5},{"type":0,"target":26,"value":0},{"type":1,"target":32,"value":0},{"type":1,"target":35,"value":0},{"type":1,"target":28,"value":0},{"type":0,"target":13,"value":0},{"type":4,"target":3,"value":1}],"notes":[["t17: ... | t29: y5,g5,p5","","t17: ... | t29: r5","","","t4: b3","t2: [f] [b1]","t2: [f] [...]","t6: r1","t5: y2,g2 | t7: y2","t13: b4","t13: ... | t14: y4,g4,p4 | t24: g4,p4 | t33: g4","t23: y4","t27: r5,g5,p5 | t29: g5,p5 | t53: p5","t2: y2,b2 | t4: b2","","t10: [f] [g1]","t10: [f] [...]","t10: r2,g2,p2 | t12: g2,p2","t20: [f] [...]","","t14: b5","","","","t20: r2,r3 | t22: r3","t27: r5,g5,p5 | t29: g5,p5","t31: [cm] [...] | t44: [cm] [p3]","","","t31: ...","","","t33: [f] [g3]","","","","t38: r2","","","","t44: [f] [p2]","","","","t48: p4"],["t17: ... | t29: y5,g5,p5","","t17: ... | t29: r5","","","t4: b3","t3: [f] [b1]","t2: [f] [...]","t6: r1","t5: y2","t13: b4","t13: ... | t14: y4,g4,p4 | t24: g4,p4 | t33: g4","t23: y4","t27: r5,g5,p5 | t29: g5,p5 | t53: p5","t2: ... | t4: b2","t28: [cm] [...]","t11: [f] [g1]","t10: [f] [r2,g1,p1]","t10: r2,g2,p2 | t12: g2,p2","t20: [f] [...]","","t14: b5","","","","t20: r2,r3 | t22: r3","t27: r5,g5,p5 | t29: g5,p5","t31: [cm] [...] | t44: [cm] [p3]","","","t31: ...","","","t33: [f] [g3]","","","","t38: r2","","","","t44: [f] [p2]","","","","t48: p4"],["t17: ... | t29: y5,g5,p5","","t17: ... | t29: r5","","","t4: b3","t2: [f] [b1]","t2: [f] [...]","t6: r1","t5: y2,g2 | t11: y2","t13: b4","t13: ... | t14: y4,g4,p4 | t24: g4,p4 | t33: g4","t23: y4","t27: r5,g5,p5 | t29: g5,p5 | t53: p5","t2: y2,b2 | t4: b2","t28: [cm] [...]","t5: [f] [g1]","t10: [f] [p1]","t10: ... | t11: r2,g2,p2 | t12: g2,p2","t20: [f] [...]","","t14: b5","","","","t20: r2,r3 | t22: r3","t27: r5,g5,p5 | t29: g5,p5","t31: [cm] [...] | t44: [cm] [p3]","","","t31: ...","","","t33: [f] [g3]","","","","t38: r2","","","","t44: [f] [p2]","","","","t48: p4"],["t17: ... | t29: y5,g5,p5","","t17: ... | t29: r5","","","t4: y3,b3 | t10: b3","t2: [f] [b1]","t2: [f] [y1]","t6: r1","t5: y2","t13: b4","t13: ... | t14: y4,g4,p4 | t24: g4,p4 | t33: g4","t23: y4","t27: g5,p5 | t53: p5","t2: y2,b2 | t4: b2","t28: [cm] [...]","t10: [f] [g1]","t10: [f] [...]","t10: r2,g2,p2 | t12: g2,p2","t20: [f] [...]","","t14: b5","","","","t20: r3 | t21: r2,r3 | t22: r3","t27: r5,g5,p5 | t29: g5,p5","t31: [cm] [...] | t44: [cm] [p3]","","","t31: ...","","","t33: [f] [g3]","","","","t38: r2","","","","t44: [f] [p2]","","","","t48: p4"]],"options":{"variant":"No Variant"}}

Cathy does a SDCM on turn 27 to save a g4 that Cathy also has. In general, players don't anticipate a SDCM for this situation so we should only use it if the card is truly critical.

WillFlame14 commented 5 days ago

I see what happened. I assumed that if a save clue was planning to be given that it could be replaced with an SDCM, but I also treat moves like TCMs and 5CMs as "save clues", which cannot be replaced with an SDCM.

SDCMs can also be used to save (delayed) playable cards, so I'd like that to be added too. Other than that, this looks good.

flackr commented 5 days ago

SDCMs can also be used to save (delayed) playable cards, so I'd like that to be added too.

Added and tested, though I'm not sure I like the idea of a SDCM for a playable card if it's potentially duplicated in your own hand as I don't think others would expect it.

WillFlame14 commented 3 days ago

I'm not sure I like the idea of a SDCM for a playable card if it's potentially duplicated in your own hand as I don't think others would expect it.

I think it should be expected, others can try to play around it or get the duplicate played before that player tries to SDCM. With context it might be likely that others are intentionally ignoring it, but in general I'm hesitant to let playable cards go unless it's very obvious.

WillFlame14 commented 2 days ago

Thanks!