13
1
There's never really been a definitive ASCII-cards challenge AFAIK. So, using the following deck of ASCII cards:
.------..------..------..------..------..------..------..------..------..------..------..------..------.
|2.--. ||3.--. ||4.--. ||5.--. ||6.--. ||7.--. ||8.--. ||9.--. ||T.--. ||J.--. ||Q.--. ||K.--. ||A.--. |
| (\/) || (\/) || (\/) || (\/) || (\/) || (\/) || (\/) || (\/) || (\/) || (\/) || (\/) || (\/) || (\/) |
| :\/: || :\/: || :\/: || :\/: || :\/: || :\/: || :\/: || :\/: || :\/: || :\/: || :\/: || :\/: || :\/: |
| '--'2|| '--'3|| '--'4|| '--'5|| '--'6|| '--'7|| '--'8|| '--'9|| '--'T|| '--'J|| '--'Q|| '--'K|| '--'A|
'------''------''------''------''------''------''------''------''------''------''------''------''------'
.------..------..------..------..------..------..------..------..------..------..------..------..------.
|2.--. ||3.--. ||4.--. ||5.--. ||6.--. ||7.--. ||8.--. ||9.--. ||T.--. ||J.--. ||Q.--. ||K.--. ||A.--. |
| :/\: || :/\: || :/\: || :/\: || :/\: || :/\: || :/\: || :/\: || :/\: || :/\: || :/\: || :/\: || :/\: |
| :\/: || :\/: || :\/: || :\/: || :\/: || :\/: || :\/: || :\/: || :\/: || :\/: || :\/: || :\/: || :\/: |
| '--'2|| '--'3|| '--'4|| '--'5|| '--'6|| '--'7|| '--'8|| '--'9|| '--'T|| '--'J|| '--'Q|| '--'K|| '--'A|
'------''------''------''------''------''------''------''------''------''------''------''------'
.------..------..------..------..------..------..------..------..------..------..------..------..------.
|2.--. ||3.--. ||4.--. ||5.--. ||6.--. ||7.--. ||8.--. ||9.--. ||T.--. ||J.--. ||Q.--. ||K.--. ||A.--. |
| :/\: || :/\: || :/\: || :/\: || :/\: || :/\: || :/\: || :/\: || :/\: || :/\: || :/\: || :/\: || :/\: |
| (__) || (__) || (__) || (__) || (__) || (__) || (__) || (__) || (__) || (__) || (__) || (__) || (__) |
| '--'2|| '--'3|| '--'4|| '--'5|| '--'6|| '--'7|| '--'8|| '--'9|| '--'T|| '--'J|| '--'Q|| '--'K|| '--'A|
'------''------''------''------''------''------''------''------''------''------''------''------''------'
.------..------..------..------..------..------..------..------..------..------..------..------..------.
|2.--. ||3.--. ||4.--. ||5.--. ||6.--. ||7.--. ||8.--. ||9.--. ||T.--. ||J.--. ||Q.--. ||K.--. ||A.--. |
| :(): || :(): || :(): || :(): || :(): || :(): || :(): || :(): || :(): || :(): || :(): || :(): || :(): |
| ()() || ()() || ()() || ()() || ()() || ()() || ()() || ()() || ()() || ()() || ()() || ()() || ()() |
| '--'2|| '--'3|| '--'4|| '--'5|| '--'6|| '--'7|| '--'8|| '--'9|| '--'T|| '--'J|| '--'Q|| '--'K|| '--'A|
'------''------''------''------''------''------''------''------''------''------''------''------''------'
Take two integers, p
and q
as input; where p
is the number of players and q
is the number of cards each player gets.
- Randomly shuffle the deck of cards (this is ambiguous, but means that all cards must be equally likely to appear anywhere once).
- Deal 1 round of cards per player, outputting
q
rows ofp
cards each row.
Rules:
- The results should be uniformly random, each card should be equally likely to appear anywhere.
- It is guaranteed that
0 < p*q <= 52 and p < 10
, you may have undefined behavior for scenarios where this is not met. - You should output
q
rows of cards withp
cards per row. - Each column should be separated by
|
(a pipe char surrounded by spaces); if you choose a different char than this, explain why. Surrounding spaces here are NOT optional. - Each row must have 1 or more newlines inbetween them, more than one is acceptable, 0 is not (1 newline meaning the newline there by default).
- Each row should be labeled with the player who owns it in the format "Player N" (0 or 1-indexed is fine).
- No one card may appear more than once.
T
is for Ten.
Examples:
Function(p=1,q=1
):
Player 1 # Can also be 0.
.------.
|2.--. |
| (\/) |
| :\/: |
| '--'2|
'------'
Function(p=2,q=1
):
Player 1 | Player 2 # Can also be "Player 0 | Player 1"
.------. | .------.
|2.--. | | |T.--. |
| (\/) | | | (\/) |
| :\/: | | | :\/: |
| '--'2| | | '--'T|
'------' | '------'
Function(p=2,q=2
):
Player 1 | Player 2 # Can also be "Player 0 | Player 1"
.------. | .------.
|J.--. | | |3.--. |
| (\/) | | | :/\: |
| :\/: | | | :\/: |
| '--'J| | | '--'3|
'------' | '------'
.------. | .------.
|8.--. | | |6.--. |
| :(): | | | :/\: |
| ()() | | | (__) |
| '--'8| | | '--'6|
'------' | '------'
5
Are you going to post many card-challenges from the cards you found at http://patorjk.com/software/taag?
– None – 2017-10-25T22:29:39.653@StraklSeth I mean, sure? The licence of that site doesn't even require credit for use. Though I probably should give it. I've used altered versions of their fonts for 3 challenges thus far. – Magic Octopus Urn – 2017-10-25T22:34:03.143
1Soooo...Can we "use" this site to output the result??? – J42161217 – 2017-10-25T22:37:48.363
@Jenny_mathy I mean: loopholes, formatting, transformations, headers, column separators and other such things would probably prevent that... But if you want to make major edits after typing "123456789TJQKA" to make a challenge then sure you can use that site. – Magic Octopus Urn – 2017-10-25T22:39:06.157
1
I mean: Can I make a program that outputs http://patorjk.com/software/taag/#p=display&f=Cards&t=J3%0A86%0A%0A%0A this for your last test case?
– J42161217 – 2017-10-25T22:49:36.923Can't each player's cards be separated vertically? :( – totallyhuman – 2017-10-25T23:06:20.270
5Also,
Each row must have 1 or more newlines inbetween them, more than one is acceptable, 0 is not.
...But your test cases don't have newlines between cards..? – totallyhuman – 2017-10-25T23:09:00.6371
There was almost one challenge on ASCII cards: Play time posted by me.
– sergiol – 2017-10-25T23:55:36.040