Overview

The purpose of this lab two-fold. First, it will give students practice with 2D arrays. At least as importantly, though, no starter code has been provided, so students will need to start from scratch and think a little bit more about how to organize their code from the ground up. Therefore, this lab will worth 4 points instead of 2, and it will span 2 weeks.

The Game

Students will write a program that simulates a game of Tic-Tac-Toe. The Tic-Tac-Toe game is played on a 3x3 grid with two players who take turns. The first player marks moves with an X, and the second player marks moves with an O. The first player to form a horizontal, vertical, or diagonal sequence of three marks wins the game. Your program should do the following in order:

1. Draw the game board
2. As the user for the (zero-indexed) coordinates of the next mark, and record the appropriate mark at those coordinates
3. Change the players after every successful move
4. End the game and declare the winner once that happens, or declare that there has been a draw (i.e. the board has filled up with no winner)

Example Run

Slight variations on the input/output prompts are fine, but it should be clear to the user where they are in the game and what they need to input next.

 Welcome to Tic-Tac-Toe! Current Board: - - - - - - - - -  Player X Give Coordinates: 2, 2 Current Board: - - - - - - - - X  Player O Give Coordinates: 1,1 Current Board: - - - - O - - - X 

This back and forth should continue until someone wins or until there is a tie.

Code

You should have at least the five methods below in your code. You may create other methods to help you, but you need to have at least these

1. Create and initialize the board. You should definitely be returning a 2D array of some sort here.
2. Make the current user's move
3. Determine if there is a winner
4. Determine if there is a tie
5. Put everything together and play the game (this could possibly happen in a main, but for style, try not to have a sprawling main)