All language subtitles for 002 Solution (Tasks 1 - 6)_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

There were two parts of the building, blackjack in part.

One was to set up the logic for starting the game.

The first task was to make a function that returns a random number between one and 13.

Like always, it's going to be public static.

It returns an integer.

The function is called draw random card, and it doesn't take any parameters.

Now, returning a random number between a certain range is something we've done a million times.

First, we use Mathurin, him to get a random decimal from zero to less than one.

And multiplying the result by 13 is going to scale the range from zero to less than 13.

We can add one to the random number to scale the range from one to less than 14.

And then typecasting, double to end cuts off the decimal and returns a whole number from one to 13,

a fairly simple task.

The second task is to make a function that returns a string drawing of the card, as always, its public

static.

And this one returns a string.

And it takes one parameter, an integer that represents a card number.

When you call this function, it's going to receive an integer value and we have to match that integer

value to a card, so we'll use a switch statement to compare the card number against the list of 13

cards.

And don't forget the usual default case.

Because in the event that a random number doesn't match any of our cases, we need the default case

to return a string value as well.

It's simply going to return a string that says not possible.

And for each case, I'm going to return the corresponding cards drink, this is a long process, as

you saw in poker.

Orito So I'm going to fast forward the video because I trust that by now you should know how to do it.

OK, that's over, I'm going to do some cleaning up.

And task three, this one tells us that the user needs to press enter to start the game, some not Eskandar

next line after putting the welcome messages.

And notice that I declared scanner at the level of the class, instead of declaring it in the main method,

you'll find out one part two.

But that doesn't matter because we declared our scanner variable at the level of the class, which means

we can access it from anywhere inside the class section or in our code for now, because we've written

so much.

Let's make sure everything is OK.

OK, so far, nothing interesting.

Now we need to move on to task for to test our function.

When the game starts, the player gets two cards face up so we can use draw a random card to get two

random cards.

Now, each function call is going to return a random integer value between one and 13 into the next

step is to print the string representation of each card.

What I'll do is I'll print you get a new line.

And we can use card strength to return a string drawing of the first card number.

We'll copy this as well.

And connect a string drawing of the second card.

Let's run our code.

And I got a seven and a two.

OK, task five, which is to print the player's hand value, in other words, we need to add up the

value of each card into a total.

So int total.

Is equal to the value of card one plus the value of card to.

Your total is.

Connecting the players total hand value.

Easy right Netrunner code.

Remember that face cards, Jack Queen King should have values of 10, but currently your code treats

Jack Queen and King as 11, 12 and 13.

In this case, the queen is a 12 and three plus 12 is 15.

In the instructions, I give you a hint and it was to use my thought men, because if you look at the

Java documentation, there are four versions of the main function we can use.

Map thought meant to take to integer values and return the smaller of the two.

So here we can use my Damon to get the smaller value between the card number and 10, we'll get the

smaller value between a card one and 10 plus Matt Damon getting the smaller value between card two and

10.

If you run this code.

It's clear that JAV accounts face value this 10 because seven plus 10 is 17.

Think about what happened.

My first card was a seven.

And the minimum value between seven and 10 is seven.

And my second card was a king, which is 13, and the minimum value between 13 and 10 is 10.

In essence, what Matt Damon is doing is it's reducing any card value that is 11, 12 or 13, back down

to 10.

And so from an animation perspective, the two arguments are the card number intent, if the card number

is bigger than 10 men returns 10.

If the card number is smaller than 10 million returns, the card number.

And if the card no intent or equal means simply returns 10.

Like men, there are many other built in functions that make our coding lives easier.

It's up to you to look them up.

And now the dealer gets two cards as well.

This is going to follow a very similar process.

Once again, we use draw random card to get two random cards, but this time for the dealer, dealer,

card one and dealer card to.

Each function call is going to return a random integer value between one in 13 and like before we're

going to print the string representation of each value.

So I'll print a new line.

The dealer shows new line.

And print the first card string.

Followed by a new line.

And if you remember, the dealer's cards needs to be facing down or his second card, for that matter,

so inside your workbook, I left you a function called Face Down that returns a face down card.

So we're going to call this function and print the return value, because we don't want to show the

dealer second card just yet.

And just like before, we're going to calculate the dealer's hand value with simply odds, their first

card by the second.

And remember, we're going to use my thumb and to make sure that face values don't get counted as 11,

12 or 13.

OK, so we have the dealer's total, but until the game actually starts, we're going to hide it.

So here, I'll print.

The dealer's total is hidden.

All right, that's all for part one, it's time to run the code one final time.

And to no surprise, I get two cards, so does the dealer.

But instead of printing their second card, we're printing a face down card because we don't intend

on showing it just yet.

All right, that is all.

I'll see you in part two.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.