Displays the contents of the board array

Assignment Help Programming Languages
Reference no: EM131298852

Design a program that allows two players to play a game of tic tac toe. Use a two dimensional Stringarray with three rows and three columns as the game board. Each element of the array should be initialized with an asterisk (*). The program should run a loop that does the following:

Displays the contents of the board array.

Allows player 1 to select a location on the board for an X. The program should ask the user to enter the row and column number (or can use another suitable method for move selection).

Allows player 2 to select a location on the board for an O. The program should ask the user to enter the row and column number (or can use another suitable method for move selection).

Determines whether a player has won or if a tie has occurred. If a player has won, the program should declare that the player the winner and end. If a tie has occurred, the program should say so and end.

Player 1 wins when there are three X's in a row on the game board. Player 2 wins when there are three O's in a row on the game board. The winning X's or O's can appear in a row, column, or diagonally across the board. A tie occurs when all of the locations on the board are full, but there is no winner.

Reference no: EM131298852

Questions Cloud

Nonpecuniary cost of legislation : Based on this information, what would be the nonpecuniary cost of legislation that would place a $1.50 cap on the fees banks can charge for noncustomer transactions?
Read the table of contents of the two books : Read the table of contents of the two books, Simulation of Communication Systems by Jeruchim, Balaban, and Shanmugan, and Simulation Techniques by Gardner and Baker.
Recreational marijuana in colorado : What are the economic impacts of recreational marijuana in Colorado?
What is the labor-force participation rate : Suppose instead that 30 million jobs are created, attracting 20 million new people into the labor force. What would be the new rates for labor-force participation and unemployment?
Displays the contents of the board array : Displays the contents of the board array. Allows player 1 to select a location on the board for an X. The program should ask the user to enter the row and column number (or can use another suitable method for move selection).
Summarize given tutorial articles dealing with simulation : Read and summarize the following tutorial articles dealing with simulation:-  W. H. Tranter and K. L. Kosbar, "Simulation of Communication Systems," IEEE Communications Magazine, July 1994, pp. 26-36.
What will happen to per capita gdp : What is the labor-force participation rate in Adirolf?For questions c through f: assume that 15 million Adirolfian homemakers begin seeking jobs and that 10 million find jobs.
Efficiency of tax system and the equity of tax system : Analyze the difference between the efficiency of a tax system and the equity of a tax system as it refers to the costs imposed on taxpayers using the benefits principles.
Evaluate a budgeting system at any governmental level : Evaluate a budgeting system at any governmental level. Analyze the scope and sequence of budgeting in terms of sources of revenues, purpose of government expenditures, budget cycles, budget preparation, and debt administration

Reviews

Write a Review

Programming Languages Questions & Answers

  Draw the class diagram for your modi ed system

Explain what is wrong. Modify the system so that it conforms to the pattern. Explain each of the changes you made to the system. Draw the class diagram for your modi ed system.

  Javascript program that will read a message string

Write a JavaScript program that will read a message string and a number from text boxes on a Web page. The program will then use those values to display some information to the user.

  Write a program that computes the monthly gross pay

The owners of the Super Supermarket would like to have a program that computes the monthly gross pay of their employees as well as the employee's net pay.

  Create two objects p and q and generate 10 random numbers

Create Two objects P and Q. in object P the array a is type int and size 10, in Q array a is string type and size 12b. Generate 10 random numbers

  Identify at least two advantages to using oop

Use the Internet to research the advantages, features, and common examples of OOP and EDP. Note: You may use the Association for Computing Machinery (ACM) Digital Library to support research on the above topics.

  Write pseudocode and flowchart for program

Write pseudocode and flowchart for program that will prompt the user for a number, prompt the user for an operator (+,-,*,/).

  Write the required lines of code

Write the required lines of code that will create a ServerSocket object with a port number 3421 on which the server program is going to listen for client communications. Write the required lines of code that will create a new socket object

  Complete the program that solves the eight queens problem

Complete the program that solves the Eight Queens problem. The program's output should look similar to:

  Write a method named maxelement

Write a method named maxElement, which returns the largest value in an array that is passed as an argument. The method should use recursion to find the largest element. Demonstrate the method in a program.

  Create method to generate random integers

Create a method named posNeg which generates 1000 random integers. Range of numbers must be from -5 to +5 inclusive.

  Draw flowchart or write psuedocode to represent logic

Draw a flowchart or write psuedocode to represent the logic of a program that alllows the user to enter three values . The values rpesent hourly pay rate.

  Design program which models worms behavior

Design a program that models the worms behavior in the following scenario: A worm is moving toward an apple. Each time it moves, the worm cuts the distance between itself and the apple.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd