Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java Submit vour .Java file to Blackboard. CSC 222 Program 4 Topics: methods, global variables In this program, you will practice writing methods and

In Java

image text in transcribed

Submit vour .Java file to Blackboard. CSC 222 Program 4 Topics: methods, global variables In this program, you will practice writing methods and using global variables by creating a text-based Tic-tactoe game. You will still need to know how to write loops, if or switch statement. In this game, two players X and O plays against each other. The goal is to win by placing a sequence of three X or three O. The sequence can be a row, a column, or a diagonal. The game is a tie when all the cells are taken by there's no winning sequence. By default, X is the first player. The game starts by asking the current player to make a move. The program checks to see if the move is a winning move. If the current player wins or the game is a tie, the program displays the appreciate message and ask if they user want to start another game. The user specifies his or her move by entering the row and the column of the cell on the board. For example, if the user wants to place the move on the top left cell, he/she would enter 11 at the prompt. Below is the board with the rows and columns for each cell. The user should not be able to place the move on a cell that is already taken by the user or the opponent. If the user attempts to place a move on a cell that's taken, the game won't allow the move and will ask the user to make the move again. See sample run to understand the program logic. Below are the methods and what they do. You will need to complete the methods for the program to work. My suggestion is to build it bottom up. Start with being able to display the board, clearing the board, placing X or O on the board. Once that's done, you can create the main logic which would presents the board to the user, ask the user to make a move, and displaying the board again and rotating the player. Once that's working, you can then check for winner or for a tie

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions

Question

What are the different techniques used in decision making?

Answered: 1 week ago

Question

Describe the new structures for the HRM function. page 676

Answered: 1 week ago