Steven Jacobs: Optimal Betting Strategy

Computation of Optimal Betting Strategy for Blackjack

Posted by Steve Jacobs on Friday, 13 August 1999, at 11:17 p.m.

Author note: some parts of this were never finished. I’ve decided to post it as it existed in 1993, except for fixing a few typos. — SRJ

Computation of Optimal Betting Strategy for Blackjack
Copyright (C) 1993, Steven R. Jacobs
All rights reserved.

The method for computing an optimal blackjack betting strategy is illustrated below for a specific blackjack game, using the Hi-lo count. The optimal solution is based on the relative frequency of each count level, and the player advantage at each count level. This frequencies and advantages associated with each count level can be obtained through computer simulation of the game in question.

The overall utility function for this game is given by the sum of the “utility terms” listed in the table, when log(bankroll) is used to measure utility. Each count level is modelled as a simple coin toss involving a biased coin. Note that a more accurate model of each count level could be used if we knew the “fine details” at each level. Extending the optimal solution to the more accurate model is described under “Accurate Modelling”.

       Single Deck, 75% penetration head-on play 
  Hi-Lo   Adv.    Freq    Log Utility term Ui(b) 
----------------------------------------------------------------------  
 =-5    -2.6%   .065    0.065 * [0.4870*log(1+d5) + 0.5130*log(1-d5)]   
  -4    -2.1%   .030    0.030 * [0.4895*log(1+d4) + 0.5105*log(1-d4)]   
  -3    -1.6%   .055    0.055 * [0.4920*log(1+d3) + 0.5080*log(1-d3)]   
  -2    -1.1%   .070    0.070 * [0.4945*log(1+d2) + 0.5055*log(1-d2)]   
  -1    -0.6%   .100    0.100 * [0.4970*log(1+d1) + 0.5030*log(1-d1)]    
   0    -0.1%   .200    0.200 * [0.4995*log(1+d0) + 0.5005*log(1-d0)]   
  +1    +0.4%   .095    0.095 * [0.5020*log(1+b1) + 0.4980*log(1-b1)]   
  +2    +0.9%   .075    0.075 * [0.5045*log(1+b2) + 0.4955*log(1-b2)]   
  +3    +1.4%   .050    0.050 * [0.5070*log(1+b3) + 0.4930*log(1-b3)]   
  +4    +1.9%   .045    0.045 * [0.5095*log(1+b4) + 0.4905*log(1-b4)]   
  +5    +2.4%   .040    0.040 * [0.5120*log(1+b5) + 0.4880*log(1-b5)]   
  +6    +2.9%   .035    0.035 * [0.5145*log(1+b6) + 0.4855*log(1-b6)]   
  +7    +3.4%   .030    0.030 * [0.5170*log(1+b7) + 0.4830*log(1-b7)]   
  +8    +3.9%   .030    0.030 * [0.5195*log(1+b8) + 0.4805*log(1-b8)] 
>=+9    +4.4%   .080    0.080 * [0.5220*log(1+b9) + 0.4780*log(1-b9)] 
---------------------------------------------------------------------- 

The d0, d1, d2, d3, d4, d5 variables are the (deficit) bet sizes at the corresponding non-positive counts. These bets all have negative expectation, so the player would prefer to completely avoid betting at these counts, or at least to bet as little as possible. The b1, b2,… b9 variables are the bet sizes at the corresponding positive counts. These bets have positive expectation, so the player would prefer to bet more on each of these counts and increase the bet size as the advantage increases. The optimal bet for these count levels is simply the bet size given by the Kelly criterion — the player should bet a fraction of total bankroll that is equal to the advantage at the current (known) count.

Ideal Betting Strategy

The “ideal” betting strategy is found by assuming that no restrictions are made on the player’s bets. The player is free to “sit out” the negative situations or to play a free hand by conceptually betting zero and receiving cards, but getting payoffs of zero to correspond to the bet size of zero (this theoretically allows the game to continue in head-up situations).

