4 ms·
Show HN: Liar's Dice AI from reinforcement learning
- thomasahle 5y agoAfter Deepmind released their "Player of Games", I decided it would be a good Christmas project to make an AI for a game I've always loved: Liar's Dice (or Dudo). I realized there was a really simple way to implement Counter Factual Regret Minimization (CFR) with a value neural network trained from self play. The code is on https://github.com/thomasahle/liars-dice https://github.com/thomasahle/liars-dice . I will try to write a blog post about how it works later. It starts learning from completely random play, but after about a million games the model is close to the Nash Equilibrium. The pytorch model is converted to ONNX runs entirely in the browser.
- kasbah 5y agoIt's fun! I think I encountered a bug. Seems like I managed to accidentally bid twice, which shouldn't be possible if I understand it correctly. https://i.postimg.cc/85TPBKgC/Screenshot-20211224-153956.png https://i.postimg.cc/85TPBKgC/Screenshot-20211224-153956.png EDIT: Also had a game with only 3 dice? https://i.postimg.cc/PJMCT9sG/image.png https://i.postimg.cc/PJMCT9sG/image.png
- thomasahle 5y agoI think you're right that if you click the buttons fast you'll double bid. I'll fix that, thanks! For the second part, if you win a game, you lose a die. The goal is to get to zero!
- mollerhoj 5y agoHey Thomas, very cool project! Fellow Dane here :-) I actually attempted to build the same thing for fun some years ago, but I must admit I failed to implement the counter factual algorithm correctly and gave up. (I'm a little embarressed to admit that I remember finding a very nice tutorial and even source code for it, but still not grokking it). If youre like me, you probably just really wanted to improve odds vs your friends at the local pub ;-) Anyways, keep up the good work Jens
- thomasahle 5y agoHi Jens! I also worked on it a few years ago, trying to solve the smaller cases using Linear Programming: https://github.com/thomasahle/snyd https://github.com/thomasahle/snyd . These are the most common "one on one" cases I've encountered, since usually at pubs there are more than two players when the number of dice is large! :) I also found the CFR papers really confusing for a long time. The papers have a lot of strange notation. But I think I finally got it, and it's very simple! I can write more about it, if I end up writing a blog post about this project.