Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,240 --> 00:00:00,630
All right.
2
00:00:00,630 --> 00:00:04,230
Let's talk about the mechanics and the program requirements for the Blackjack
3
00:00:04,230 --> 00:00:08,100
game that you'll create. For those of you who are not familiar with the game of
4
00:00:08,100 --> 00:00:10,170
Blackjack also known as 21,
5
00:00:10,560 --> 00:00:13,290
I'm just going to spend a few minutes to go through the rules with you.
6
00:00:14,040 --> 00:00:16,980
Blackjack is a game that's played using cards.
7
00:00:17,550 --> 00:00:22,550
And the goal of the game is to add up your cards to the largest number without
8
00:00:23,730 --> 00:00:27,840
going over 21. If the cards in your hand
9
00:00:27,960 --> 00:00:32,430
add up two more than 21, then it's called a bust
10
00:00:32,700 --> 00:00:34,890
and it means that you lose immediately.
11
00:00:35,610 --> 00:00:40,560
And it doesn't matter how much you've gone over 21, as long as it's over 21,
12
00:00:40,620 --> 00:00:44,610
then you lose. Now the way that the cause are counted
13
00:00:44,840 --> 00:00:49,790
is that all the cards from 2 to 10 count as their face value.
14
00:00:50,090 --> 00:00:53,060
So a six is a six and a nine is a nine, et cetera.
15
00:00:53,810 --> 00:00:58,810
But the Jack, Queen and King each count as 10 and the other special card is the
16
00:01:00,350 --> 00:01:01,183
Ace.
17
00:01:01,370 --> 00:01:05,720
Now the Ace can either count as a one towards your total,
18
00:01:05,990 --> 00:01:09,770
or it can count as an 11. And depending on whether,
19
00:01:09,770 --> 00:01:13,190
if you've gone over 21 or whether if you're under 21,
20
00:01:13,220 --> 00:01:17,330
you can decide which value you want your Ace to represent.
21
00:01:18,320 --> 00:01:22,370
Let's play a sample game. Let's say that the dealer over here got
22
00:01:23,000 --> 00:01:28,000
a 10 to begin with and you got a queen which also counts as a 10 to begin with.
23
00:01:29,660 --> 00:01:30,200
So these
24
00:01:30,200 --> 00:01:34,730
are the first cars that are dealt and both of these cards are revealed.
25
00:01:35,390 --> 00:01:40,100
And then the dealer deals another card to each of you. Now the dealer's
26
00:01:40,130 --> 00:01:44,690
second hand is concealed so you can't work out what their total is,
27
00:01:45,350 --> 00:01:47,120
but you can see your own card.
28
00:01:47,720 --> 00:01:50,720
So the moment we don't know what the dealer has,
29
00:01:50,720 --> 00:01:53,090
it might be 10 plus anything,
30
00:01:53,630 --> 00:01:57,800
but we know that our score is 13, 10 + 3.
31
00:01:59,540 --> 00:02:02,900
At this point you might ask the dealer for another card.
32
00:02:03,380 --> 00:02:08,380
So now you have three cards and luckily it adds up to 20 without going over 21.
33
00:02:11,150 --> 00:02:15,530
But there is also a possibility that you might've gotten a card that would have
34
00:02:15,530 --> 00:02:20,180
pushed your total over 21 at which point you now lose.
35
00:02:20,420 --> 00:02:23,180
And it doesn't matter what the dealer has in their hand,
36
00:02:23,480 --> 00:02:26,000
you've already lost because you've gone over 21.
37
00:02:27,050 --> 00:02:31,190
Now let's say that we got lucky and our total adds up to 20.
38
00:02:31,910 --> 00:02:35,180
Now at this point we say we don't want any more cards
39
00:02:35,540 --> 00:02:39,830
and the dealer reveals their hand. If. like in this case,
40
00:02:39,980 --> 00:02:42,830
they end up with 20 and we have 20,
41
00:02:43,310 --> 00:02:45,170
then we end up in a draw.
42
00:02:45,590 --> 00:02:48,590
So whenever your score equals the dealer score,
43
00:02:48,890 --> 00:02:53,150
then you will draw rather than win or lose. Now,
44
00:02:53,180 --> 00:02:56,360
if on the other hand, the dealer ended up with an Ace,
45
00:02:56,420 --> 00:03:01,420
which we know can count as an 11 and they actually scored higher than us.
46
00:03:02,110 --> 00:03:06,550
They have 21 and we have 20, well, in this case, we would lose.
47
00:03:07,510 --> 00:03:12,510
Now the rules also state that if the dealer ends up with a hand that's smaller
48
00:03:13,720 --> 00:03:16,540
than 17, so 16 or under,
49
00:03:16,900 --> 00:03:19,270
then they must take another card.
50
00:03:19,840 --> 00:03:22,180
Those are the basic rules of blackjack,
51
00:03:22,600 --> 00:03:27,100
but I'd recommend that before you get started head over to the link that's in
52
00:03:27,100 --> 00:03:31,390
the Blackjack starting file and have a few games of Blackjack
53
00:03:31,690 --> 00:03:36,370
just so that you can see for yourself how it actually works and how you win and
54
00:03:36,370 --> 00:03:37,270
how you lose.
55
00:03:38,140 --> 00:03:43,140
And then head over to the final version of the completed project and play our
56
00:03:45,160 --> 00:03:49,060
simplified version of Blackjack. This way
57
00:03:49,090 --> 00:03:52,540
you'll see what the end result is that you're trying to create
58
00:03:52,900 --> 00:03:56,620
and it will be easier when you're creating the code yourself. Now,
59
00:03:56,650 --> 00:03:57,550
as I mentioned,
60
00:03:57,610 --> 00:04:01,780
we're going to try and keep our version of Blackjack a little bit simpler,
61
00:04:02,560 --> 00:04:04,420
and we're going to assume a couple of things.
62
00:04:04,990 --> 00:04:09,430
The first thing is that the card's that we're starting with comes from this
63
00:04:09,430 --> 00:04:13,090
list. You'll notice that I've got 2 through to 10,
64
00:04:13,120 --> 00:04:14,890
all represented in the list.
65
00:04:15,430 --> 00:04:19,660
And then I've got Jack, Queen and King represented as tens as well.
66
00:04:20,110 --> 00:04:25,110
So this means that the 10 has four times the probability of occurring compared
67
00:04:25,870 --> 00:04:27,040
to the other cards.
68
00:04:27,670 --> 00:04:31,660
Now the Ace is going to start off being represented as 11,
69
00:04:31,990 --> 00:04:36,070
and it's going to count as 11 until the user goes over 21.
70
00:04:37,060 --> 00:04:41,050
Now finally, we're going to assume that we have an infinite deck.
71
00:04:41,470 --> 00:04:44,320
So it means that when a card is drawn from the deck,
72
00:04:44,380 --> 00:04:48,130
it's not removed from the deck. Whereas in a real casino,
73
00:04:48,280 --> 00:04:52,780
they have maybe six or eight decks of cards. When a card is drawn,
74
00:04:53,050 --> 00:04:57,310
then there's less probability of that same card occurring again.
75
00:04:57,790 --> 00:05:00,220
And this is how professional card counters,
76
00:05:00,280 --> 00:05:02,260
the people that the casinos hate the most,
77
00:05:02,680 --> 00:05:06,640
actually go about trying to optimize and improve their chances.
78
00:05:07,240 --> 00:05:10,000
But in order to keep things simple in our game,
79
00:05:10,270 --> 00:05:14,770
we're not going to deal with things regarding probability or removing cards from
80
00:05:14,770 --> 00:05:15,460
the deck.
81
00:05:15,460 --> 00:05:19,930
We're going to assume that each of these cards in the list have equal chance of
82
00:05:19,930 --> 00:05:23,770
occurring. If you head over to the App Brewery Blackjack
83
00:05:23,790 --> 00:05:25,000
starting project,
84
00:05:25,360 --> 00:05:28,870
you'll see each of these rules written out in more detail.
85
00:05:29,260 --> 00:05:32,890
Take a look at it so that you're aware what our house rules dictate.
86
00:05:34,030 --> 00:05:37,090
Now, if you scroll to the very top of the Blackjack project,
87
00:05:37,360 --> 00:05:41,590
I've given you four tracks. So just as when you start a video game
88
00:05:41,620 --> 00:05:46,330
you have the choice of normal, hard, extra hard or expert,
89
00:05:46,720 --> 00:05:51,520
it's the same in this project. You can limit yourself to using only one
90
00:05:51,520 --> 00:05:55,060
hint if you are at expert level in Python.
91
00:05:55,630 --> 00:05:57,860
You can only use hint 1 and 2
92
00:05:57,890 --> 00:06:02,890
if you want an extra hard challenge and maybe a little bit of a cry at the end,
93
00:06:04,010 --> 00:06:08,510
there's also hard and normal. So I'll leave the choice up to you.
94
00:06:09,050 --> 00:06:12,500
And if you scroll down, you'll find all the hints listed in here.
95
00:06:13,070 --> 00:06:16,130
Now I recommend everybody, no matter your experience,
96
00:06:16,550 --> 00:06:21,260
everybody should try out the Blackjack game and also look at how the final
97
00:06:21,260 --> 00:06:23,000
project is supposed to work.
98
00:06:23,510 --> 00:06:28,510
But then I've got other things such as a list where I've broken down the program
99
00:06:29,090 --> 00:06:32,840
requirements. You know how we always say, when you have a big problem,
100
00:06:33,080 --> 00:06:35,750
always try to break it down into smaller pieces.
101
00:06:36,290 --> 00:06:41,290
Now you can of course create this list yourself by exploring the game,
102
00:06:41,540 --> 00:06:43,070
exploring the final project,
103
00:06:43,370 --> 00:06:47,210
and then writing your own to do list of things that need to be coded up.
104
00:06:47,570 --> 00:06:48,770
Or alternatively,
105
00:06:48,800 --> 00:06:53,800
you can look at the one that I've created inside hint 2. Inside hint 3
106
00:06:54,650 --> 00:06:56,720
I've created a flowchart for you
107
00:06:57,200 --> 00:07:01,580
which takes the to-do list and breaks it down into a flowchart where you can
108
00:07:01,580 --> 00:07:06,020
look at the logic in more detail. Now, of course, as always,
109
00:07:06,020 --> 00:07:08,390
it's a good idea to create your own flowchart
110
00:07:08,750 --> 00:07:12,650
using a tool like draw.io or using a piece of pen and paper.
111
00:07:13,190 --> 00:07:14,270
But if you need help,
112
00:07:14,330 --> 00:07:18,170
it's there for you and you can download the PDF and read through it.
113
00:07:19,010 --> 00:07:20,480
Now the rest of the hints
114
00:07:20,510 --> 00:07:24,590
will go through how to solve this project in even smaller
115
00:07:24,590 --> 00:07:29,510
bite-size chunks. Depending on your own level of Python at the moment,
116
00:07:29,780 --> 00:07:31,880
choose your own difficulty level.
117
00:07:32,270 --> 00:07:37,270
But I just want to say before you get started that this project is difficult and
118
00:07:37,910 --> 00:07:42,560
I wanted to give you a bit of a challenge and to push yourself so that you get
119
00:07:42,560 --> 00:07:43,393
stronger.
120
00:07:43,970 --> 00:07:48,970
But it will inevitably be moments where you will have doubt and you will be
121
00:07:49,010 --> 00:07:53,000
wondering, what am I doing? I don't understand anything. And in this moment,
122
00:07:53,000 --> 00:07:56,510
I want you to look yourself in the mirror and tell yourself that you got this.
123
00:07:56,540 --> 00:08:00,770
You can do it. And that remember that I'm here rooting for you.
124
00:08:01,100 --> 00:08:02,300
I believe you can do it.
125
00:08:02,300 --> 00:08:06,260
You've got everything that you've learned so far will enable you to do it.
126
00:08:06,470 --> 00:08:09,140
There's nothing new in this challenge.
127
00:08:09,470 --> 00:08:11,750
You just have to put all the pieces together.
128
00:08:12,020 --> 00:08:16,370
You have to push through the difficult parts and maybe sleep on a problem and
129
00:08:16,370 --> 00:08:21,050
think about it and then come back to it. But I believe you can do it. Once
130
00:08:21,050 --> 00:08:23,030
you're ready, pause the video,
131
00:08:23,660 --> 00:08:27,050
head over to the starting project and give it a go.
132
00:08:28,310 --> 00:08:29,780
And once you're satisfied,
133
00:08:29,840 --> 00:08:33,290
then head over to the next lesson and I'll walk through the solution with you.
11887
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.