mainOthello.cpp 848 Bytes
Newer Older
Jason Riggs's avatar
Jason Riggs committed
1
2
3
4
5
#include <iostream> // For cin and cout 
using namespace std;


int main() {
Jason Riggs's avatar
Jason Riggs committed
6
    int seed = 0; 
Jason Riggs's avatar
Jason Riggs committed
7
    
Jason Riggs's avatar
Jason Riggs committed
8
9
10
    // Seeding random number genrator 
    cout << "Please enter a random seed: ";
    cin >> seed;
Jason Riggs's avatar
change    
Jason Riggs committed
11
    srand(seed); 
Jason Riggs's avatar
Jason Riggs committed
12
    
Jason Riggs's avatar
change    
Jason Riggs committed
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
    bool winner = false;
    int turn = 1;
    
    // ask for difficulty level
    
    
    
    
    
    // start the game
    displayBoard board;
    board.start();
    
    // loop until finish
    do {
        board.printBoard();
        cout << "Enter the (X,Y) coordinates of where you would like to place a chip: " ;
        int x,y;
        
        cin >> x >> y;
        
        if (turn == 1) {
            board.playerMove1(x,y);
            turn++;
        } else if (turn == 2) {
            board.playerMove2(x,y);
            turn--;
        }
    } while (winner == false);    
Jason Riggs's avatar
Jason Riggs committed
42
    
Jason Riggs's avatar
Jason Riggs committed
43
    
Jason Riggs's avatar
Jason Riggs committed
44
45
    return 0;
}