During the COP 2930 Programming II course using Java, we were assigned a project in which we were to write a program that performed a card trick. We were supplied with a video demonstrating the card trick and also given instructions on how the card trick functions. The 'trick' is for the dealer (the program) to guess which card the participant selects at the beginning. Check out the output below.
Hello, I am a very talented computer program and I can even perform a card trick. Just watch and be amazed. To begin the card trick type in your first name: julien Thank you Julien Ok Julien, first things first. Do you want to see what the deck of cards looks like (y/n)? yes Jack of Diamonds 10 of Diamonds Queen of Clubs 2 of Diamonds 8 of Spades Queen of Spades Queen of Diamonds 4 of Clubs 8 of Hearts King of Spades King of Diamonds 7 of Hearts 6 of Clubs 7 of Diamonds 4 of Diamonds 3 of Spades Ace of Clubs 9 of Diamonds Queen of Hearts Jack of Spades 2 of Spades Ace of Diamonds 9 of Spades 5 of Clubs 9 of Hearts Ace of Hearts Ace of Spades 3 of Clubs 4 of Spades 2 of Clubs 10 of Hearts Jack of Clubs 6 of Spades 10 of Clubs 8 of Diamonds 6 of Diamonds King of Hearts 3 of Diamonds 5 of Spades 3 of Hearts 9 of Clubs 10 of Spades 7 of Spades Jack of Hearts King of Clubs 2 of Hearts 5 of Hearts 7 of Clubs 5 of Diamonds 4 of Hearts 8 of Clubs 6 of Hearts Julien, pick a card and remember it... Column 0 Column 1 Column 2 ======================================================= Jack of Diamonds 10 of DiamondsQueen of Clubs 2 of Diamonds 8 of SpadesQueen of Spades Queen of Diamonds 4 of Clubs 8 of Hearts King of Spades King of Diamonds 7 of Hearts 6 of Clubs 7 of Diamonds 4 of Diamonds 3 of Spades Ace of Clubs 9 of Diamonds Queen of Hearts Jack of Spades 2 of Spades Which column is your card in (0, 1, or 2)?: 2 Column 0 Column 1 Column 2 ======================================================= 10 of Diamonds 8 of Spades 4 of Clubs King of Diamonds 7 of Diamonds Ace of Clubs Jack of SpadesQueen of ClubsQueen of Spades 8 of Hearts 7 of Hearts 4 of Diamonds 9 of Diamonds 2 of Spades Jack of Diamonds 2 of DiamondsQueen of Diamonds King of Spades 6 of Clubs 3 of SpadesQueen of Hearts Which column is your card in (0, 1, or 2)?: 0 Column 0 Column 1 Column 2 ======================================================= 8 of Spades 7 of DiamondsQueen of Clubs 7 of Hearts 2 of SpadesQueen of Diamonds 3 of Spades 10 of Diamonds King of Diamonds Jack of Spades 8 of Hearts 9 of Diamonds 2 of Diamonds 6 of Clubs 4 of Clubs Ace of ClubsQueen of Spades 4 of Diamonds Jack of Diamonds King of SpadesQueen of Hearts Which column is your card in (0, 1, or 2)?: 2 Finding secret card... 7 of Diamonds 2 of Spades 10 of Diamonds 8 of Hearts 6 of Clubs Queen of Spades King of Spades Queen of Clubs Queen of Diamonds King of Diamonds Your secret card is: 9 of Diamonds Julien, would you like to play again (y/n)? nope Thank you for playing the card trick!