VANAMBURG::Packet

This class gives models packets or decks of cards. Methods include a variety of shuffles and cuts as well as dealing cards from one packet into another.

This is the base class for all the specialized decks in this package, such as BCS, Si Stebbins, etc.

cards

An array reference containing instances of VANAMBURG::Card objects.

It exposes a number of perl array functions to the main class. Developers will want to know about this:

handles => {
	add_card   => 'push',
	map_cards  => 'map',
	get_card   => 'get',
	card_count => 'count'

shuffle_faro_in

Calling this reorders the packed/deck doing an "in faro". Consult your magical texts for more information.

shuffle_faro_out

Calling this reorders the packed/deck doing an "out faro". Consult your magical texts for more information.

shuffle_random

Randomizes the order of the deck much more than an ordinary shuffle would, for better or worse.

deal

my $new_packet = $self->deal(10);

Removes n number of cards from the top of this packet, reversing their order, as in an ordinary deal. The resulting packet, and instance of VANAMBURG::Packet, is returned.

insert_packet

# Insert a packet after 5 cards from the top of this packet.
$self->insert_packet(5, $other_packet);

Inserts a packet into this packet after a specified number of cards from the top of this packet.

cut

my $new_packet = $self->cut(26);

Cuts off a packet from this packet/deck, resulting in fewer cards in this packet. The new packet is returned as an instance of VANAMBURG::Packet.

cut_and_complete

# cut a deck exactly in the middle and place top on bottom.
$self->cut_and_complete(26);

Cut of n number of cards from the top, and place this packet on the bottom.

cut_and_take

Simulates cutting a packet from the top, completing the cut, and taking the top card from the deck. This deck/packet now has one less card.

The taken card is returned as an instance of VANAMBURG::Card.

cut_take_bury

This simulates cutting to a location, taking that card, placing it on the top, and completing the cut, thus burying the taken card in the middle in a new location.

The 'taken' card, though it remains in the deck, is returned for 'peeking'.

location_of

Given a card, this method returns is location in the packet. This is a one-based index, familiar to a magician, not a 0 baded index, familiar to a programmer.

bottom_card

Returns the bottom card of the packet for 'peeking'. The card remains in this deck. The returned card is an instance of VANAMBURG::Card.

top_card

Returns the top card of the packet for 'peeking'. The card remains in this deck. The returned card is an instance of VANAMBURG::Card.

card_at_location

Returns the card at a location. This is a 1 based index, familiar to the magician, not a 0 based index familiar to the programmer. For 0 based access use get_card(index).

The returned card is an instance of VANAMBURG::Card.

Prints the display name and location to STDOUT. Useful for console scripts only.

to_abbreviation_csv_string

Returns a representation of the packet as a comma separated list of abbreviations (e.g., "AD,JS,2H") which can be passed to VANAMBURG::PacketFactory::create_packet or VANAMBURG::PacketFactory::create_stack to later re-instantiate the packet as objects.