S SachGw Member Licensed User Longtime User Sep 11, 2011 #1 Hi Guys,I am having a bit of problem understanding the Logic in following piece of code from Tic Tac Toe example.Could anybody please explain me how the code works.. :sign0085: Code: Copy 'Check diagonals found = True For i = 0 To 2 found = found AND Buttons(i, i).Text = Player Next If found = True Then Return True found = True For i = 0 To 2 found = found AND Buttons(i, 2 - i).Text = Player Next If found = True Then Return True Return False
Hi Guys,I am having a bit of problem understanding the Logic in following piece of code from Tic Tac Toe example.Could anybody please explain me how the code works.. :sign0085: Code: Copy 'Check diagonals found = True For i = 0 To 2 found = found AND Buttons(i, i).Text = Player Next If found = True Then Return True found = True For i = 0 To 2 found = found AND Buttons(i, 2 - i).Text = Player Next If found = True Then Return True Return False
Widget Well-Known Member Licensed User Longtime User Sep 11, 2011 #2 There are 2 diagonals to check so there are two loops. The first loop checks for (0,0), (1,1), (2,2) The second loop checks for (0,2),(1,1),(2,0) Widget Upvote 0
There are 2 diagonals to check so there are two loops. The first loop checks for (0,0), (1,1), (2,2) The second loop checks for (0,2),(1,1),(2,0) Widget
S SachGw Member Licensed User Longtime User Sep 12, 2011 #3 Oh, now I understood it..thank you.. Upvote 0
H Hero post Member Licensed User Longtime User Feb 20, 2012 #4 What Button has been touched I want to use part of the tictactoe code for4 an app of mine, but I need to know what button has been clicked. I have three rows of buttons, but I am unclear on how to i:sign0104:dentify the button. Upvote 0
What Button has been touched I want to use part of the tictactoe code for4 an app of mine, but I need to know what button has been clicked. I have three rows of buttons, but I am unclear on how to i:sign0104:dentify the button.
Erel B4X founder Staff member Licensed User Longtime User Feb 20, 2012 #5 You should use the Sender keyword to get the button that raised the event. Upvote 0