NAME

Game::Backgammon::Shots - how many of the 36 rolls reach a point

SYNOPSIS

use Game::Backgammon::Shots qw(shots_at);

shots_at(6);     # 17: a direct 6, plus 5-1, 4-2, 3-3, 2-2
shots_at(7);     # 6: only the combinations
shots_at(11);    # 2: 6-5 either way round

DESCRIPTION

The number of the 36 ordered dice rolls that can cover $distance pips, which is what says whether a blot is safe. Six away is 17 shots; seven away is 6. A pip count cannot see that difference and it decides games.

The table is computed by enumeration rather than typed in, so the published shot table can be used as a test of it rather than as its source.

What it ignores

Blocked intermediate points. A combination shot needs somewhere to land halfway, so a blot behind a made point is safer than this says. The error is small and in the safe direction: it makes the bot shyer than it needs to be.

FUNCTIONS

shots_at($distance)

How many of the 36 rolls can cover $distance pips. 0 outside 1 to 24.

table

The whole table as an arrayref, indexed by distance.