package com.bassoli.poker; import java.util.Calendar; import java.util.Random; public class Deck extends Hand { public Deck() { String[] values = {"A","K","Q","J","T","9","8","7","6","5","4","3","2"}; String[] suits = {"S","H","D","C"}; for (int i = 0 ; i < suits.length ; i++) { for (int j = 0 ;j < values.length ; j++) { this.addCard(suits[i]+values[j]); } } } public boolean removeCard(String card) { int i = 0; boolean cardFound = false; for ( ; i < this.cards.length ; i++) { if (this.cards[i].toString().equals(card)) { cardFound = true; break; } } if (!cardFound) { return false; } Card[] newDeck = new Card[cards.length - 1]; for (int j = 0 ; j < i ; j++) { newDeck[j] = cards[j]; } for (int j = i ; j < this.cards.length - 1; j++) { newDeck[j] = cards[j + 1]; } cards = newDeck; return true; } public Hand[] holdemHands() { Hand[] hands = new Hand[(this.getHandSize() * (this.getHandSize() - 1))/2]; int count = 0; for (int i = 0 ; i < this.cards.length ; i++) { for (int j = i+1 ; j < this.cards.length ; j++) { hands[count] = new Hand(); hands[count].addCard(this.cards[i].toString()); hands[count].addCard(this.cards[j].toString()); count++; } } return hands; } public static void main(String[] args) { Deck deck = new Deck(); //System.out.println(deck); //deck.removeCard("SJ"); //deck.removeCard("HA"); //System.out.println(deck); //Hand[] hands = deck.holdemHands(); String test = "HAC5S7STH5"; System.out.println("TEST"); System.out.println(test.indexOf("H7")); } }