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

  Design the program so that it automatically counts

Label all output, and design the program so that it automatically counts the respondents.

  Write down program to arbitarily choose numbers

Write down a program to arbitarily select the numbers of 3 finalist to recieve a prize. Ensure not to choose same number twice. For instance picking finalist 3, 15, 29 woul valid but picking 3,3,31 would be invalid.

  Program where the computer plays against a human opponent

Write a function playExpert(marbles) that given a number of marbles returns the number of marbles that the computer will take following the expert mode rules.

  Write program to operate as point of sale application

Write down program which will operate as the point of sale (POS) application at carpet retailer. Carpet will be sold by square yard. Padding will be sold by square yard.

  Add comment lines for the different sections.

Add comment lines for the different sections.

  The use of the break statement in a switch statement

The use of the break statement in a switch statement is[A].optional[B].compulsory

  Create drawing application using gui components

Create drawing application (have look at Microsoft Paint application on your Windows system). Application should have menus.

  Program to store highest value using two-dimensional array

Write down a program which uses the two-dimensional array to store highest and lowest temperatures for each month of the year.

  Design an oracle that runs efficiently but may make mistakes

The clique problem itself is NP-hard. Thus you may not want to have an oracle that runs in exponential time. Think about approach to approximate the solution. In another word, design an oracle that runs efficiently but may make mistakes in some ca..

  Binary search algorithm to search an array

The binary search algorithm that follows may be used to search array when elements are in order. This algorithm is analogous to following approach for finding name in telephone book.

  Explain the importance of usability when designing a website

Explain the importance of usability when designing a website and develop a set of recommendations for website usability

  What is the standard terminal symbol for a flowchart

What might be considered the seventh step of the programming process?

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