Hey everyone.
So now we are so done with the random function.
Now we will define the main logic and that's what we are also going to do in a function and we will
call it in the interface.
So in men while defining the main logic of this program.
So what actually is the main logic of this program.
It's something like when you normally play with this other person.
The thing is the first thing when you enter any character if you do not win then the other person will
get a chance.
Otherwise if you win then you will win.
There is no other option there.
And if the other person win then you will not get any chance.
And in case when no none of you win and the boat is full then the game day so gently the thing here
is will be his first check whether is there anyone who already win or not.
In case of this program if there is no one who win then we will continue a game.
Otherwise we will show who's the winner or then.
The boat is full we will show that it's a tiger.
So that's what something like.
First we need a print like Welcome to the game.
That's it.
And after that we will print the bone.
That is just print both function and then bam it will be both after that.
Again we have now two condition while the boat is full or not if the boat is full we will just call.
If his boat is full that is is I believe yesterday then it is is boat full by this boat is full.
So in that case we will adjust and a pilot program by writing print and then again this is about when
the boat is full.
And what about when the boat is not full.
So we will define that one here because boat is full is defined later.
While we will ship while the boat is not full because we required it again and again because the will
continue up to nine times that is one use a computer again and again up to nine times so vital is the
boat not full.
So if we have by sea is boat fully.
So let me check the name here Iceman.
So here I was a small.
So here not is boat full Mandi boat is not full.
And the perimeter will be boat.
Now we will check here that is there any Vina or not.
If there is someone who already van then it is sure that his demeanor.
Otherwise we will continue over moves.
So first we will check for the computer.
That is the computer.
No not so we will use if not we like we we just check is very narrow not so we will use is winner.
And it is I have I can tell.
So this one is OK there.
And then if is winner and the parameters will be because in that is we know what we are doing we are
checking the board values to a particular letter.
And what are the options in letter.
We have that is all and x.
So we have two options there or an X and the parameter will be both.
So here we have first Bellamy there will be board.
And second is the letter that is for computer.
That is the.
Oh yes that's the all.
And in that case if the computer is not the.
So in that case we will give the player move and then we will print the updated board like the body's
ability to gain in an environment a new entries added as X means that the computer has been there because
we get false in that condition.
So print just something like sorry Hugh.
Lose something like that.
This is about when the computer is not a winner and playing heavies Don't move.
Now one thing here some people are thinking why I have not written computer move here because when the
computer will not move on his move then the next move will be a player not with computer.
So just focus on that one one more thing we also need a break here.
Otherwise this will continue to work.
So here we are done with this one that what will happen in that case.
Now if we now we will check about the players winning.
So this one is something like is we know with that they note.
And then we have barometer ball and the value picks because the axis for user.
So in that case now we cannot just directly right here like computer move and then print both here in
this condition we have two conditions first just like the one then computer doesn't have to be then
he moves that one is also full in this one that when the board is full.
But we also had an undersea condition here sorry and it does index here that is for when the computer
doesn't left with any moves you can or you can just move up with how that statement but that when is
something more efficient.
So we will define a move that will be computer move a variable that causes the output of computer move
then if move if this one will be equal to zero like computer have no move left then we will just print
something like a game and this is the reason we get twice the take game because when we have all the
board full then the next move will be off the computer and the computer men get to zero moves it will
again print taking if you do not want double take him just leave it empty and then you will get a single
take him if you notice there we have twice to take him so hidden here else in the US condition we will
just do the insert letter that is the same like the user input that we have done there.
So here we have the insert letter oh and position will be move because insert letter as we have to Panama
does so always focus on parameters otherwise you get error in that case we will also pin things like
computer blazed and all on position and then we have move that will be the position of that and these
dots there make it at is it'll interface friendly after that we will again in the updated mode and that's
it.
Now they're done with that.
Just one thing here.
Like when the user will.
So here with this if we have another else that will be like print and something like not so different
is you win and that did and then we have a break.
So this is a main logical program and I hope you understand this one because this one is not much typical.
And I believe it's very easy that there are only two possible condition like whether someone win or
not.
So when the computer doesn't win we have the players move a device they lose if the user doesn't feed
then the computer have move.
Otherwise we've won and then we have a condition in which board is full or not.
So here we are done with this one also.
And now just the interfaces left that we will end in the next review.
So thanks for watching.
I will see in the next video.