Skip to content

Commit

Permalink
Lots of unfinished things
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Hill committed Mar 24, 2017
1 parent 35cfc98 commit ce184a7
Show file tree
Hide file tree
Showing 18 changed files with 225 additions and 58 deletions.
Binary file modified bin/controller/Cashflow.class
Binary file not shown.
23 changes: 18 additions & 5 deletions src/controller/Cashflow.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,24 @@ public static void main(String[] args)
/*
* Just testing stuff in here for now. Main method will call the go() method when game is built
*/
MarketStack ms = new MarketStack();
BigDealStack ms = new BigDealStack();
int initialSize = ms.getSize();
for(int i=0; i<initialSize; i++)
{
int num = i+1;
System.out.println(num + ": " + ((MarketCard) ms.pop()).getTitle()); //Always going to need this cast when getting description unfortunately
System.out.println(num + ": " + (ms.get(i).getTitle())); //Always going to need this cast when getting description unfortunately
}


System.out.println("Just popped: " + ms.pop().getTitle());

for(int i=0; i<initialSize; i++)
{
int num = i+1;
System.out.println(num + ": " + (ms.get(i).getTitle())); //Always going to need this cast when getting description unfortunately
}


}

public void go()
Expand Down Expand Up @@ -50,9 +61,11 @@ public void play()
// Check down sized (check if player's downsize counter is 0)
// Check charity (Check if charity counter is 0)
// Roll dice
// Move player
// Get card from tile ()
//
// Move player (Have to wrap tiles to next tile after last tile is the beginning)
// Get card from tile (Method in tile to get card from its type or perform action for baby, down size, or charity)
// Perform card/tile action
// Update current/all players' financials
// Increment player array (Also needs to wrap like tiles array)
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/model/CardStack.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ public Card push(Card c)
@Override
public Card pop()
{
Card c = super.pop();
_size--;
return super.pop();
super.add(c);
return c;
}

public Card pickCard()
Expand Down
10 changes: 0 additions & 10 deletions src/model/CharityTile

This file was deleted.

11 changes: 11 additions & 0 deletions src/model/CharityTile.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package model;

public class CharityTile extends Tile
{

public CharityTile(String type, int boardIndex)
{
super(type, boardIndex);

}
}
10 changes: 0 additions & 10 deletions src/model/ChildTile

This file was deleted.

10 changes: 10 additions & 0 deletions src/model/ChildTile.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package model;

public class ChildTile extends Tile
{
public ChildTile(String type, int boardIndex)
{
super(type, boardIndex);

}
}
10 changes: 0 additions & 10 deletions src/model/DealTile

This file was deleted.

10 changes: 10 additions & 0 deletions src/model/DealTile.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package model;

