Playing cards: Difference between revisions

Content added Content deleted
(Added implementation for PHP)
(→‎{{header|PHP}}: changed Deck::deal() to deal FIFO in stead of LIFO)
Line 2,205: Line 2,205:
}
}


return new CardCollection( array_splice( $this->cards, -$amount ) );
return new CardCollection( array_splice( $this->cards, 0, $amount ) );
}
}


Line 2,252: Line 2,252:


52 cards in the new deck, shuffled:
52 cards in the new deck, shuffled:
♦K ♥5 ♠3 ♦4 ♠A ♠2 ♣7 ♥3 ♦3 ♣9 ♥A ♠T ♦Q ♣4 ♣A ♦T ♥K ♥8 ♦2 ♥6 ♣3 ♣5 ♠Q ♠7 ♠5 ♦5 ♠6 ♥9 ♥Q ♠K ♠J ♣Q ♣2 ♥2 ♣K ♦9 ♦7 ♦J ♦8 ♥T ♣J ♠9 ♠4 ♦A ♣T ♦6 ♥7 ♥4 ♣6 ♠8 ♥J ♣8
♣5 ♥6 ♠3 ♥9 ♥7 ♥Q ♠J ♠4 ♦7 ♣Q ♣4 ♠9 ♦A ♠Q ♦J ♦9 ♠K ♥A ♥T ♦Q ♥K ♥8 ♣6 ♥2 ♠5 ♠A ♦8 ♣A ♥4 ♣K ♣9 ♠7 ♥J ♠T ♦2 ♣7 ♣T ♦K ♣8 ♣2 ♥5 ♦T ♥3 ♠8 ♠6 ♣J ♦5 ♣3 ♦3 ♠2 ♦4 ♦6


Player 1 got dealt the following 4 cards: ♣6 ♠8 ♥J ♣8
Player 1 got dealt the following 4 cards: ♣5 ♥6 ♠3 ♥9
Player 2 got dealt the following 4 cards: ♣T ♦6 ♥7 ♥4
Player 2 got dealt the following 4 cards: ♥7 ♥Q ♠J ♠4
Player 3 got dealt the following 4 cards: ♣J ♠9 ♠4 ♦A
Player 3 got dealt the following 4 cards: ♦7 ♣Q ♣4 ♠9
Player 4 got dealt the following 4 cards: ♦7 ♦J ♦8 ♥T
Player 4 got dealt the following 4 cards: ♦A ♠Q ♦J ♦9


36 cards remaining in the deck:
36 cards remaining in the deck:
♦K ♥5 ♠3 ♦4 ♠A ♠2 ♣7 ♥3 ♦3 ♣9 ♥A ♠T ♦Q ♣4 ♣A ♦T ♥K ♥8 ♦2 ♥6 ♣3 ♣5 ♠Q ♠7 ♠5 ♦5 ♠6 ♥9 ♥Q ♠K ♠J ♣Q ♣2 ♥2 ♣K ♦9</pre>
♠K ♥A ♥T ♦Q ♥K ♥8 ♣6 ♥2 ♠5 ♠A ♦8 ♣A ♥4 ♣K ♣9 ♠7 ♥J ♠T ♦2 ♣7 ♣T ♦K ♣8 ♣2 ♥5 ♦T ♥3 ♠8 ♠6 ♣J ♦5 ♣3 ♦3 ♠2 ♦4 ♦6</pre>


=={{header|PicoLisp}}==
=={{header|PicoLisp}}==