Reference no: EM131344123
Program: Tic Tac Toe
Write a program that will allow two users to play tic-tac-toe. The program should ask for moves alternatively from player X and player O. The display should be board-like:
1 2 3
4 5 6
7 8 9
The players enter their moves by entering a number corresponding to the place to be marked. After each move, the program displays the changed board. After several moves the board may look like this:
X X O
4 5 6
O 8 9
You will write a class called Game. The class will have as a data member
1) an array of size 9, type char, called board
It should also have the following member functions:
A constructor that takes no parameters but initializes the game board to 1 through 9
A function that displays the game board. Remember that after ever 3 elements, it should print a new line so that the board displays as shown above. The board needs to be displayed before every move.
A function called play that will take in at least one parameter of either X or O, depending on which player's turn it is. Additionally, you could add the parameter of the move that player entered (or you could ask for the input within this function). The main purpose of this function is to modify the game board. It must check that only 1 through 9 has been entered, that the space the user has chosen is not yet taken, and then change the game board accordingly. It is up to you to give the player another turn or to pass to the next player if they have chosen an incorrect space.
A function called checkWin, which checks to see if there are any winners. In tic-tac-toe, you win with all of the same marker across, down, or diagonal. You may want this to be a Boolean function.
If you would like to add more data members or functions, you may do so, but the 5 above are required.
Examine ways that cultural expressions influence daily life
: Examine the ways that cultural expressions influence your daily life. You are welcome to use images in this Assignment, however, the written content needs to be at least 750 words
|
Concept of discount rate-weighted average cost of capital
: What is the general intention behind the Truth-in-Lending law? List three requirements under this regulation. Explain the concept of a discount rate and the weighted average cost of capital. Provide a detailed overview of the top-down, three-step ap..
|
Create a literature review incorporating each of references
: Create a literature review, incorporating each of your references (minimum of five), tying them to each other and to the thesis of your project in a single narrative. You should cite each source in the body of your literature review and in a refer..
|
Determine the distance x locating the weight a
: The self-regulating floodgate ABC, pinned at B, is pressed against the lip of the spillway at C by the action of the 3645-lb weight A. If the gate is to open when the water level reaches a height h = 6 ft, determine the distance x locating the wei..
|
Write program that will allow two users to play tic-tac-toe
: BIS 320- Write a program that will allow two users to play tic-tac-toe. The program should ask for moves alternatively from player X and player O.
|
Develop a plan to reduce driving under the influence
: For your selected age group, develop a plan to reduce driving under the influence. The plan could include (but not be limited to) educational, legislative, and community support; and social advertising. Present at least three action points in your..
|
Find the smallest wind load q that would cause the structure
: Compute the magnitudes of the reactions at A and B if the wind load on the billboard is q = 120 lb/ft.
|
Theories of lamers and kubler-ross
: Imagine that you are a hospice volunteer and are helping late adult, terminally ill patients and their families. Use the theories of Lamers and Kubler-Ross to help you and the families better understand and deal with their circumstances
|
What are the desirable attributes
: What are the desirable attributes of a successful portfolio manager? What was the problem with the early performance measures and how have the modern composite portfolio performance measures overcome this problem
|