Let’s play…I mean…create a prototype ’13’ deck aka Korean Poker!

If you are like me you played this addictive game at lunch, on the bus, during class…whatever you played it constantly because it’s seriously fun and a great way to pass the time. At Capo Valley, we loved this game because it was winnable even if you were dealt a shitty hand, the game encouraged a great deal of shit-talking and merriment. We’d also enhanced it with “insult rules” such as, while dealing, you throw a few of them face-up, just to piss off whoever you want to piss off. It also lended itself to so much cheating that we overlayed a rule; “If no one saw it, it wasn’t cheating.” Technically that is true in the absolute…the difference is that we encouraged cheating because it added more layers of fun, strategy, dexterity, options to win…the perfect game for college-prep band geeks who think to much and are fiercely competitive.

Common ways to cheat when you re the dealer is place a card you want on the bottom of the deck, dealing, 13 cards to each player beginning with west, you get the final card. Desirable cards include the 3 of clubs (whomever holds this card goes 1st…it is much like other games where whomever runs out 1st wins, going 1st on a good hand could end it). The ace of hearts is valued – any run ending in this card is unbeatable (thus you get to go again). Likewise, the 2 of hearts is valued for being the highest card – it is not unbeatable (a two-killer is a double-run-of-three such as 4,4,5,5,6,6) but it’s always nice to have, especially late in the game when most pairs and runs are likely to be all down. Another great way to cheat it to simply hide a card (or two, or more…) wherever you can hide it. The best place seemed to be under the left thigh or up my right sleeve. Another “layered” rule is that if you are caught cheating you forfeit the game (and winning if gambling is involved) – simply trying to look at other people’s cards is another surprisingly easy way cheat.

I won’t waste time with any more specific rules…most of you have never played it…still, the f-ed up ways to mess with the game applies to all of them (and that only scratches the surface) and you can apply the tenets and ideas in this post to YOUR preferred card game.

On topic – I’ve been brushing up on mu Java programming again so as a thought experiment I began to build a “Card” class (ADT, data-type, etc). Once I got that to work I decided to test it by creating an array (a list) of them and ordering them in the exact order they would go in 13. On higher level of this project are the following:

  1. A Deck Class
  2. A 13 Class
  3. A user-interface for the game itself

For now, I simply used my Card data-type to see if I could use a nested-for loop to populate the deck with cards as they from low to high in the game of 13. Software Engineers know that regardless of language, arrays begin at zero. In an object-oriented mode, I decided that “zero” had so little to do with cards/decks/card-games that I would use a place-holder for it. What else is not used…I mean…in actual card games? For most; the Joker(s), so in the interest of something w/in striking distance of elegant design; (in pseuodocode) 0=(string)”joker”
The following is the output from a Deck prototype, which hints at an actual 13 prototype, which is a thought rxp[eriment for the future…particularly the design of three players who can strategize against me…and..on an absurd level of abstraction…try to cheat me if the opportunity comes up and allow me to cheat the non-player-characters.

Below is the successful output from the v0 prototype of a 13-Deck
run:
whomever gets the 3 of spades goes first.
The following list will create a deck of 52 cards in ’13’ order
1. created the 3 of spades
2. created the 3 of clubs
3. created the 3 of diamonds
4. created the 3 of hearts
5. created the 4 of spades
6. created the 4 of clubs
7. created the 4 of diamonds
8. created the 4 of hearts
9. created the 5 of spades
10. created the 5 of clubs
11. created the 5 of diamonds
12. created the 5 of hearts
13. created the 6 of spades
14. created the 6 of clubs
15. created the 6 of diamonds
16. created the 6 of hearts
17. created the 7 of spades
18. created the 7 of clubs
19. created the 7 of diamonds
20. created the 7 of hearts
21. created the 8 of spades
22. created the 8 of clubs
23. created the 8 of diamonds
24. created the 8 of hearts
25. created the 9 of spades
26. created the 9 of clubs
27. created the 9 of diamonds
28. created the 9 of hearts
29. created the 10 of spades
30. created the 10 of clubs
31. created the 10 of diamonds
32. created the 10 of hearts
33. created the J of spades
34. created the J of clubs
35. created the J of diamonds
36. created the J of hearts
37. created the Q of spades
38. created the Q of clubs
39. created the Q of diamonds
40. created the Q of hearts
41. created the K of spades
42. created the K of clubs
43. created the K of diamonds
44. created the K of hearts
45. created the A of spades
46. created the A of clubs
47. created the A of diamonds
48. created the A of hearts
49. created the 2 of spades
50. created the 2 of clubs
51. created the 2 of diamonds
52. created the 2 of hearts
*QA test* The highest ranking card in 13 is the 2 of hearts
BUILD SUCCESSFUL (total time: 0 seconds)

It works! Created using the Netbeans IDE 8.0.2 on a win8.1 box using the Java SE 8 or Java 1.8 as I call it. SRC follows:

package card;
/** WIP - create a card ADT and enumerate it into a deck
* per "13" rules aka Korean Poker
* @author Tapper7.com last stable build - 12/15 &c ssstudios, los angeles, ca
*/
public class Card{
int suit;
int rank;
Card(){
this.suit = 0;
this.rank = 0;
}//null constr
Card(int suit, int rank){
this.suit = suit;
this.rank = rank;
}//fully-formed constructor to be used when a new card is instantiated
public static void showCard(Card theCard){
//cards are ranked as they are in 13 aka korean poker
//"jokers" hold null memory space so we arent using zeroes
String[] s = {"joker", "spades", "clubs", "diamonds", "hearts"};
String[] r = {"joker", "3", "4", "5", "6", "7", "8",
"9", "10", "J", "Q", "K", "A", "2"};
System.out.println(r[theCard.rank] + " of " + s[theCard.suit]);
}

public static void main(String[] args){
//create an array of cards
Card[] mydeck = new Card[54]; //array is oversized for debug
mydeck[0] = new Card(1,1);       //initialize
//test that the lowest card is created correctly
System.out.print(“whomever gets the “);
Card.showCard(mydeck[0]);
System.out.println(“goes first.”);
//populate the 13 deck in order fro m low to high
int currentCard = 1;
int suits = 1;
int ranks = 1;
System.out.println(“The following list will create a deck of 52 cards in ’13’ order”);
for(ranks = 1; ranks < 14; ranks++){//outerloop the ranks from 3 to 2
for(suits = 1; suits < 5; suits++){
mydeck[currentCard] = new Card(suits, ranks);
System.out.print(currentCard+”. “);
System.out.print(” created the “);
Card.showCard(mydeck[currentCard]);
currentCard++; //increment deck position
}//end inner loop
}//end outer loop
//test that the algorithm put the highest card in the correct index:
System.out.print(“*QA test* The highest ranking card in 13 is the “);
Card.showCard(mydeck[52]);
}//end mn
}//end prototype
thanks for stopping by! and now [below], a word form one of our sponsors

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.