http://www.ChristopherAdams.com - Developer in training.
OCUP UML fundamental and ITIL foundation
Jan Cumps wrote:Welcome, Chris!
http://www.ChristopherAdams.com - Developer in training.
salvin francis wrote:Welcome To code ranch Christopher. Thank you for sharing your code with us.
I havent tried out your program yet, but I have looked at your git code at
https://github.com/gitchrisadams/StartingOutJavaNotes/commit/2f2b43ea0a555ebe675a994953a0f5cfdb210c8a
A couple of points from my end :
1. You code benefit from Lists/Arrays instead of having 9 references to each button
2. A lot of code is repeated for Button1Listener ... Button9Listener, can you reduce it to one listener only?
3. You could benefit using loops in your determineWinner method (also note that the code for xWinner, oWinner is exactly the same and is repeated).
http://www.ChristopherAdams.com - Developer in training.
salvin francis wrote:Hi Christopher,
Its nice to see your answer, first of all, let's make some basic code changes.
This tells the programmer that you have a X or a Y or a BLANK value instead of 1 for x and 0 for y. These numbers are meaningful for you and not for any other programmers.
http://www.ChristopherAdams.com - Developer in training.
salvin francis wrote:Next, for re-using code, we can use inheritance...
So instead of using JButton we can use TicTacButton. This class also has its own row and col. The game array you made will contain the values for these rows, cols.
Now, lets compact your other code:
http://www.ChristopherAdams.com - Developer in training.