The ideal betting strategy is simply to bet zero if the count indicates that the player’s advantage is negative, and to make a normal Kelly bet (proportional to advantage) when the count is favorable. The Kelly formula given by (b = E*B/A), where ‘b’ is the bet size, E is the expected gain (mean outcome), B is bankroll size, and A is the expectation of the _square_ of the outcome (mean square outcome), which is A = E^2 + V, where V is the variance. For the “biased coin” model, A is exactly equal to 1 so that the the proper Kelly bet is exactly equal to player edge. When you have a 3.3% edge, you bet 3.3% of your bankroll. If a more complex model is used, the proper Kelly bet fraction will generally be different than the player edge, because A will not equal 1. Since the variance for blackjack is generally about 1.25, the proper Kelly bet will be about 80% of the bet size computed by the biased coin approximation.

Constraints on Bet Size

If some constraints are placed on the allowed bet size, then the optimal betting strategy will have to be different than the optimal betting strategy for ideal Kelly bets. The most common constraints found at a blackjack table are the table limits. A typical $5 table will have a $5 minimum bet and an $500 maximum bet. These table limits tend to interfere with ideal Kelly betting, especially if the player is required to bet at least the table minimum on every hand that is dealt. Another example of contraints is when a card counter must limit his/her bet spread to some small range in order to avoid detection. It is customary to use a bet spread somewhere in the range of 2:1 to 8:1 for typical blackjack games. In effect, the card counter must supply his/her own “special” table limits in order to avoid undue attention from the pit.

We will examine at least one method for determining optimals bet sizes for a given bankroll, when a specified bet spread is used. For convenience, we will ignore table limits and assume that the player is free to move between tables if this becomes necessary in order to continue to make optimal bets while playing with the same bet spread. In general, it is hoped that the bankroll will grow continually (and rapidly!), so that the player will advance to higher limits as the bankroll grows. This case is studied below under the heading “Playing a Fixed Bet Spread”.

We will also take a look at what happens if the player should be so unfortunate as to have his/her bankroll shrink. As a limiting case, we will assume the player is at a table with the smallest table limits, and can no longer move to a smaller table if the bankroll continues to shrink. We will show that there is a minimum size bankroll which is required in order to justify continued play. We will also show that if the player’s bankroll drops below this minimum level, then the player can expect the bankroll to continue shrinking if play is continued. This case is studied below under the heading “The Unprofitable Game”.

In order to continue, it will be necessary to understand utility functions and some of the characteristics of the blackjack games that we will be studying.

Utility Functions

The concept of utility functions is extremely useful if we wish to compare two different betting strategies in order to determine which one is “best”. The utility function gives us a way to measure the “goodness” of a particular betting strategy or playing strategy. In fact, it is impossible to find an optimal solution to a problem unless we have a means for measuring the “value” of our results. The purpose of the utility function is to specify the value of each possible situation that we might encounter. In other words, the utility function assigns a value to each of the possible outcomes. This value might correspond directly to the amount of money that is paid to the player for each outcome, or it might weight the money from rare long-shot payoffs as “less valuable” than the money from more common small payoffs.

In a situation where the outcome in uncertain, but the probabilities of the different outcomes are known, the _expected_ utility is computed by taking a weighted average of the utilities associated with each of the possible outcomes. The weights used in this case are the probabilities of each outcome.

Utility can also be thought of as a generalization of expected gain. In fact, if the utility function U(X) = X is used for an outcome of X, then the expected utility in this case will be identical to expected gain.

The logarithmic utility function is used in order to allow us to, on average, multiply the current bankroll by the largest possible factor. A similar approach can be used with different utility functions in order to achieve different goals. If a strategy is optimized using the U(X)=X utility function that is associated with expected gain, then the result will be to, on average, _add_ as much as possible to the current bankroll. This illustrates the primary difference between log utility and expected gain. With log utility, the goal is to force the bankroll to grow exponentially as fast as possible.

Expected Utility for Blackjack

For the blackjack game described above, the expected utility is given by:

   EU =   { sum over count levels -5 to 0 } Fi * U(di)
        + { sum over count levels  1 to 9 } Fi * U(bi)

Where the Fi is the frequency of occurance of the count levels, as listed in the “Freq” column, and U() is the utility function. We have assumed here that U() is a function which depends only on the _current_ bet size. Although it is possible to have utility functions which depend on the size of the previous N bets, we will not consider such utility functions here. Also, it is possible to have utility functions which depend on other variables, such as the total bankroll or the time of day or how tired the player is, but such utility functions are beyond the scope of this discussion.

The form of the expected utility above allows each of the bet sizes
to be optimized independently of all other bet sizes. This make it much easier to find an optimal solution, because the optimal bet size for each situation can be considered “in isolation”. This also greatly simplifies the solution of problems which have constraints on the allowed bet sizes, as we will see in following sections.

We are now ready to find optimal betting strategies for several classes of blackjack games. But what exactly is a betting strategy? A betting strategy is nothing more than a list of bet sizes to be used at each count level. If you decide to bet zero at negative count levels, bet 1 unit at counts of 0, 1, and 2, and bet 4 units at counts of 3 and above, then that is your betting strategy. Any time you specify values for each of the independent variables {d0,…d5, b1,…b9} as “your way” of playing blackjack with your counting system, you have specifed a betting strategy.

How do you decide how “good” your betting strategy is? Simply plug the values for your bet sizes into the expected utility (EU) equation, and you will get the “value” of playing the game “your way”. You can compare two different betting strategies by computing the expected utility for each strategy. The “better” betting strategy is the one that gives the largest expected utility. The optimal betting strategy will result in a higher expected utility than can be obtained by using any other betting strategy. The primary goal of this discussion is to show you how to find an optimal betting strategy for the game shown above.

Unconstrained Optimal Betting for a Single Biased Coin

In the section titled “Ideal Betting Strategy”, we stated without proof the claim that Kelly betting was the best betting strategy to use for the game shown above. We will now show that Kelly betting will maximize the expected log utility for a game which uses biased coins.

Consider an even money bet that is placed on a biased coin which has a probability (p) of coming up heads and a probability (1 – p) of coming up tails. If (p) is greater than 0.5, then a bet on heads will be favorable for the player, and the player edge will be edge = p(winning) – p(losing) = p – (1 – p) = 2p – 1.

If a fraction (f) of your current bankroll is wagered that the next flip of this coin will come up heads, then your bankroll will increase by a factor of (1 + f) if you win this bet, and your bankroll will shrink by a factor of (1 – f) if you lose the bet. If your bankroll before the bet is B and log(bankroll) is used as a utility function, then your expected utility at the conclusion of this bet will be:

EU(f) = p*log(B*(1+f)) + (1-p)*log(B*(1-f))

To find the optimal bet size for this coin toss, we must find the bet fraction which gives the maximimum value for EU(f). We can find this value by solving:

    d{U(f)}/df = 0
=>  p*B/[B*(1+f)] - [(1-p)*B]/[B*(1-f)] = 0

Note that the absolute bankroll size B divides out and completely disappears from the equation to give:

=>  p/(1+f) – (1-p)/(1-f) = 0
=>  p/(1+f) = (1-p)/(1-f)
=>  p(1-f) = (1-p)(1+f)
=>  p – pf = 1 – p + f – pf
=>  p = 1 – p + f
=>  f = 2p – 1

Assuming (p > 0.5) so that betting on heads is a favorable bet, then (2p – 1) is equal to the player edge for this coin flip. So, for a biased coin, you should bet a fraction of your bankroll that is equal to your advantage in order to maximize this utility function.

Notice that absolute bankroll size is unimportant. For the remainder of this article, we will use a bankroll of B=1 in order to simplify the equations.

Unconstrained Optimal Betting for Multiple Biased Coins

Now suppose you are playing a game where there are 4 different coins {A, B, C, D}. You know that the probabilities of these coins being played are {Pa, Pb, Pc, Pd}, and the probability of these coins coming up heads are {Ha, Hb, Hc, Hd}. Before any game is played, you are shown which coin is to be flipped so that you can choose a different bet size for different coins. You want to find a betting strategy {fa, fb, fc, fd} which will maximize your expected utility, using log(bankroll) as your utility function.

The overall utility (OU) function for this game is simply a weighted sum of the utility functions for each of the individual coins. Each coin contributes an amount to the overall utility which is proportional to the probability of that coin being played. So,

OU(fa, fb, fc, fd) = [Pa*EU(fa)] + [Pb*EU(fb)] + [Pc*EU(fc)] + [Pd*EU(fd)] = Pa * [Ha*log(1+fa) + (1-Ha)*log(1-fa)] + Pb * [Hb*log(1+fb) + (1-Hb)*log(1-fb)] + Pb * [Hc*log(1+fc) + (1-Hc)*log(1-fc)] + Pc * [Hd*log(1+fd) + (1-Hd)*log(1-fd)]

Maximizing the OU for one of the bet sizes fa gives

    d{OU(fa)}/d{fa} = 0

=>  Pa*d{EU(fa)}/d{fa} = 0

which holds when

=>  d{EU(fa)} / d(fa) = 0

This is the same equation used to optimize a single coin toss. The important thing to notice here is that the optimum bet size for fa does NOT depend on Pa, so it doesn’t matter how often coin A is played. So, when you are playing coin A, you simply play as if that was the only coin in the game, and choose the correct bet size for that coin.

At this point, you should compare the the overall utility function above with the expected utility for the blackjack game that is described at the beginning of this article. You will find that the “Log Utility Terms” listed in the table are simply the expected utilities for a biased coin that has the player edge listed in the “Adv.” column.

It should be apparent now that for this “biased coin model” of the blackjack game, the optimal bet sizes for each count level are equal to the player advantage for that count level.

Playing a Fixed Bet Spread

Now we will see what happens to the optimal betting strategy when the player is forced to use a limited bet spread, and cannot use a bet size of zero for unfavorable situations. In order to save space, we will note that the expected utility for an unfavorable situation is negative, and that this corresponds to a shrinking bankroll. We will also note (without proof) that the expected utility for a “bad” bet will keep decreasing monotonically as the bet size is increased from zero, and will approach negative infinity as the bet fraction approaches one.

It will be assumed that the player will place minimum bets at all count levels that have a negative expectation. Let’s see what happens to the utility function if the bet sizes d0, d1,…d5 are all set equal to the minumum bet size L. In this case, after multiplying by the frequencies of the various bet levels, all of the log(1+L) terms can be added together and all of the log(1-L) terms can be added together. Then, the coefficients can be divided by the overall frequency of 0.520 in order to return the single “lumped” bet into the original form for a single biased coin. This equavalent biased coin will have an advantagle 0f -0.917% and a frequency of 0.520.

     Negative bets can be lumped into a single equivalent
 Hi-Lo  Adv.    Freq    Log Utility term Ui(b)
----------------------------------------------------------------------
<=-5    -2.6%   .065    0.065 * [0.4870*log(1+L) + 0.5130*log(1-L)]
  -4    -2.1%   .030    0.030 * [0.4895*log(1+L) + 0.5105*log(1-L)]
  -3    -1.6%   .055    0.055 * [0.4920*log(1+L) + 0.5080*log(1-L)]
  -2    -1.1%   .070    0.070 * [0.4945*log(1+L) + 0.5055*log(1-L)]
  -1    -0.6%   .100    0.100 * [0.4970*log(1+L) + 0.5030*log(1-L)]
   0    -0.1%   .200    0.200 * [0.4995*log(1+L) + 0.5005*log(1-L)]
----------------------------------------------------------------------
<= 0    -0.917% .520    0.520 * [0.4954*log(1+L) + 0.5046*log(1-L)]
 Hi-Lo  Adv.    Freq    Log Utility term Ui(b)
----------------------------------------------------------------------
<= 0    -0.917% .520    0.520 * [0.4954*log(1+L) + 0.5046*log(1-L)]
  +1    +0.4%   .095    0.095 * [0.5020*log(1+b1) + 0.4980*log(1-b1)]
  +2    +0.9%   .075    0.075 * [0.5045*log(1+b2) + 0.4955*log(1-b2)]
  +3    +1.4%   .050    0.050 * [0.5070*log(1+b3) + 0.4930*log(1-b3)]
  +4    +1.9%   .045    0.045 * [0.5095*log(1+b4) + 0.4905*log(1-b4)]
  +5    +2.4%   .040    0.040 * [0.5120*log(1+b5) + 0.4880*log(1-b5)]
  +6    +2.9%   .035    0.035 * [0.5145*log(1+b6) + 0.4855*log(1-b6)]
  +7    +3.4%   .030    0.030 * [0.5170*log(1+b7) + 0.4830*log(1-b7)]
  +8    +3.9%   .030    0.030 * [0.5195*log(1+b8) + 0.4805*log(1-b8)]
>=+9    +4.4%   .080    0.080 * [0.5220*log(1+b9) + 0.4780*log(1-b9)]
----------------------------------------------------------------------

