Poker Class , removing cards already dealt
Hi there , I am trying to to create a poker program to return a full deck , deal a hand and deal the 5 cards in the middle. The only problem I have is removing cards that have already been dealt from the deck..:confused:
PS, using an IO(terminal class )
THX
public class Card {
String face;
String suit;
public Card(String face,String suit) {
this.face = face;
this.suit = suit;
}
public String getFace() {
return face;
}
public String getSuit() {
return suit;
}
}
import tcdIO.*;
public class PokerProgram {
public static void main(String[] arg) {
Card[] card = new Card[52];
String[] face = new String[13];
String[] suit = new String[4];
DeckOfCard[] deck = new DeckOfCard[52];
// DeckOfCard deck;
// Card seb = new Card("Seb", "seb");
Terminal t = new Terminal("");
int counter = 0;
int choice = 0;
face[0] = "ace";
face[1] = "deuce";
face[2] = "three";
face[3] = "four";
face[4] = "five";
face[5] = "six";
face[6] = "seven";
face[7] = "eight";
face[8] = "nine";
face[9] = "ten";
face[10] = "jack";
face[11] = "queen";
face[12] = "king";
suit[0] = "heart";
suit[1] = "spades";
suit[2] = "clubs";
suit[3] = "diamonds";
while (counter < 52) {
for (int i = 0; i < suit.length; i++) {
for (int j = 0; j < face.length; j++) {
card[counter] = new Card(face[j], suit[i]);
counter++;
}
}
}
while (choice != 4) {
t.println(" MENU ");
t.println("---------------------------------------");
t.println("(1)Show card deack");
t.println("(2)Deal Hand");
t.println("(3)Deal Floop");
t.println("(4)Exit");
t.println("---------------------------------------");
choice = t.readInt("Please select:");
switch (choice) {
case 1:
for (int i = 0; i < card.length; i++) {
t.println(card[i].getFace() + " of " + card[i].getSuit());
}
break;
case 2:
int card1,
card2;
card1 = (int) (Math.random() * 52 + 1);
card2 = (int) (Math.random() * 52 + 1);
if (card1 != card2) {
t.println("your cards are:");
t.println(card[card1].getFace() + " of "
+ card[card1].getSuit());
t.println(card[card2].getFace() + " of "
+ card[card2].getSuit());
}
break;
case 3:
for (int i = 1; i < 6; i++) {
t.println(card[(int) (Math.random() * 52 + 1)].getFace()
+ " of "
+ card[(int) (Math.random() * 52 + 1)].getSuit());
}
break;
case 4:
t.println("Goodbye");
break;
}
}
}
}