Skip to content

Commit

Permalink
Finished market cards
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe authored and Joe committed Mar 3, 2017
1 parent 6df1649 commit 22810c7
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 136 deletions.
Binary file modified bin/controller/Cashflow.class
Binary file not shown.
7 changes: 3 additions & 4 deletions src/controller/Cashflow.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ public class Cashflow
{
public static void main(String[] args)
{
DoodadStack ds = new DoodadStack();
MarketStack ms = new MarketStack();

int initialSize = ds.getSize();
int initialSize = ms.getSize();
for(int i=0; i<initialSize; i++)
{
int num = i+1;
System.out.println(num + ": " + ds.pop().getTitle());
System.out.println(num + ": " + ms.pop().getTitle());
}

}
}
37 changes: 3 additions & 34 deletions src/model/Card.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,20 @@
public class Card
{
private String _title;

//private String _type; // you dont have to use this but i added it because theres so many different types of market cards i need something to keep track of which is which

//private Boolean _effect; //True if it effects all players

private int _value; // Any integer value that can be attached to the card. If card needs no value, put 0. Value of cost for deal cards.

//private int _value2; //value of Down Payment

//private int _value3; //value of Mortgage

//private int _value4; //value of Cash Flow



public Card(String title, int value){

_title = title;

_value = value;

}

public String getTitle()
{
return _title;
}

public int getValue(){
public int getValue()
{
return _value;
}

/**
public int getValue2(){
return _value2;
}
public int getValue3(){
return _value3;
}
public int getValue4(){
return _value4;
}
*/




}
}
30 changes: 30 additions & 0 deletions src/model/CardStack.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package model;

import java.util.ArrayList;
import java.util.Random;
import java.util.Stack;

/**
Expand Down Expand Up @@ -32,8 +34,36 @@ public Card pop()
return super.pop();
}

public Card pickCard()
{
return this.pop();
}

public int getSize()
{
return _size;
}

// Randomizes the stack with the cards in the array argument
public void randomizeCards(Card[] cardArray)
{
//CardStack cardStack = new CardStack();
ArrayList<Card> cardList = new ArrayList<Card>();
Random r = new Random();

// Add all array contents to list
for(Card c : cardArray)
{
cardList.add(c);
}

// Pushes a card at a random index in the card list
int initialLength = cardList.size();
for(int i=0; i < initialLength; i++)
{
push(cardList.remove(r.nextInt(cardList.size())));
}

}

}
27 changes: 4 additions & 23 deletions src/model/DoodadStack.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,36 +52,17 @@ public class DoodadStack extends CardStack
// Constructor just calls makes this stack a randomized stack with Doodad cards
public DoodadStack()
{
randomizeStack();
}


// Randomizes the stack with the member variable cards
private void randomizeStack()
{
//CardStack cardStack = new CardStack();
ArrayList<DoodadCard> cardList = new ArrayList<DoodadCard>();
Random r = new Random();
DoodadCard[] cardArray = {D01, D02, D03, D04, D05, D06, D07, D08, D09, D10,
D11, D12, D13, D14, D15, D16, D17, D18, D19, D20,
D21, D22, D23, D24, D25, D26, D27, D28, D29, D30,
D31, D32, D33, D34, D35, D36, D37, D38, D39, D40, D41, D42};

// Add all array contents to list
for(DoodadCard c : cardArray)
{
cardList.add(c);
}

// Pushes a card at a random index in the card list
int initialLength = cardList.size();
for(int i=0; i < initialLength; i++)
{
this.push(cardList.remove(r.nextInt(cardList.size())));
}

super.randomizeCards(cardArray);
}







Expand Down
20 changes: 18 additions & 2 deletions src/model/MarketCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,25 @@

public class MarketCard extends Card
{
public MarketCard(String title, int value) {
private String _type;
private boolean _affectAll;

public MarketCard(String title, String type, boolean affectAll, int value)
{
super(title, value);
// TODO Auto-generated constructor stub
_type = type;
_affectAll = affectAll;
}

public String getType()
{
return _type;
}

public boolean doesAffectAll()
{
return _affectAll;
}


}
Loading

0 comments on commit 22810c7

Please sign in to comment.