Advertisement
Guest User

Untitled

a guest
Jan 21st, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. int buyPrice = 0;
  2.  
  3. int maxFound = 90;
  4.  
  5. private OrderAction makeDecision(GameState body, String username) {
  6. UserInfo userInfo = body.findUser(username);
  7.  
  8. if(userInfo.getShares() == 0) {
  9. if(body.getStockValue() <= maxFound / 2) {
  10. buyPrice = body.getStockValue();
  11. return new OrderAction(OrderType.BUY, 1000000);
  12. }
  13. } else if(body.getStockValue() > maxFound) {
  14. return new OrderAction(OrderType.SELL, 1000000);
  15. }
  16.  
  17. maxFound = Math.max(maxFound, body.getStockValue());
  18.  
  19. return null;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement