Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Deck.java
- ---------
- public class Deck {
- private Card[][] allCards;
- private Card[] myCards;
- public Deck() {
- allCards = new Card[4][13];
- myCards = new Card[52];
- }
- public void insert(Card card) {
- }
- public boolean move() {
- return false;
- }
- public int sum() {
- int sum = 0;
- for (int i = 0; i < myCards.length && myCards[i] != null; i += 1) {
- sum += myCards[i].getValue();
- }
- return sum;
- }
- }
- Tester.java
- -----------
- public class Tester {
- public static boolean game(Card[] cards) {
- Deck myDeck = new Deck();
- // step 1
- for (Card item : cards) {
- myDeck.insert(item);
- }
- // step 2
- while (myDeck.move()) {
- }
- ;
- // check win
- return (myDeck.sum() % 100 == 0);
- }
- public static void main(String[] args) {
- Card[] cards;
- // cards = .. . ..
- if (game(cards)) {
- System.out.println("You win!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement