The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Games::Bowling::Scorecard::AsText - format a bowling scorecard as text

VERSION

version 0.106

SYNOPSIS

  use Games::Bowling::Scorecard;

  my $card = Games::Bowling::Scorecard->new;

  $card->record(6,1);  # slow start
  $card->record(7,2);  # getting better
  $card->record(10);   # strike!
  $card->record(9,1);  # picked up a spare
  $card->record(10) for 1 .. 3; # turkey!
  $card->record(0,0);  # clearly distracted by something
  $card->record(8,2);  # amazingly picked up 7-10 split
  $card->record(10, 9, 1); # pick up a bonus spare

  print Games::Bowling::Scorecard::AsText->card_as_text($card);

The above outputs:

  ┏━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━━━┓
  ┃ 6 1 ┃ 7 2 ┃ ╳   ┃ 9 ◢ ┃ ╳   ┃ ╳   ┃ ╳   ┃ - - ┃ 8 ◢ ┃ ╳ 9 ◢ ┃
  ┃   7 ┃  16 ┃  36 ┃  56 ┃  86 ┃ 106 ┃ 116 ┃ 116 ┃ 136 ┃   156 ┃
  ┗━━━━━┻━━━━━┻━━━━━┻━━━━━┻━━━━━┻━━━━━┻━━━━━┻━━━━━┻━━━━━┻━━━━━━━┛

DESCRIPTION

So, you've written a bowling record-keeper and now you want to print out scorecards to your dynamic Gopher site. Games::Bowling::Scorecard has taken care of the scoring, but now you need to worry about all those slashes and dashes and X's

PERL VERSION

This module should work on any version of perl still receiving updates from the Perl 5 Porters. This means it should work on any version of perl released in the last two to three years. (That is, if the most recently released version is v5.40, then this module should work on both v5.40 and v5.38.)

Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl.

METHODS

card_as_text

  my $text = Games::Bowling::Scorecard::AsText->card_as_text($card);

Given a scorecard, this method returns a three-line text version of the card, using standard notation. A total is kept only through the last non-pending frame.

WARNING

This module's interface is almost certain to change, whenever the author gets around to it.

AUTHOR

Ricardo SIGNES <cpan@semiotic.systems>

COPYRIGHT AND LICENSE

This software is copyright (c) 2022 by Ricardo SIGNES.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.