Need to fix this code for tc -tac-toe game ..
see the code below and fix it
#include <iostream>
using namespace std;
void display_board();
void player_turn();
bool gameover ();
char turn ;
bool draw = false;
char board [3][3] = { {'1', '2', '3'}, { '4', '5', '6'}, { '7',
'8', '9'}};
int main()
{
cout << " Lets play Tc- Tac- toe game " <<endl ;
cout << " Player 1 [X] ----- player 2 [0] " <<endl
<<endl;
while (!gameover())
{
display_board();
player_turn();
gameover();
}
if (turn =='0' && !draw) {
display_board();
cout<<endl <<"Congratulations! player_1 [X], you won
the game." ;
}
else if (turn == 'X' && !draw){
display_board();
cout <<endl<< "Congratulation ! player 2 [0], You won
the game. ";
}
else{
display_board();
cout<<endl << "game over.It's draw." ;
}
}
void display_board()
{
cout << "-------------" <<endl <<endl;
cout << " " << board[0][0] << "|" << board
[0][1] << "|" << board [0][2] << endl;
cout << "--|-|--" << endl;
cout << " " << board[1][0] << "|" << board
[1][1] << "|" << board [1][2] << endl;
cout << "--|-|--" << endl;
cout << " " << board[2][0] << "|" << board
[2][1] << "|" << board [2][2] << endl;
}
void player_turn (){
int choise;
int row =0, column =0;
if (turn == 'X'){
cout << "player 1 [X] turn: ";
}
else if (turn == 'O'){
cout << "player 2 [0] turn : ";
}
cin >> choise;
switch (choise)
{
case 1 : row = 0; column = 0; break;
case 2 : row = 0; column = 1; break;
case 3 : row = 0; column = 2; break;
case 4 : row = 1; column = 0; break;
case 5 : row = 1; column = 1; break;
case 6 : row = 1; column = 2; break;
case 7 : row = 2; column = 0; break;
case 8 : row = 2; column = 1; break;
case 9 : row = 2; column = 2; break;
default :
cout << "Invalid move ";
player_turn();
}
if (turn == 'X' && board[row][column] != 'X' &&
board[row][column] !='0' )
{
board[row][column] = 'X';
turn = '0';
}
else if (turn == '0' && board[row][column] != 'X'
&& board[row][column] !='0' )
{
board[row][column] = '0';
turn = 'X';
}
else{
cout << "The cell is already full" <<endl;
player_turn();
}
}
bool gameover()
{
for (int i=0; i<3; i++)
{
if (board [i][0] == board [i][1] && board [i][1]== board
[i][2] || board [0][i] == board [1][i] && board [0][i] ==
board [2][i] )
{
return true;
}
}
for (int i=0; i<3; i++)
{
for (int j=0; j<3; j++)
{
if (board [i][j] !='X' && board [i][j] != 'O')
{
return false;
}
}
}
draw = true;
return true;
}
In: Computer Science
Wins Rushing
10 2205
11 2096
11 1847
13 1903
10 1457
11 1848
10 1564
11 1821
4 2577
2 2476
7 1984
10 1917
9 1761
9 1709
6 1901
5 2288
5 2072
5 2861
6 2411
4 2289
3 2203
3 2592
4 2053
10 1979
6 2048
8 1786
2 2876
0 2560
1.What proportion of the variation in number of wins is explained by the opponent's rushing yards? Express your answer as a proportion (between 0 and 1) written to 3 decimal places.
2.What is the sample correlation coefficient r? Write your answer to 3 decimal places.
3.What is the slope for the line of best fit? Write your answer to three decimal places.
4.What is the y-intercept for the line of best fit, written to two decimal places? (Here it is technically the wins-intercept.)
5.Predict the number of wins for a team if the opponent's total rushing yards were 1800 yards. Round your answer to the nearest whole number.
In: Statistics and Probability
A random sample of size n = 55 is taken from a population with mean μ = −10.5 and standard deviation σ = 2. [You may find it useful to reference the z table.]
a. Calculate the expected value and the standard error for the sampling distribution of the sample mean. (Negative values should be indicated by a minus sign. Round "expected value" to 1 decimal place and "standard error" to 4 decimal places.)
b. What is the probability that the sample mean is less than −11? (Round “z” value to 2 decimal places, and final answer to 4 decimal places.)
c. What is the probability that the sample mean falls between −11 and −10? (Do not round intermediate calculations. Round "z" value to 2 decimal places and final answer to 4 decimal places.)
In: Statistics and Probability
You must fill out the table below, then you must find the values for a, b1 and b2, finally you must determine how much the profits would be if you invest 10 thousand dollars in advertising and if you increase it to 20 sellers. REMEMBER all the procedures and formulas should appear.
|
Y |
X1 |
X2 |
1 |
2 |
3 |
4 |
5 |
|
|
Year |
Sales $ |
promotion |
Sales person |
åX1 Y |
X12 |
X1 X2 |
X2Y |
X22 |
|
2017 |
18 |
2 |
2 |
|||||
|
2018 |
23 |
3 |
4 |
|||||
|
2019 |
50 |
4 |
6 |
|||||
|
2020 |
79 |
6 |
8 |
|||||
|
2021 |
82 |
9 |
10 |
|||||
|
2022 |
100 |
11 |
12 |
|||||
|
2023 |
130 |
13 |
14 |
|||||
|
2024 |
190 |
15 |
16 |
|||||
|
Total |
672 |
63 |
18 |
In: Accounting
Glover Industries received authorization on December 31, year 1, to issue $5,000,000 face value of 8%, 10-year bonds. The interest payment dates are June 30 and December 31. All the bonds were issued at par, plus accrued interest, April 1, Year 2. The bonds are callable by glover Industries at any time at 102.
1 Prepare the journal entry to record issuance of the bonds on April 1, Year 2.
2 Prepare the journal entry to record the first semiannual interest payment on the bonds at June 30, Year 2.
3 What is the amount of bond interest expense that appears in glover’s Year 2 income statement relating to these bonds?
4 What is the amount of accrued bond interest expense that appears in glover’s balance sheet at December 31, Year 2, with respect to these bonds?
In: Accounting
f(x)= 9x^4-2x^3-36x^2+8x/3x^3+x^2-14
-Factor the numerator and denominator of f(x) completely. -Write the domain of f(x) in interval notation. -Locate all hole(s), if any, and write them in the form of coordinate pairs. -Locate all vertical asymptote(s), if any, and give their equations in the form x = c. For each one, describe what happens to f(x) as x approaches c from the left(-), and as x approaches c from the right (+). -Locate the horizontal/slant asymptote, if any, and give its equation in the form y = b (or y = mx+b). -Locate all x- and y-intercepts of f(x), if any, and give as coordinate pairs. -Construct a sign diagram and use test points to determine on which intervals f(x) is positive and negative. -Use all of this information to draw a sketch of the graph. Label all asymptotes, holes, and intercepts, as well as axes and tick marks.
In: Advanced Math
1. The following data were obtained from 3 separate enzyme kinetic experiments using 3 different substrates S1, S2 and S3 forming products P1, P2 and P3 respectively. The amount of enzyme in each reaction is 1 µM. Find out the rate and graph the data using a Michaelis-Menton and Lineweaver-Burk plots and determine the values for Km, Vmax, Kcat, and Kcat/Km. Which among the 3 substrate is best substrate for this enzyme and why? (4 points)
[S] (mM) [P1] (mM) in 60 min [P2] (mM)
in 240 min [P3] (mM) in 30 min
2.5 0.170 0.126 0.194
2 0.201 0.135 0.213
1.5 0.167 0.129 0.206
1 0.162 0.131 0.203
0.6 0.159 0.135 0.174
0.3 0.148 0.131 0.163
0.15 0.122 0.111 0.122
0.2 0.095 0.117 0.114
0.1 0.075 0.072 0.104
0.05 0.049 0.040 0.071
2. Use the Michaelis-Menton Equation to calculate the missing values of [S] given below if Vmax = 5 mmol/min. Plot [S] versus V (NOT the reciprocals!). Draw line parallel to the x-axis at Vmax and extend your plotted line to show its approach to Vmax. (2 points)
[S] (mM) V0 (mmol/min)
10 1.2
[S]1 1.7
[S]2 2.1
[S]3 2.2
[S]4 2.5
3. Plot the below data and determine the type of inhibition of an enzymatic reaction by inspecting the graph (give an explanation) (2 points)
[S] (mM) V0 (mM/min) V0 with Inhibitor
present (mM/min)
1 1.3 0.8
2 2.0 1.2
4 2.8 1.7
8 3.6 2.2
12 4.0 2.4
4. Plot the below data with and without inhibitor (I) and determine the type of inhibition of an enzymatic reaction by inspecting the graph (2 points)
[S] µM V0 (µmol /min); [I] = 0 nM V0
(µmol /min); [I] = 25 nM V0 (µmol /min); [I] = 50
nM
0.4 0.22 0.21 0.20
0.67 0.29 0.26 0.24
1.00 0.32 0.30 0.28
2.00 0.40 0.36 0.32
In: Biology
COMPLETE IN EXCEL SHOWING EQUATIONS
Variable Growth Valuation Model Given:
Most recent annual cash flow (CFo) $1,000
Stage 1 annual growth rate (gt) 0.15
Stage 2 annual growth rate (gm) 0.05
Duration of stage 1 growth (years) 3
Required return (k) 0.10
Steps in solution:
1) Estimate future cash flows for the duration of the stage 1 growth period:
CF(0) = given $1,000
CF(1) = CF(0) * (1+gt) $1,150
CF(2) = CF(1) * (1+gt) $1,323
CF(3) = CF(2) * (1+gt) $1,521
2) Use EXCEL's built-in NPV function to find the present value of these cash flows.
RATE 0.10
NPV (rate, CF1:CF3) $3,281.09
3) Use the constant growth formula to estimate the value of the firm at the end of the rapid growth period (V3) where:
CF4 = CF3 (1+gm)
CF4 = $1,597
V3 = $1,597 / (0.10-0.05)
Ve = $31,938
4) Use EXCEL's built-in PV function to find the present value of the amount determined in step 3.
FV $31,938
RATE 0.10
NPER 3
PV ($23,996)
(You may ignore the negative sign for this answer. Recall that EXCEL mandates that the amounts entered for PV and FV must have opposite signs.)
5) Add the amounts found in step 2 (the PV of the rapid growth cash flows ) and step 4 (the PV of the normal growth cash flows).
PV of rapid growth cash flows $3,281
PV of normal growth cash flows $23,996
value of the firm $27,277
In: Finance
|
Magnum Construction Company, Inc. bought equipment for $2,250,000 on Jan. 1, 2014. |
||||||
|
The company considered various depreciation methods for financial reporting purposes |
||||||
|
(pro-rated by month). The company estimates the equipment will have a useful life of |
||||||
|
10-years with a residual value of $140,000. For tax purposes the asset falls into the |
||||||
|
seven-year category. |
||||||
|
Hours |
||||||
|
Estimated total hours of usage |
50,000 |
|||||
|
Actual usage |
2014 |
5,500 |
||||
|
2015 |
6,000 |
|||||
|
2016 |
4,500 |
|||||
|
Instructions |
||||||
|
Calculate the following: |
||||||
|
a |
Assuming the straight-line method is used: |
|||||
|
(1) The depreciation expense for the year ended Dec. 31, 2014 |
||||||
|
(2) The book value of the assets as of December 31, 2015 (2nd year) |
||||||
|
(3) The depreciation expense for the nine-month period ending Sept. 30, 2016 |
||||||
|
(4) The gain or loss if the asset is sold on Sept. 30, 2016 for --------> |
$1,700,000 |
|||||
|
b |
Assuming double declining balance is used: |
|||||
|
(1) The depreciation expense for the year ended Dec. 31, 2014 |
||||||
|
(2) The book value of the assets as of December 31, 2015 (2rd year) |
||||||
|
(3) The depreciation expense for the nine month period ending Sept. 30, 2016 |
||||||
|
(4) The gain or loss if the asset is sold on Sept. 30, 2016 for --------> |
$1,700,000 |
|||||
|
c |
Assuming sum of the years digits is used: |
|||||
|
(1) The depreciation expense for the year ended Dec. 31, 2014 |
||||||
|
(2) The book value of the assets as of December 31, 2015 (2rd year) |
||||||
|
(3) The depreciation expense for the nine month period ending Sept. 30, 2016 |
||||||
|
(4) The gain or loss if the asset is sold on Sept. 30, 2016 for --------> |
$1,700,000 |
|||||
|
d |
Assuming units of output is used: |
|||||
|
(1) The depreciation expense for the year ended Dec. 31, 2014 |
||||||
|
(2) The book value of the assets as of December 31, 2015 (2rd year) |
||||||
|
(3) The depreciation expense for the nine month period ending Sept. 30, 2016 |
||||||
|
(4) The gain or loss if the asset is sold on Sept. 30, 2016 for --------> |
$1,700,000 |
|||||
|
e |
The tax basis (undepreciated cost) the asset as of December 31, 2017 |
|||||
|
f |
The taxable gain or loss if the asset is sold on Dec. 31, 2017 for ----> |
$852,900 |
||||
|
MACRS tax depreciation rates |
||||||
|
Asset classification |
||||||
|
Year |
5-year |
7-year |
||||
|
1 |
20.00% |
14.29% |
||||
|
2 |
32.00% |
24.49% |
||||
|
3 |
19.20% |
17.49% |
||||
|
4 |
11.52% |
12.49% |
||||
|
5 |
11.52% |
8.93% |
||||
|
6 |
5.76% |
8.92% |
||||
|
7 |
8.93% |
|||||
|
8 |
4.46% |
|||||
In: Accounting
Which of the following enzymes involved in cell cycle progression is a phosphatase?
|
a)Cdc2 |
||
|
b)Cdk 4/6 |
||
|
c)Cdc25 |
||
|
d)CAK |
||
|
e)Wee 1 |
1 points
QUESTION 2
Which of the following steps activates MPF for G2 to M phase transition ?
|
a)Dephosphorylation of Cdc2 |
||
|
b)Phosphorylation of Cdk 4/6 |
||
|
c)Phosphorylation of Cdc25 |
||
|
d)Phosphorylation of CAK |
||
|
e)Dephosphorylation of Wee 1 |
1 points
QUESTION 3
Which of the following enzymes involved in G2 to M phase transition inactivates MPF?
|
a)Cdc2 |
||
|
b)Cdk4/6 |
||
|
c)Cdc25 |
||
|
d)CAK |
||
|
e)Wee 1 |
1 points
QUESTION 4
Which of the components of MPF is responsible for the actual phase transition of G2 to M?
|
a)Cdc2 |
||
|
b)Cyclin E |
||
|
c)Cdk4/6 |
||
|
d)Cdc25 |
||
|
e)Cyclin B |
1 points
QUESTION 5
Which of the following morphologies would be correct for a cell in which CAK were inactivated?
|
A |
||
|
B |
||
|
C |
||
|
D |
In: Biology