Now, we will start with a very large bet spread, and see how to find and optimum value for L. For a given bet spread S, the value of b9 will be S*L, so that the bets are constrained to the required bet spread. This has the effect of coupling together the negative bets and the bets at the highest (most favorable) count level. The part of the utility function that is dependent on the variable L is now given by:

   U(L) =   0.520 * [0.4954*log(1+L) + 0.5046*log(1-L)]
          + 0.080 * [0.5220*log(1+S*L) + 0.4780*log(1-S*L)]

Intuitively, if the allowed bet spread is very large, then the value S*L should end up “close” to the original value of 0.044, and the value L should be S times smaller than this. Taking the derivative of U(L), we get:

   dU(L)/dL =   0.520 * [0.4954/(1+L) - 0.5046/(1-L)]
              + 0.080 * [0.5220*S/(1+S*L) - 0.4780*S/(1-S*L)]

With a bit of algebra, this becomes

   dU(L)/dL =   0.520 * [0.4954*(1-L) – 0.5045(1+L)]/(1-L^2)
              + 0.080 * S * [0.5220*(1-S*L) – 0.4780(1+S*L)]/(1-(S*L)^2)
            =   0.520 * [-0.0091 – L]/(1-L^2)
              + 0.080 * S * [0.044 – S*L]/(1-(S*L)^2)

Setting this equal to zero in order to find the optimal value of L gives:

0.520 * (0.0091+L)/(1-L^2) = 0.080 * S * (0.044 – S*L)/(1-(S*L)^2)

If we assume that L is “small”, then both of the denominators will be close to 1, and dividing both sides by 0.080 reduces this to:

6.500 * (0.0091 + L) = S * (0.044 – S*L)

=> 6.5*0.0091 + L*(S^2 + 6.5) = 0.044 * S
=> L = [0.044*S – 0.05915] / (S^2 + 6.5)

This formula can be used as a starting point for determining the optimal minimum bet size. Note that is S is very large, this reduces to L=0.44/S, which means that the proper bet size at the maximum count will be close to the Kelly bet size for that count level. The min/max bet fractions are tabulated below for various values of S

  S    min bet   max bet
————————-
100   0.000438   0.0438
  20   0.00202    0.0404
  15   0.00260    0.0390
————————-

If you look at this table closely, you we see that we have a problem. As the allowed bet spread gets smaller, the optimal bet size for the maximum bet decreases. At some point, the optimal bet size for the highest count level (count of 9) will “bump into” the Kelly bet size for the next lower count level. This occurs at a bet spread of 15. For bet spreads smaller than this, it will be necessary to place maximum bets at bet level 8 as well as at bet level 9. This will effectively lump together levels 8 and 9, in the same way that the negative bet levels were all lumped together for placing minimum bets. As the bet spread is reduced even further, additional bet levels will become coupled to the min/max bets.

In general, to find the optimal minimum bet fraction, we can use equations of the form:

     0.520 * (0.0091+L)/(1-L^2) = 0.080 * S * (0.044 – S*L)/(1-(S*L)^2)

    FL * (L – EL) = FH * S * (EH – S*L)

    where FL is the frequency of the lumped minimum (Low) bets,

          EL is the expectation of the lumped Low bets,
          FH is the frequency of the lumped maximum (High) bets,
          EH is the expectation of the lumped High bets.

The tricky part is picking the correct levels to lump together for various values of the bet spread.

This equation an be rearranged as follows:

    FL * (L – EL) = S * FH * (EH + S*L)

=>  L * [FL + FH*S^2] = S*FH*EH + FL*EL
=>  L = [S*FH*EH + FL*EL] / [FH*S^2 + FL]

EH * {[FH*S^2 + FL – FL + FL*EL*S/EH]/[FH*S^2 + FL]}

H = S*L = EH * {1 + [S*EL/EH – 1]/[(FH/FL)*S^2 + 1]}
  = EH – [EH – EL*S]*FL/[FH*S^2 + FL]

(NOTE: EL is negative, so H < EH _always_)

(srj — note that high bet is probably a better guideline than small bet)

Note that EL will generally be a negative number. If you examine this equation carefully, it has the form F = E/A given by the Kelly formula, where the possible outcomes are those for a compound game involving only the “coupled” bet levels.

