1 00:00:06,020 --> 00:00:06,680 Hey everyone. 2 00:00:07,340 --> 00:00:10,110 So now we are so done with the random function. 3 00:00:10,220 --> 00:00:17,750 Now we will define the main logic and that's what we are also going to do in a function and we will 4 00:00:17,750 --> 00:00:19,660 call it in the interface. 5 00:00:20,060 --> 00:00:23,360 So in men while defining the main logic of this program. 6 00:00:23,390 --> 00:00:26,530 So what actually is the main logic of this program. 7 00:00:26,570 --> 00:00:31,430 It's something like when you normally play with this other person. 8 00:00:31,430 --> 00:00:40,160 The thing is the first thing when you enter any character if you do not win then the other person will 9 00:00:40,160 --> 00:00:41,380 get a chance. 10 00:00:41,430 --> 00:00:44,720 Otherwise if you win then you will win. 11 00:00:44,720 --> 00:00:46,280 There is no other option there. 12 00:00:47,090 --> 00:00:51,050 And if the other person win then you will not get any chance. 13 00:00:51,080 --> 00:00:58,760 And in case when no none of you win and the boat is full then the game day so gently the thing here 14 00:00:58,760 --> 00:01:03,870 is will be his first check whether is there anyone who already win or not. 15 00:01:03,980 --> 00:01:09,230 In case of this program if there is no one who win then we will continue a game. 16 00:01:10,240 --> 00:01:14,790 Otherwise we will show who's the winner or then. 17 00:01:15,100 --> 00:01:17,910 The boat is full we will show that it's a tiger. 18 00:01:18,520 --> 00:01:20,230 So that's what something like. 19 00:01:20,230 --> 00:01:27,100 First we need a print like Welcome to the game. 20 00:01:29,280 --> 00:01:31,010 That's it. 21 00:01:31,010 --> 00:01:33,950 And after that we will print the bone. 22 00:01:34,130 --> 00:01:42,310 That is just print both function and then bam it will be both after that. 23 00:01:42,410 --> 00:01:49,630 Again we have now two condition while the boat is full or not if the boat is full we will just call. 24 00:01:49,880 --> 00:02:01,010 If his boat is full that is is I believe yesterday then it is is boat full by this boat is full. 25 00:02:01,460 --> 00:02:15,170 So in that case we will adjust and a pilot program by writing print and then again this is about when 26 00:02:15,170 --> 00:02:16,580 the boat is full. 27 00:02:17,270 --> 00:02:19,170 And what about when the boat is not full. 28 00:02:19,170 --> 00:02:25,780 So we will define that one here because boat is full is defined later. 29 00:02:26,240 --> 00:02:33,670 While we will ship while the boat is not full because we required it again and again because the will 30 00:02:33,680 --> 00:02:39,680 continue up to nine times that is one use a computer again and again up to nine times so vital is the 31 00:02:39,680 --> 00:02:40,820 boat not full. 32 00:02:42,650 --> 00:02:48,170 So if we have by sea is boat fully. 33 00:02:48,770 --> 00:02:51,920 So let me check the name here Iceman. 34 00:02:51,950 --> 00:02:53,690 So here I was a small. 35 00:02:53,960 --> 00:02:58,900 So here not is boat full Mandi boat is not full. 36 00:02:59,180 --> 00:03:02,540 And the perimeter will be boat. 37 00:03:02,570 --> 00:03:07,460 Now we will check here that is there any Vina or not. 38 00:03:07,610 --> 00:03:11,630 If there is someone who already van then it is sure that his demeanor. 39 00:03:11,720 --> 00:03:14,540 Otherwise we will continue over moves. 40 00:03:14,750 --> 00:03:17,390 So first we will check for the computer. 41 00:03:17,420 --> 00:03:19,050 That is the computer. 42 00:03:19,060 --> 00:03:26,980 No not so we will use if not we like we we just check is very narrow not so we will use is winner. 43 00:03:27,260 --> 00:03:30,250 And it is I have I can tell. 44 00:03:30,420 --> 00:03:32,460 So this one is OK there. 45 00:03:32,990 --> 00:03:39,470 And then if is winner and the parameters will be because in that is we know what we are doing we are 46 00:03:39,470 --> 00:03:43,010 checking the board values to a particular letter. 47 00:03:43,130 --> 00:03:44,930 And what are the options in letter. 48 00:03:44,920 --> 00:03:47,940 We have that is all and x. 49 00:03:48,320 --> 00:03:52,180 So we have two options there or an X and the parameter will be both. 50 00:03:52,610 --> 00:03:55,320 So here we have first Bellamy there will be board. 51 00:03:55,370 --> 00:03:58,730 And second is the letter that is for computer. 52 00:03:58,970 --> 00:03:59,510 That is the. 53 00:03:59,600 --> 00:04:04,000 Oh yes that's the all. 54 00:04:04,520 --> 00:04:07,970 And in that case if the computer is not the. 55 00:04:08,270 --> 00:04:20,630 So in that case we will give the player move and then we will print the updated board like the body's 56 00:04:20,630 --> 00:04:27,860 ability to gain in an environment a new entries added as X means that the computer has been there because 57 00:04:27,860 --> 00:04:29,440 we get false in that condition. 58 00:04:29,660 --> 00:04:36,750 So print just something like sorry Hugh. 59 00:04:36,930 --> 00:04:42,190 Lose something like that. 60 00:04:42,540 --> 00:04:49,470 This is about when the computer is not a winner and playing heavies Don't move. 61 00:04:49,500 --> 00:04:55,020 Now one thing here some people are thinking why I have not written computer move here because when the 62 00:04:55,890 --> 00:05:01,970 computer will not move on his move then the next move will be a player not with computer. 63 00:05:02,100 --> 00:05:05,820 So just focus on that one one more thing we also need a break here. 64 00:05:05,820 --> 00:05:07,950 Otherwise this will continue to work. 65 00:05:08,850 --> 00:05:12,830 So here we are done with this one that what will happen in that case. 66 00:05:13,020 --> 00:05:17,270 Now if we now we will check about the players winning. 67 00:05:17,290 --> 00:05:22,390 So this one is something like is we know with that they note. 68 00:05:23,610 --> 00:05:30,760 And then we have barometer ball and the value picks because the axis for user. 69 00:05:31,680 --> 00:05:39,450 So in that case now we cannot just directly right here like computer move and then print both here in 70 00:05:39,570 --> 00:05:44,580 this condition we have two conditions first just like the one then computer doesn't have to be then 71 00:05:44,580 --> 00:05:50,370 he moves that one is also full in this one that when the board is full. 72 00:05:50,370 --> 00:05:57,370 But we also had an undersea condition here sorry and it does index here that is for when the computer 73 00:05:57,720 --> 00:06:05,430 doesn't left with any moves you can or you can just move up with how that statement but that when is 74 00:06:05,550 --> 00:06:06,780 something more efficient. 75 00:06:07,380 --> 00:06:15,030 So we will define a move that will be computer move a variable that causes the output of computer move 76 00:06:15,930 --> 00:06:26,610 then if move if this one will be equal to zero like computer have no move left then we will just print 77 00:06:27,900 --> 00:06:36,180 something like a game and this is the reason we get twice the take game because when we have all the 78 00:06:36,180 --> 00:06:41,970 board full then the next move will be off the computer and the computer men get to zero moves it will 79 00:06:41,970 --> 00:06:48,720 again print taking if you do not want double take him just leave it empty and then you will get a single 80 00:06:48,720 --> 00:06:57,630 take him if you notice there we have twice to take him so hidden here else in the US condition we will 81 00:06:57,630 --> 00:07:05,070 just do the insert letter that is the same like the user input that we have done there. 82 00:07:06,090 --> 00:07:16,230 So here we have the insert letter oh and position will be move because insert letter as we have to Panama 83 00:07:16,300 --> 00:07:24,360 does so always focus on parameters otherwise you get error in that case we will also pin things like 84 00:07:24,360 --> 00:07:42,850 computer blazed and all on position and then we have move that will be the position of that and these 85 00:07:42,850 --> 00:07:53,890 dots there make it at is it'll interface friendly after that we will again in the updated mode and that's 86 00:07:53,890 --> 00:07:55,770 it. 87 00:07:55,810 --> 00:07:57,250 Now they're done with that. 88 00:07:57,670 --> 00:08:00,460 Just one thing here. 89 00:08:01,240 --> 00:08:02,590 Like when the user will. 90 00:08:03,130 --> 00:08:14,480 So here with this if we have another else that will be like print and something like not so different 91 00:08:14,520 --> 00:08:24,820 is you win and that did and then we have a break. 92 00:08:24,940 --> 00:08:30,930 So this is a main logical program and I hope you understand this one because this one is not much typical. 93 00:08:31,090 --> 00:08:37,720 And I believe it's very easy that there are only two possible condition like whether someone win or 94 00:08:37,720 --> 00:08:38,500 not. 95 00:08:38,500 --> 00:08:44,560 So when the computer doesn't win we have the players move a device they lose if the user doesn't feed 96 00:08:44,620 --> 00:08:46,150 then the computer have move. 97 00:08:46,220 --> 00:08:50,800 Otherwise we've won and then we have a condition in which board is full or not. 98 00:08:51,670 --> 00:08:54,370 So here we are done with this one also. 99 00:08:54,640 --> 00:09:00,830 And now just the interfaces left that we will end in the next review. 100 00:09:00,910 --> 00:09:01,990 So thanks for watching. 101 00:09:01,990 --> 00:09:03,150 I will see in the next video.