Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
The solution is going to cover tasks nine and 10 from your final challenge, Task nine tells us to check
the left diagonal for a straight Exaro.
The first and second inducts are always consistent.
They both start at zero and go up until two.
So we can make a for loop or the counter starts at zero.
Goes up until two.
And we can use a single counter to index the ROE and the elements.
Ultimately, this is going to run through every value in the left diagonal, zero zero one one and two
to.
And we can apply the same logic if it's a tax, increase it by one.
If it's a no decrease the counter by one.
And after this loop runs, we know that we've just checked every value in the left diagonal.
If the left diagonal has straight axis or Stratos.
Return the counts.
Otherwise, reset the count to zero.
Now, you might be thinking the loop only runs once, why are we resetting the count to zero?
Well, we still need to check the right diagonal and we want to make sure the count is that zero when
we're doing that.
But before we move on to Task 10, let's run a quick test.
And perfect sex wins.
As I played the sax during this turn, the check win function was called.
None of the roads contained a straight Exaro.
None of the columns contain a straight zero.
This loop ran through the left diagonal, it counted straight axis.
Returned a count of three, which means ACSA wins.
All right, we can try testing a scenario where Erwin's.
Nice owns everything, works well.
And now for the final task, if none of the rows, columns or left diagonal result in a win, we need
to check the right diagonal for a straight arrow.
This one is kind of tricky.
Looking at the gif, the first index is two one zero.
And the second index is zero one and two.
And with this hint, I was trying to tell you to make a loop or the counter starts from zero and goes
up until two.
And during each year on set, the Roman ducks equal to two minus that counter.
And we can do just that, create a loop that runs from I equals zero.
I smaller than three iReports plus.
Will set int Roe index is equal to two minus I.
And we can use these two values to index our board.
It follows that during the first run, the role will be to add the element at that index is going to
be zero in the second run, both indexes are going to be won and in the third run, the road will be
zero.
And the element is going to be to.
All right, as we go through the right diagonal, we're going to check if the values in X.
In which case, update the counter by one.
Otherwise, decrease the counter by one.
All right, and we've reached the end of our function.
Let's test it out.
Woops, I meant to put a zero to end with this final pay X wins.
During this turn, none of the rose.
Columns.
Or left diagonal resulted in a win.
So we reached the final loop, which counts the number of Accessor O's in the right diagonal and returns
the count.
That value ended up being three, so X wins.
Let's test a case of Erwin's.
And our app is bulletproof.
Now, what if there is a tie, given the current state of our code, what would happen?
Let's find out.
And as you might expect, nothing we've exhausted all night turns without Stridex Zorro's, but it would
be nice to print something like it's a tie.
So here, if there aren't any street axes or stray dogs and it's the very last run, then we need to
print it to tie.
So if.
I equals eight if it's the last turn that was taken and nobody won.
Then we'll print it's a tie.
Let's do one final test.
And with this, I am proud to announce that you have now officially completed Module one, you have
my sincere congratulations for making it this far.
Now you know how to use variables to store information, use a false and switch to control how your
code runs or organize your code into functions that perform tasks, run your code in a loop and use
arrays to work with many values at once.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.