We have found that when a bet spread (S >= 15) is used, of the negative bets become coupled with the bets at counts of +9, and that bet spreads smaller than 15 will also require count level 8 to be coupled with the negative bets. If count levels 8 and 9 are lumped together, we get an equivalent biased coin with an expectation of 0.0426 and a frequency of 0.110. Using these numbers with the lumped negative bets, we get a new equation for L as a function of the spread:

L = [S*0.110*0.0426 – 0.520*0.0091] / [0.110*S^2 + 0.520]

This will result in the following min/max bet fractions:

  S    min bet   max bet
————————-
15    0.00260    0.0390
10    0.00366    0.0366
  8.9  0.00400    0.0356
————————-

This formula becomes invalid at a bet spread of 8.9, when the minimum bet must absorb the +1 count level. This requires the expectation and frequency of the lumped minimum bet to be adjusted to -0.00714 and 0.615. The new equation for L is:

L = [S*0.110*0.0426 – 0.615*0.00714] / [0.110*S^2 + 0.615]

  S    min bet   max bet
-------------------------
  8.9  0.00400    0.0356
  8    0.00432    0.0346
  7.5  0.00452    0.0340
-------------------------

This formula becomes invalid at a bet spread of 7.5, when the maximum bet must absorb the +7 count level. This requires the expectation and frequency of the lumped maximum bet to be adjusted to +0.0408 and 0.140. The new equation for L is:

L = [S*0.140*0.0408 – 0.615*0.00714] / [0.140*S^2 + 0.615]

  S    min bet   max bet
-------------------------
  7.5  0.00452    0.0340
  6    0.00528    0.0317
  5    0.00587    0.0294
  4.9  0.00593    0.0290
-------------------------

This formula becomes invalid at a bet spread of 4.9, when the maximum bet must absorb the +6 count level. This requires the expectation and frequency of the lumped maximum bet to be adjusted to +0.0384 and 0.175. The new equation for L is:

L = [S*0.175*0.0384 – 0.615*0.00714] / [0.175*S^2 + 0.615]

  S    min bet   max bet
————————-
4.9   0.00593    0.0290
4     0.00659    0.0263
3.45  0.00697    0.0240
————————-

This formula becomes invalid at a bet spread of 3.45, when the maximum bet must absorb the +5 count level. This requires the expectation and frequency of the lumped maximum bet to be adjusted to +0.0357 and 0.215. The new equation for L is:

L = [S*0.215*0.0357 – 0.615*0.00714] / [0.215*S^2 + 0.615]

  S    min bet   max bet
-------------------------
 3.45  0.00697    0.0240
 3     0.00731    0.0219
 2.6   0.00752    0.0196
 2.52  0.00755    0.0190
-------------------------

This formula becomes invalid at a bet spread of 2.52, when the maximum bet must absorb the +4 count level. This requires the expectation and frequency of the lumped maximum bet to be adjusted to +0.0328 and 0.260. The new equation for L is:

L = [S*0.260*0.0328 – 0.615*0.00714] / [0.260*S^2 + 0.615]

  S    min bet   max bet
-------------------------
 2.52  0.00755    0.0190
 2     0.00765    0.0153
 1.85  0.00757    0.0140
-------------------------

This formula becomes invalid at a bet spread of 1.85, when the maximum bet must absorb the +3 count level. This requires the expectation and frequency of the lumped maximum bet to be adjusted to +0.0298 and 0.310. The new equation for L is:

L = [S*0.310*0.0298 – 0.615*0.00714] / [0.310*S^2 + 0.615]

  S    min bet   max bet
-------------------------
 1.85  0.00757    0.0140
 1.5   0.00721    0.0108
 1.4   0.00699    0.0098
 1.33  0.00679    0.0090
-------------------------

The Unprofitable Game

Accurate Modelling

In the optimization problem above, the betting levels were modelled as biased coins in order to simplify the problem. A more accurate model would require the complete probability distribution for possible outcomes at each count level (win 1 bet, lose 1 bet, push, win 1.5 bets (blackjack), lose 0.5 bets (surrender), win 2 bets, lose 2 bets, etc.). This would make each of the utility terms more complicated, since there would be a bunch of log() terms involved. However, it would still be possible to locate a local maximum in each of these terms, and the optimal bets would still remain independent, provided that the possible outcomes at each count level are independent from the possible outcomes at all other count levels.

The World Blackjack Portal!