Noughts & Crosses [WIP]

Game i'm working on, this is what i have so far, in future i'm going to add an auto feature to recognise when someone has won.

Also i'm going to program a AI to play against.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    int xGo = 1, oGo = 0; 
    char board[3][3] = //board[2][2] is max
    {
        {'I','I','I'},
        {'I','I','I'},
        {'I','I','I'}
    };
    
    cout << "Welcome to Noughts and Crosses. \n\nDo no distribute. \nCopyright of Paramount Games.\n\n\n";
    
    while(main != 0)
    {          // X Player
        while(xGo == 1)
        {
            cout << board[2][0] << " " << board[2][1] << " "<< board[2][2] << "\n";
            cout << board[1][0] << " " << board[1][1] << " "<< board[1][2] << "\n";
            cout << board[0][0] << " " << board[0][1] << " "<< board[0][2] << "\n\n";
            cout << "'X' Playes turn\n\n";
            
            //board[2][1] = 'X';
            
            cout << "Pick a co-ordinate: ";
            int rowX, colX;
            
            cin >> colX;
            cout << ", ";
            cin >> rowX;
            
            if(board[rowX-1][colX-1] == 'I')
            {        
                /*col = col - 1;
                row = row - 1;*/
                board[rowX-1][colX-1] = 'X';
                
                xGo = 0;
                oGo = 1;
            }
            else
            {
                cout << "Please enter co-ordinates that aren't already taken\n\n";
                xGo = 1;
                oGo = 0;
            }
        }
                 // O Player
        while(oGo == 1)
        {
            cout << board[2][0] << " " << board[2][1] << " "<< board[2][2] << "\n";
            cout << board[1][0] << " " << board[1][1] << " "<< board[1][2] << "\n";
            cout << board[0][0] << " " << board[0][1] << " "<< board[0][2] << "\n\n";
            cout << "'O' Playes turn\n\n";
            
            //board[2][1] = 'X';
            
            cout << "Pick a co-ordinate: ";
            int rowO, colO;
            
            cin >> colO;
            cout << ", ";
            cin >> rowO;
            
            if(board[rowO-1][colO-1] == 'I')
            {        
                /*col = col - 1;
                row = row - 1;*/
                board[rowO-1][colO-1] = 'O';
                
                xGo = 1;
                oGo = 0;
            }
            else
            {
                cout << "Please enter co-ordinates that aren't already taken\n\n";
                xGo = 0;
                oGo = 1;
            }
        }
    }
    
    system("PAUSE");
    return 0;
}

Did you need help with something?
Topic archived. No new replies allowed.