@Override
	public void update(Observable o, Object arg) {
		if (arg instanceof SevenOutEvent) {
//			System.out.println("Sevened out, clearing all bet history.");
			lastBets.clear();
		} else if (o instanceof PassOrCome) {
			if (((BetEvent)arg).getType() == BetEvent.EventType.NUMBER_ESTABLISHED) {
				PassOrCome bet = (PassOrCome)o;
				if (lastBets.get(bet.getNumber()) == null) {
					lastBets.put(bet.getNumber(), STARTING_ODDS * bet.getMainBet());
				} else {
					int newBet = lastBets.get(bet.getNumber()) + bet.getMainBet();
					if (newBet <= bet.getMaxOddsBet())
						lastBets.put(bet.getNumber(), newBet);
				}
				bet.updateOddsBet(lastBets.get(bet.getNumber()));
			}
//			System.out.println("\nOptimalStrategy2 observes bet event for "+o+" of type "+((BetEvent)arg).getType()+".\n");
		} else if (o instanceof Dont) {
			if (((BetEvent)arg).getType() == BetEvent.EventType.NUMBER_ESTABLISHED) {
				Dont bet = (Dont)o;
				if (lastBets.get(bet.getNumber()) == null) {
					lastBets.put(bet.getNumber(), bet.getOddsBetMultiple(STARTING_ODDS));
				} else {
					int newBet = lastBets.get(bet.getNumber()) + bet.getMainBet();
					if (newBet <= bet.getMaxOddsBet())
						lastBets.put(bet.getNumber(), newBet);
				}
				bet.updateOddsBet(lastBets.get(bet.getNumber()));
			}
//			System.out.println("\nOptimalStrategy2 observes bet event for "+o+" of type "+((BetEvent)arg).getType()+".\n");
		}
	}