carsten-wenderdel / wildbg

Backgammon engine based on neural networks
https://wildbg.shuttleapp.rs/swagger-ui/
Apache License 2.0
18 stars 5 forks source link

Implement cube for money game #17

Open carsten-wenderdel opened 10 months ago

carsten-wenderdel commented 10 months ago

Currently the implementation is quick and super dirty: Cube if the equity is between 0.4 and 0.6. Accept if the equity is below 0.5.

This could be done much better. The article https://bkgm.com/articles/Janowski/cubeformulae.pdf could be helpful.

Of course cube for match play would also be great to have, but money game should be easier.

carsten-wenderdel commented 10 months ago

Not only Rust but als pseudo code would be appreciated. Important: you need to have the copyright, don't copy code from somewhere else.

lassehjorthmadsen commented 9 months ago

For what it's worth, I implemented Janowski-style cubeful equity estimations for money in R, here. The file contains a list of functions, the relevant one is eq_money() This will estimate cubeful equities as a function of:

  1. Cubeless outcome probabilities (like the ones GNUBG and XG produces). They are used to calculate gammon and backgammon frequencies i.e. what proportion of wins and losses that are gammons or backgammons for each side.
  2. Cube position: 0: Center; 1: player; -1: opponent
  3. Probability of winning
  4. Cube-life index, between 0 and 1, defaults to 2/3 as suggested by Janowski

See the documentation.

Using this function, it should be straightforward to deduce cube action: E.g. offer an initial double when the equity with the opponent holding the cube is more than half the equity with a centered cube.

I did some testing of this function, but it should still be considered in development. Seems to match what GNUBG and XG does.

I don't have experiece with Rust, so it's not easy for me to translate into that language. But happy to contribute if I can in any way.