HELP Figuring out if it's a TIE game.
Go to solution
Solved by Mira Yurizaki,
I'm sure if a certain someone saw this they would rant at you. So I'm going to mention it.
Do not mix your GUI code with business logic. That is, you shouldn't be evaluating the board based on the strings the elements you have are using. Use an array with values in it to figure out your results.
In any case, I remember doing a Tic Tac Toe game a while back as an exercise. The way I evaluated it was each spot was either empty (0), taken by player one (1) or take by player 2 (-1). It would then add the rows, columns, and diagonals. If anything summed up to 3, player 1 won, if anything summed up to -3, player 2 won. If it ran through all of the combinations without either or, it's a tie.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now