Skip to content

Commit

Permalink
Added new events display
Browse files Browse the repository at this point in the history
  • Loading branch information
Omp06 committed Dec 14, 2023
1 parent 50c5cf1 commit 88688fd
Show file tree
Hide file tree
Showing 3 changed files with 167 additions and 85 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/stock/ControllerInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@ public interface ControllerInterface {
public ArrayList<Integer> userstockamount();
public Float get_stock_price(String name);

public String get_event_description();

public void currentDebt(float debt);
}
13 changes: 13 additions & 0 deletions app/src/main/java/stock/controller/GameController.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class GameController implements ControllerInterface {
Market market;
EventRoller roller;
int day;
String userEvent;
String gameEvent;


public GameController() {
Expand Down Expand Up @@ -76,6 +78,8 @@ public boolean sell(String ticker, float price, int amount) {
public void nextday() {
ArrayList<String> currentEvents = roller.roll_out();
System.out.println("Turn events: " + currentEvents); // TODO debugging
this.userEvent = currentEvents.get(1);
this.gameEvent = currentEvents.get(0);
gm.next_day(currentEvents.get(0));
user.process_event(currentEvents.get(1));
game.update();
Expand Down Expand Up @@ -137,5 +141,14 @@ public ArrayList<Float> marketstockprices() {
public Float get_stock_price(String name){
return gm.get_market_price(name);
}

public String get_event_description(){
return "User: \n" + roller.get_description_for(userEvent) + "\n\n" + "Market: \n" +
roller.get_description_for(gameEvent);
}

public void currentDebt(float debt){
user.setcurrentDebt(debt);
}
}

Loading

0 comments on commit 88688fd

Please sign in to comment.