War card game: Difference between revisions

m
Minor improvement to code.
m (Minor alteration to text formatting.)
m (Minor improvement to code.)
Line 625:
 
public static void main(String[] args) {
WarGame warGame = new WarGame();
while ( ! warGame.gameOver() ) {
Line 640:
public WarGame() {
deck = new ArrayList<Card>(52);
for ( Character suit : suitsSUITS ) {
for ( Character pip : pipsPIPS ) {
deck.add( new Card(suit, pip) );
}
Line 657:
tabledCards.add(cardA);
tabledCards.add(cardB);
int rankA = pipsPIPS.indexOf(cardA.pip);
int rankB = pipsPIPS.indexOf(cardB.pip);
System.out.print(cardA + " " + cardB);
Line 708:
@Override
public String toString() {
return pip"" + ""pip + suit;
}
Line 715:
private List<Card> deck, handA, handB, tabledCards;
private static final List<Character> pipsPIPS =
Arrays.asList( '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A' );
private static final List<Character> suitsSUITS = List.of( 'C', 'D', 'H', 'S' );
}
884

edits