private int getValue(Game g) throws GameException {
		// return immediately if game is over already
		if (g.winner() == Game.FIRST_PLAYER)
			return 1;
		else if (g.winner() == Game.SECOND_PLAYER)
			return -1;
		else if (g.winner() == Game.DRAW)
			return 0;

		boolean max;
		int bestVal;

		// if first player, then find the max value
		// otherwise find the min value
		if (g.whoseTurn() == Game.FIRST_PLAYER) {
			max = true;
			bestVal = Integer.MIN_VALUE; // running max, starts at bottom
		} else {
			max = false;
			bestVal = Integer.MAX_VALUE;
		}

		Iterator<Move> moves = g.getMoves();

		while (moves.hasNext()) {
			int value;
			Move m = moves.next();
			Game cp = g.copy();
			cp.make(m);
			value = getValue(cp);
			if ((max && value >= bestVal) || (!max && value <= bestVal)) {
				bestVal = value;
			}
		}
		return bestVal;
	}