Computer Science Canada tic tac toe game |
Author: | GA [ Sun Mar 19, 2006 10:36 am ] |
Post subject: | tic tac toe game |
hey i know its not great, but i've only been programming java for a month and just wanted to know what u think |
Author: | GA [ Sun Mar 19, 2006 11:24 am ] |
Post subject: | |
tic tac toe |
Author: | MysticVegeta [ Sun Mar 19, 2006 1:38 pm ] | ||
Post subject: | |||
good pretty good for 1 month of programming. I would suggest: - Use loops for checking who wins instead of "if" because take a look at the following code:
You have just checked diagonally, but using the same loop you can check the inverse diagonal ![]() And then you would need just 2 more loops, 1 of them for 2 horizontals, 1 of them for 2 verticals. What the code does is checks for "X"s. if the string is not "X" then it returns false because they are not in a row ![]() - Error trapping, a char or string crahes the program |