Skip to content
Permalink
3ef3b3ed3f
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
141 lines (92 sloc) 2.47 KB
package controller;
import view.*;
import java.util.ArrayList;
import model.*;
public class Cashflow
{
private static GameBoard _board;
public GameboardWindow gameboard;
public static int numPlayers;
public static void go()
{
System.out.println("Start game");
// Joe
// Initialize players (pick professions)
// Initialize game board
_board = new GameBoard();
// Initialize GUI
/*
* Start game:
* calls play function that has a
* while loop that repeats until either a player wins or
* someone elects to quit
*/
}
public void play()
{
while(!isWinner())
{
// TODO Play method
// Get player whose turn it is
// Display their financial statement
// Check down sized (check if player's down size counter is 0)
// Check charity (Check if charity counter is 0)
// Roll dice
// Move player (Have to wrap tiles to next tile after last tile is the beginning)
// Call tile's getLandedOn method
// Update current/all players' financials
// Increment player array (Also needs to wrap like tiles array)
}
}
public boolean isWinner()
{
boolean isWinner = false;
for(Player p : players)
{
if(p.hasWon())
{
return true;
}
}
return isWinner;
}
private static void testGamePlay()
{
Player p1 = new Player();
Player p2 = new Player();
GameBoard g = new GameBoard(p1, p2);
System.out.println(p1.getLocation());
g.movePlayer(p1, 5);
System.out.println(p1.getLocation());
FSWindow FSWindow = new FSWindow();
FSWindow.prepareGUI(p1);
FSWindow.showButtonDemo();
// Delay to check how the financial statement updates
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
FSWindow.prepareGUI(p2);
}
public static void testCards()
{
BigDealStack ms = new BigDealStack();
int initialSize = ms.getSize();
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
}
Card c1 = ms.pop();
Card c2 = ms.pop();
System.out.println("Just popped: " + c1.getTitle());
System.out.println("Just popped: " + c2.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
}
}
}