Beruflich Dokumente
Kultur Dokumente
Solution
Conclusion
26 November 2016
Mr. Chew Chun Yong, Ms. Choo Ley Ya VBA Programming Workshop - Tic Tac Toe
Introduction
Solution
Conclusion
Table of contents
1 Introduction
2 Solution
3 Conclusion
Mr. Chew Chun Yong, Ms. Choo Ley Ya VBA Programming Workshop - Tic Tac Toe
Introduction
Solution
Conclusion
Mr. Chew Chun Yong, Ms. Choo Ley Ya VBA Programming Workshop - Tic Tac Toe
Introduction
Solution
Conclusion
How to do it?
Mr. Chew Chun Yong, Ms. Choo Ley Ya VBA Programming Workshop - Tic Tac Toe
Introduction
Solution
Conclusion
Before Code It
We can simplify the problem and plan the steps by doing this:
Imagine that two of your friends are playing tic tac toe, and
you are helping them to draw on paper. So what do you need
to do/take note?
You need to identify whose turn now.
You need to help to identify is any of them win.
Similarly, we need to tell VBA how to recognize which player’s
turn now and the winning criteria (VBA is now taking over
your role).
Mr. Chew Chun Yong, Ms. Choo Ley Ya VBA Programming Workshop - Tic Tac Toe
Introduction
Solution
Conclusion
Before Code It
You can do these two things in Excel first, then VBA only
read the info from worksheet.
This would be easier to visualize what we are doing.
And lastly, VBA will be only doing putting ”O” or ”X” into
worksheet.
Try it out.
Mr. Chew Chun Yong, Ms. Choo Ley Ya VBA Programming Workshop - Tic Tac Toe
Introduction
Solution
Conclusion
Conclusion
Mr. Chew Chun Yong, Ms. Choo Ley Ya VBA Programming Workshop - Tic Tac Toe
Introduction
Solution
Conclusion
Conclusion
You can try doing tic tac toe that you can play against PC.
That means you need to have an algorithm to play as second
player.
Or, you can try to make ”Ultimate Tic Tac Toe”.
A good website that has collection of problems to practice
your math and programming:
https://projecteuler.net/
Mr. Chew Chun Yong, Ms. Choo Ley Ya VBA Programming Workshop - Tic Tac Toe