public class DealTile extends Tile
{
public DealTile(String type, int boardIndex)
{
super(type, boardIndex);

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

public class DoodadTile extends Tile
{
public DoodadTile(String name, int boardIndex)
{
super(name, boardIndex);
}
}
17 changes: 15 additions & 2 deletions src/model/GameBoard.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
package model;

import java.util.LinkedList;
import java.util.Queue;

public class GameBoard
{
private Tile[] _gameTiles;
private TileCircularLinkedList _tiles;

private static Tile t1 = new DealTile("Deal Tile", 0);
private static Tile t2 = new DoodadTile("Doodad", 1);
private static Tile t3 = new DealTile("Deal", 2);
private static Tile t4 = new CharityTile("Charity", 3);



public GameBoard()
{
_tiles = new TileCircularLinkedList();
_tiles.addTiles(t1, t2, t3, t4);
}



// This class should have an array of tiles that goes back to the beginning when it reaches the end
}
13 changes: 7 additions & 6 deletions src/model/MarketStack.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
public class MarketStack extends CardStack
{
//Not sure how we're working in the descriptions as it's a more graphical concept but for now I'm going to type them out
private static MarketCard Profit1 = new MarketCard("Small Business Boom!",
"The downtown economy has exploded! EVERYONE is affected! ALL businesses with a cash flow of $1000 or less have their cash flow increased by $250",
"profit", true, 250, "");
private static MarketCard Profit2 = new MarketCard("New Management System",
"A new management system creates new efficiencies and lowers costs. Only the person who drew this MarketCard is affected.",
"profit", false, 400, "");
//private static MarketCard Profit1 = new MarketCard("Small Business Boom!",
// "The downtown economy has exploded! EVERYONE is affected! ALL businesses with a cash flow of $1000 or less have their cash flow increased by $250",
// "profit", true, 250, "");
//private static MarketCard Profit2 = new MarketCard("New Management System",
// "A new management system creates new efficiencies and lowers costs. Only the person who drew this MarketCard is affected.",
// "profit", false, 400, "");

//gold MarketCard - value is $ per coin
// private static MarketCard Gold1 = new MarketCard("Price of Gold Soars",
Expand Down Expand Up @@ -166,6 +166,7 @@ public MarketStack()
*
*
*/
/*
public void Action(Player player){
currentcard = marketCardArray.pop();
currentcard.display(); //will be a method in MarketCard to display the GUI for the card
Expand Down
File renamed without changes.
10 changes: 0 additions & 10 deletions src/model/PaydayTile

This file was deleted.

10 changes: 10 additions & 0 deletions src/model/PaydayTile.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package model;

public class PaydayTile extends Tile
{
public PaydayTile(String type, int boardIndex)
{
super(type, boardIndex);

}
}
2 changes: 1 addition & 1 deletion src/model/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class Player
{
public FinacialStatement _fs; //financial statement of user
public FinancialStatement _fs; //financial statement of user
//idNumber?
// public boolean _charity;
private int _CharityCount; //charity counter
Expand Down
18 changes: 15 additions & 3 deletions src/model/Tile.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,25 @@

public class Tile
{
private String _type;
private String _name;
private int _boardIndex;
private Player[] _players;

public Tile(String type)
public Tile(String name, int boardIndex)
{
_type = type;
_name = name;
_boardIndex = boardIndex;
}

public int getBoardIndex()
{
return _boardIndex;
}

public String getName()
{
return _name;
}


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

public class TileCircularLinkedList
{
class Node {
Tile t;
Node next;
public Node(Tile tile) {
this.t = tile;
}
public Node getNext() {
return next;
}
public Tile getData() {
return t;
}
}

public int size =0;
public Node head=null;
public Node tail=null;

//add a new node at the start of the linked list
public void addNodeAtStart(Tile tile){
Node n = new Node(tile);
if(size==0){
head = n;
tail = n;
n.next = head;
}else{
Node temp = head;
n.next = temp;
head = n;
tail.next = head;
}
size++;
}


public void addNodeAtEnd(Tile tile){
if(size==0){
addNodeAtStart(tile);
}else{
Node n = new Node(tile);
tail.next =n;
tail=n;
tail.next = head;
size++;
}
}

public void deleteNodeFromStart(){
if(size==0){
System.out.println("List is Empty");
}else{
head = head.next;
tail.next=head;
size--;
}
}

public Node get(int index){
if(index>size){
return null;
}
Node n = head;
while(index-1!=0){
n=n.next;
index--;
}
return n;
}

public Tile elementAt(int index){
if(index>size){
return null;
}
Node n = head;
while(index-1!=0){
n=n.next;
index--;
}
return n.t;
}

//print the linked list
public void print(){
Node temp = head;
if(size<=0){
System.out.print("List is empty");
}else{
do {
System.out.print(" " + temp.t.getName());
temp = temp.next;
}
while(temp!=head);
}
System.out.println();
}

//get Size
public int getSize(){
return size;
}


public void addTiles(Tile... tiles)
{
for(Tile t : tiles)
{
this.addNodeAtEnd(t);
}

}

}

0 comments on commit ce184a7

Please sign in to comment.