Please help with WELL COMMENTED java code tic tac toe game using all guidelines below
This must be implemented using
Swing to create a graphical interface, and using the Graphics class for drawing the board, the markers, and line through the winning set of markers.
The design of the GUI is up to you, provided you have the following:
•a way for the user to select who goes first;
•a way for the user to select their marker ("X" or "O");
•a START button to begin the game;
•a way to indicate whose move it is, whether someone has won, and any other information you deem appropriate;
•a tic-tac-toe board drawn within the window;
•a way to detect mouse clicks inside the game board, and respond to them by drawing the user's marker in the selected square;
•a computer response when it is the computer's move;
•a way to automatically detect (and indicate on the game board) when someone has won; and
•a button to start a new game after the game ends.
Additionally, you should do all necessary sanity checking during the game. For example:
•the user should not be able to take two moves in a row without the computer moving in-between;
•the user should not be able to continue playing after the game has ended;
•only marks in valid, empty squares are allowed; and so on.