This is a Tic Tac Toe Project and I have to do it by tomorrow, need help fast.
Your program should:
1. Prompt the user to type in the state of the board, represented by 9 integers between 0 and 2.
2. Print a picture of the board to standard output.
3. Decide on a move for the X player. Only cells A, B, and C need to be considered.
4. Print out a description of X’s move, including the following pieces of information:
• the cell X moves to, as a letter A-I
• if this move lets X win, say that
• otherwise, if this move blocks O from winning, say that
5. Print out a picture of the board, including X’s move.
For full credit, your player must use the following strategy:
1. If X has any winning move available, it must take it.
2. Otherwise, if X can block O from winning, X must do so.
3. Otherwise, X can pick any empty cell among A, B, or C.
Sample input/output, should look something like this.
In the following example, X takes a winning move:
E n t e r b o a r d s t a t e a s 9 i n t e g e r s , 0 −2:
1 1 0 2 0 0 0 2 0
C u r r e n t b o a r d :
+−+−+−+
| 1 | 1 | 0 |
+−+−+−+
| 2 | 0 | 0 |
+−+−+−+
| 0 | 2 | 0 |
+−+−+−+
X moves t o C t o win ! New b o a r d :
+−+−+−+
| 1 | 1 | 1 |
+−+−+−+
| 2 | 0 | 0 |
+−+−+−+
| 0 | 2 | 0 |
+−+−+−+
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
#include<isostream>
#include <string>
using namespace std;
int main () {
int choice= 0;
int x=1;
char box1= '1';
char box2= '2';
return 0;
}
|
I'm not really sure how to start with the first few steps?