Volity::WinnersList

Volity::WinnersList is Perl class for Volity game record winners lists.
Download

Volity::WinnersList Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Jason McIntosh
  • Publisher web site:
  • http://volity.org/projects/gamut/

Volity::WinnersList Tags


Volity::WinnersList Description

Volity::WinnersList is Perl class for Volity game record winners lists. Volity::WinnersList is Perl class for Volity game record winners lists.SYNOPSISHere's code you might see in a Volity::Game subclass implementing a game where there is one winner and a bunch of losers, the latter of whom are all effectively tied for second place (we assume that the methods called in the first two lines are defined elsewhere): if ($self->game_has_been_won) { my ($winner, @losers) = $self->get_winning_seat_order; $self->winners->add_seat_to_slot($winner, 1); $self->winners->add_seat_to_slot(@losers, 2); $self->end; }And here's what you might see in a subclass defining a score-using games where each player has a discrete ordinal place, and ties and ties are not possible (again assuming the presence of some magic methods defined somewhere else in the subclass): if ($self->game_has_been_won) { my @ordered_seats = $self->get_winning_seat_order; for (my $index = 0; $index winners->add_seat_to_slot($ordered_seats, $place); } $self->end; }Attached to every Volity::Game-subclass object is a WinnersList object, accessible through the game object's winners method. When a game wraps up, it should use the methods listed in this document to place the table's seats in a winning order before calling the end method. The referee will then use this information when it builds the game record to send to the Volity bookkeeper.METHODSslotsAccessor to the raw list of winner slots. Returns an array of anonymous arrays, each representing a single slot, in winning order: the one at index is the winningest slot, and the one at is the losingest. Each of these slot-arrays contains a number of Volity::Seat objects.add_seat_to_slot ($seat, $position)Adds the given seat to the winners list at the given position. Note that the position is expressed in game-rank, so the first-place position is 1, not 0.If there are already seats at the current position, the given seat will share the slot with them. As a shortcut, you can add several seats at once to the same slot by passing an arrayref of seats as the first argument.seats_at_slot ($position)Returns the list of seats the given position in the winners list. Note that the position is expressed in game-rank, so the first-place position is 1, not 0.Requirements:· Perl Requirements: · Perl


Volity::WinnersList Related Software