I finished writing the winning conditions(which took way too long), now all I need to do is optimize it and specify who wins or if print if there is a tie. If I were to make a loop I think I would use .indexOf or maybe .inArray.
http://students.gctaa.net/~snicholakos/webgraphics/tactactoe_new.html
Congratulations on getting it to work! It won't take nearly as long the next time you do something like this (and if you keep programming, you *will* do lots of things like this). That's the beauty of it - you are acquiring transferable skills through this exercise. It's well worth all the effort.
ReplyDeleteNext week you should try the following:
1. Create a function named checkForWinner(board) that you pass the board (the array) to and that returns whether or not there is a winner.
2. Once you have this working, use this function in your program.