*This is documented other places on the web, but I had fun with it, so I figured I'd write it up.*

I've been replaying Mass Effect 1 recently. I noticed that in a club called Flux on the Citadel, there's a casino game called "Quasar". It's essentially a blackjack style game; you want to get as close to 20 points as possible without going over, and each round you can either "stay" and cash out for a known cash prize, or you can "hit" to add a random number of points to your score, but then you risk busting. The minor novelty to Quasar is that when you hit you can choose to add either 1-8 points or 4-7 points to your score.

To be more concrete, the game costs 200 credits to play, and has the following payouts:

0-14: 0

15: 50

16: 100

18: 250

17: 200

19: 300

20: 400

21+: 0

I played a few rounds and lost, when I realized that I'm a programmer! I can make the compute figure out the optimal strategy, and whether it's worth playing!

I whipped up a little dynamic programming algorithm, and it turns out casino owners in Mass Effect aren't very savvy businessmen. Assuming all the dice rolls are uniform, here's what the optimal strategy looks like:

0: hit 4-7 244.60

1: hit 4-7 244.61

2: hit 4-7 238.44

3: hit 1-8 235.73

4: hit 1-8 237.23

5: hit 1-8 242.82

6: hit 4-7 247.19

7: hit 4-7 251.15

8: hit 4-7 237.30

9: hit 1-8 218.13

10: hit 1-8 221.67

11: hit 1-8 230.37

12: hit 1-8 249.22

13: hit 4-7 287.50

14: hit 4-7 237.50

15: hit 4-7 175.00

16: hit 1-8 143.75

17: stay 200.00

18: stay 250.00

19: stay 300.00

20: stay 400.00

The first column is your score, the middle is the action you should take, and the last is your expected return. As you can see, the odds are pretty freaking good. You generally start out at somewhere between zero and five points, where the expected profit is greater than 30 credits per round.

Following this strategy, I went back to the machines and quickly won 1000 credits. Finally that programming knowledge is paying off!

Anyways, here's the code for the curious:

def payout(n):

if n <= 14 or n > 20:

return 0

return {

15: 50,

16: 100,

17: 200,

18: 250,

19: 300,

20: 400

}[n]

def avg(x):

return float(sum(x)) / len(x)

res = dict()

def expected(n):

if n > 20:

return ('stay', 0)

if n in res:

return res[n]

stay = payout(n)

hit1 = avg([expected(n + x)[1] for x in range(1, 9)])

hit2 = avg([expected(n + x)[1] for x in range(4, 8)])

m = max([stay, hit1, hit2])

if m == stay:

res[n] = ('stay', m)

elif m == hit1:

res[n] = ('hit 1-8', m)

elif m == hit2:

res[n] = ('hit 4-7', m)

return res[n]

expected(0)

for k, (a, e) in res.iteritems():

print '%d:\t%s\t\t%0.2f' % (k, a, e)

## 8 comments:

Das ist so toll Ich sehe diese Ansichten absolut an. Ich kann sie stundenlang sehen Aber alle von ihnen sind Bilder und ich bin damit einverstanden, denn ich kann Kasino in meinen Shorts spielen automatenherz.com, du weißt :)

Game of Chance Online

IBCbet Discover the masters of online gambling. Every gamer has come to choose to bet on the online games and all the fun. With the need to play online games are full of overwhelming. To each player has a simple way to participate in the fun.

We also have the scheme of playing online gambling online. All customers have the opportunity to enjoy the game online multiplayer games and many pleasures. You have to play all the games have many fun to many.

In addition, we also have the means of playing online gambling games have come to grips with the atmosphere of the game, online gambling has come a lot of fun to play online games. And so all the glamor. To every player you have come to contact us at any time. Sbobet

High stakes have been proven good and right for the utilization of the objectives for the candidates. Now it has been inducted for the right use of the stakes for the formal and vital terms for the people.

I think that thanks for the valuabe information and insights you have so provided here. 6 Approaches to Pick Computer games for Kids

I'm not a coder, but I have been looking at the probability and for 15 you say to roll 4-7 which gives you a 2/4 chance of winning money, but rolling 1-8 gives you 5/8 chance of winning money or breaking even

And for 12 you say to roll 1-8 which gives you 4/8 chance to win/draw while 4-7 gives you 3/4 chance to win/draw. Even if you add in the chance to get the guaranteed win if you land on 13 for the 1-8 roll it still only comes to 5/8 chance to the 6/8 chance for rolling 4-7

Thanks for this amazing post. I found similar game on ggkids Online

Here are the best visual voicemail apps for android which you can easily download from the Google play store. YouMail Visual Voicemail. Visual Voicemail Plus. T-Mobile Visual Voicemail. Verizon Visual Voice Mail.

I'm reasonably certain he weighted the results by the value of the win, not just whether you win. I.e. a 20 is weighted more heavily than a 17.

Post a Comment