1 00:00:00,120 --> 00:00:02,520 All right, it's time to debug exercise number eight. 2 00:00:02,580 --> 00:00:03,090 Let's do it. 3 00:00:05,150 --> 00:00:10,850 So apparently we should be getting a right diagonal of OWS to imply that owns but instead if you run 4 00:00:10,850 --> 00:00:11,390 the code. 5 00:00:18,040 --> 00:00:19,900 We get a left diagonal of axis. 6 00:00:21,810 --> 00:00:25,350 So all we have to do is say X wins and we're done. 7 00:00:26,160 --> 00:00:27,030 I'm just kidding. 8 00:00:27,400 --> 00:00:32,250 I was supposed to win and there's something wrong with the code now going out a few break points. 9 00:00:37,730 --> 00:00:40,010 Launched the debugger and let's compare. 10 00:00:51,930 --> 00:00:57,660 So when I'm here, it's going to place an O at zero and two, which is fine, that's consistent. 11 00:01:01,290 --> 00:01:04,769 As well as an exact two and two, that's also consistent. 12 00:01:11,450 --> 00:01:13,230 Next run I equals one. 13 00:01:13,250 --> 00:01:16,670 It's going to place an O at one one, which is perfect. 14 00:01:22,550 --> 00:01:26,210 But then an ex is also going to go to one one replacing the oh. 15 00:01:26,990 --> 00:01:27,480 Hmm. 16 00:01:31,260 --> 00:01:34,650 OK, what if I just put this first, what would that do? 17 00:01:39,290 --> 00:01:40,430 Relaunched the debugger. 18 00:01:52,390 --> 00:01:54,340 It starts at two and two, that's fine. 19 00:01:56,510 --> 00:01:58,910 Always a zero and two, OK, good. 20 00:02:04,420 --> 00:02:08,470 Now maxes out one and one, which gets promptly replaced by oh. 21 00:02:14,530 --> 00:02:16,600 The next goes to zero and zero. 22 00:02:21,000 --> 00:02:22,410 Oh, goes to zero and two. 23 00:02:25,740 --> 00:02:27,660 And we get the expected output. 24 00:02:28,110 --> 00:02:35,150 Well, that was easy in this case, I didn't have to think or analyze the person's logic by using breakpoints. 25 00:02:35,170 --> 00:02:38,010 It was really easy to visualize what their bug was. 26 00:02:38,280 --> 00:02:42,000 And then by simply moving two lines of code around, it made all the difference. 27 00:02:42,570 --> 00:02:47,760 If you can't tell by now, I'm a very strong believer in using breakpoints to visualize the runtime 28 00:02:47,760 --> 00:02:48,540 line by line. 29 00:02:49,170 --> 00:02:51,150 OK, onto the next exercise.