?? carddeck.java
字號:
import java.util.*;
class CardDeck
{
// Create a deck of 52 cards
public CardDeck()
{
for(int theSuit = Card.HEARTS ; theSuit<= Card.SPADES ; theSuit++)
for(int theValue = Card.ACE ; theValue <= Card.KING ; theValue++)
deck.push(new Card(theValue, theSuit));
}
// Shuffle the deck
public void shuffle()
{
Collections.shuffle(deck);
}
// Deal a hand
public Hand dealHand(int numCards)
{
Hand hand = new Hand();
for(int i = 0 ; i<numCards; i++)
hand.add((Card)deck.pop());
return hand;
}
private Stack deck = new Stack();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -