Giter Club home page Giter Club logo

rustzbot's Introduction

yahtzeebot

Calculates and outputs the optimal player decision for all game states in solo-player Yahtzee.


Basic Usage

To generate a .csv file of the results:

yahtzeebot > results.csv

This will produce a file with the first few lines resembling:

choice_type,choice,dice,rolls_remaining,upper_total,yahtzee_bonus_avail,open_slots,expected_value
D,01111,65411,2,31,Y,1_3_4_6_7_8_11_,119.23471
S,13,66641,0,11,Y,3_4_5_9_10_13_,113.45208

Each line represents a choice to be made, along with the correct decision.

  • choice_type is 'S' when the choice is regarding which scorecard slot to use, and 'D' when the choice is about which dice to roll.

  • choice is the optimal choice to be made. When the choice_type is 'S' this will be the slot number to use. The number corresponds the slot's ordinal position on the scorecard. e.g. 1 is ACES, and 13 is CHANCE. When the choice_type is 'D', choice show will which dice to roll in the form of 5 binary digits. A value of 01000 would mean to roll the 2nd die only. A value of 00111 would mean to roll the last 3 dice.

  • dice are the current state of the dice values after the previous roll. 66644 means there are 3 dice showing six and 2 dice showing four.

  • upper_total is the current total of upper section scorecard slots. This is relevant for calculating the possibility of an upper total bonus.

  • yahtzee_bonus_avail is 'Y' when a yahtzee has already been scored and therefore another yahtzee rolled would give a 100 point bonus.

  • open_slots is the list of scorecard slots that are currently open and available

  • expected_value is the calculation of how many points will be scored from this point forward in a game where the player makes the recommended choice and continues playing optimally.

A bot (or other player) making use of this data would assess the state of the game at each decision point, then find the row containing the matching dice, rolls remaining, upper section total, yahtzee bonus availability and open slots. That row would indicate the optimal choice and the expected value of points to be earned from optimal play going forward.


Output

The generated csv is roughly 12GB and takes about 10 minutes to generate on a 10-core 2021 Macbook Pro.

rustzbot's People

Contributors

mode80 avatar

Watchers

 avatar

Forkers

mjdavy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.