CMSC 201
Project Two - Output
|
The following is new output generated on irix2
If you run your program in test mode and use a seed of 7, then
your output should match mine exactly. This is not true of play
mode, however.
TEST MODE: Human Win - horizontal
irix2[72]% a.out
Let's play Connect 4 !
Put your greeting and instructions here
This game will run in either test or play mode.
- Test mode is used while you are writing and debugging
your code and for grading (Uses a seed input by the player)
- Play mode is used after you have finished your project
and really want to play the game (Uses a random seed)
Which mode would you like to use:
1 - Test
2 - Play
Enter your choice: 1
Please enter a positive integer to be used as the
seed for the random number generator : 7
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 5
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | O | | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 7.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | O | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 6
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 7.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 4
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 5.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | X | | X |
|---|---|---|---|---|---|---|
| | | | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 3
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | X | | X |
|---|---|---|---|---|---|---|
| | | O | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
YOU WIN !!!
irix2[73]%
TEST MODE: Human Win - vertical
irix1[72]% a.out
Let's play Connect 4 !
Put your greeting and instructions here
This game will run in either test or play mode.
- Test mode is used while you are writing and debugging
your code and for grading (Uses a seed input by the player)
- Play mode is used after you have finished your project
and really want to play the game (Uses a random seed)
Which mode would you like to use:
1 - Test
2 - Play
Enter your choice: 1
Please enter a positive integer to be used as the
seed for the random number generator : 7
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 2
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | O | | | | | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 7.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | O | | | | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 2
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | O | | | | | |
|---|---|---|---|---|---|---|
| | O | | | | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 7.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | O | | | | | X |
|---|---|---|---|---|---|---|
| | O | | | | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 2
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | O | | | | | |
|---|---|---|---|---|---|---|
| | O | | | | | X |
|---|---|---|---|---|---|---|
| | O | | | | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 5.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | O | | | | | |
|---|---|---|---|---|---|---|
| | O | | | | | X |
|---|---|---|---|---|---|---|
| | O | | | X | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 2
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | O | | | | | |
|---|---|---|---|---|---|---|
| | O | | | | | |
|---|---|---|---|---|---|---|
| | O | | | | | X |
|---|---|---|---|---|---|---|
| | O | | | X | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
YOU WIN !!!
irix1[73]%
TEST MODE: Human Win -
diagonally (upper left to lower right)
irix1[72]% a.out
Let's play Connect 4 !
Put your greeting and instructions here
This game will run in either test or play mode.
- Test mode is used while you are writing and debugging
your code and for grading (Uses a seed input by the player)
- Play mode is used after you have finished your project
and really want to play the game (Uses a random seed)
Which mode would you like to use:
1 - Test
2 - Play
Enter your choice: 1
Please enter a positive integer to be used as the
seed for the random number generator : 7
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 5
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | O | | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 7.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | O | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 5
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | O | | |
|---|---|---|---|---|---|---|
| | | | | O | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 7.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | O | | X |
|---|---|---|---|---|---|---|
| | | | | O | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 6
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | O | | X |
|---|---|---|---|---|---|---|
| | | | | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 5.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | X | | |
|---|---|---|---|---|---|---|
| | | | | O | | X |
|---|---|---|---|---|---|---|
| | | | | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 4
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | X | | |
|---|---|---|---|---|---|---|
| | | | | O | | X |
|---|---|---|---|---|---|---|
| | | | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 2.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | X | | |
|---|---|---|---|---|---|---|
| | | | | O | | X |
|---|---|---|---|---|---|---|
| | X | | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 4
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | X | | |
|---|---|---|---|---|---|---|
| | | | O | O | | X |
|---|---|---|---|---|---|---|
| | X | | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 3.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | X | | |
|---|---|---|---|---|---|---|
| | | | O | O | | X |
|---|---|---|---|---|---|---|
| | X | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 4
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | O | X | | |
|---|---|---|---|---|---|---|
| | | | O | O | | X |
|---|---|---|---|---|---|---|
| | X | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 6.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | O | X | | |
|---|---|---|---|---|---|---|
| | | | O | O | X | X |
|---|---|---|---|---|---|---|
| | X | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 3
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | O | X | | |
|---|---|---|---|---|---|---|
| | | O | O | O | X | X |
|---|---|---|---|---|---|---|
| | X | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 3.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | X | O | X | | |
|---|---|---|---|---|---|---|
| | | O | O | O | X | X |
|---|---|---|---|---|---|---|
| | X | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 3
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | O | | | | |
|---|---|---|---|---|---|---|
| | | X | O | X | | |
|---|---|---|---|---|---|---|
| | | O | O | O | X | X |
|---|---|---|---|---|---|---|
| | X | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
YOU WIN !!!
irix1[73]%
TEST MODE: Human Win -
diagonally (lower left to upper right)
irix1[72]% a.out
Let's play Connect 4 !
Put your greeting and instructions here
This game will run in either test or play mode.
- Test mode is used while you are writing and debugging
your code and for grading (Uses a seed input by the player)
- Play mode is used after you have finished your project
and really want to play the game (Uses a random seed)
Which mode would you like to use:
1 - Test
2 - Play
Enter your choice: 1
Please enter a positive integer to be used as the
seed for the random number generator : 7
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 1
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| O | | | | | | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 7.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| O | | | | | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 2
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| O | O | | | | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 7.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| O | O | | | | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 2
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | O | | | | | X |
|---|---|---|---|---|---|---|
| O | O | | | | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 5.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | O | | | | | X |
|---|---|---|---|---|---|---|
| O | O | | | X | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 4
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | O | | | | | X |
|---|---|---|---|---|---|---|
| O | O | | O | X | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 2.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | X | | | | | |
|---|---|---|---|---|---|---|
| | O | | | | | X |
|---|---|---|---|---|---|---|
| O | O | | O | X | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 4
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | X | | | | | |
|---|---|---|---|---|---|---|
| | O | | O | | | X |
|---|---|---|---|---|---|---|
| O | O | | O | X | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 3.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | X | | | | | |
|---|---|---|---|---|---|---|
| | O | | O | | | X |
|---|---|---|---|---|---|---|
| O | O | X | O | X | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 3
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | X | | | | | |
|---|---|---|---|---|---|---|
| | O | O | O | | | X |
|---|---|---|---|---|---|---|
| O | O | X | O | X | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 6.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | X | | | | | |
|---|---|---|---|---|---|---|
| | O | O | O | | | X |
|---|---|---|---|---|---|---|
| O | O | X | O | X | X | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 3
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | X | O | | | | |
|---|---|---|---|---|---|---|
| | O | O | O | | | X |
|---|---|---|---|---|---|---|
| O | O | X | O | X | X | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 3.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | X | | | | |
|---|---|---|---|---|---|---|
| | X | O | | | | |
|---|---|---|---|---|---|---|
| | O | O | O | | | X |
|---|---|---|---|---|---|---|
| O | O | X | O | X | X | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 6
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | X | | | | |
|---|---|---|---|---|---|---|
| | X | O | | | | |
|---|---|---|---|---|---|---|
| | O | O | O | | O | X |
|---|---|---|---|---|---|---|
| O | O | X | O | X | X | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 4.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | X | | | | |
|---|---|---|---|---|---|---|
| | X | O | X | | | |
|---|---|---|---|---|---|---|
| | O | O | O | | O | X |
|---|---|---|---|---|---|---|
| O | O | X | O | X | X | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 4
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | X | O | | | |
|---|---|---|---|---|---|---|
| | X | O | X | | | |
|---|---|---|---|---|---|---|
| | O | O | O | | O | X |
|---|---|---|---|---|---|---|
| O | O | X | O | X | X | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
YOU WIN !!!
irix1[73]%
TEST MODE: Computer Win - vertically
irix1[72]% a.out
Let's play Connect 4 !
Put your greeting and instructions here
This game will run in either test or play mode.
- Test mode is used while you are writing and debugging
your code and for grading (Uses a seed input by the player)
- Play mode is used after you have finished your project
and really want to play the game (Uses a random seed)
Which mode would you like to use:
1 - Test
2 - Play
Enter your choice: 1
Please enter a positive integer to be used as the
seed for the random number generator : 7
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 6
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | O | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 7.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 5
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 7.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 2
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | O | | | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 5.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | X | | X |
|---|---|---|---|---|---|---|
| | O | | | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 4
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | X | | X |
|---|---|---|---|---|---|---|
| | O | | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 2.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | X | | | X | | X |
|---|---|---|---|---|---|---|
| | O | | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 4
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | X | | O | X | | X |
|---|---|---|---|---|---|---|
| | O | | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 3.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | X | | O | X | | X |
|---|---|---|---|---|---|---|
| | O | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 1
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | X | | O | X | | X |
|---|---|---|---|---|---|---|
| O | O | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 6.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | X | | O | X | X | X |
|---|---|---|---|---|---|---|
| O | O | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 1
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| O | X | | O | X | X | X |
|---|---|---|---|---|---|---|
| O | O | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 3.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| O | X | X | O | X | X | X |
|---|---|---|---|---|---|---|
| O | O | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 1
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| O | | | | | | |
|---|---|---|---|---|---|---|
| O | X | X | O | X | X | X |
|---|---|---|---|---|---|---|
| O | O | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 4.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| O | | | X | | | |
|---|---|---|---|---|---|---|
| O | X | X | O | X | X | X |
|---|---|---|---|---|---|---|
| O | O | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 2
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| O | O | | X | | | |
|---|---|---|---|---|---|---|
| O | X | X | O | X | X | X |
|---|---|---|---|---|---|---|
| O | O | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 6.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| O | O | | X | | X | |
|---|---|---|---|---|---|---|
| O | X | X | O | X | X | X |
|---|---|---|---|---|---|---|
| O | O | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 2
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | O | | | | | |
|---|---|---|---|---|---|---|
| O | O | | X | | X | |
|---|---|---|---|---|---|---|
| O | X | X | O | X | X | X |
|---|---|---|---|---|---|---|
| O | O | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 1.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| X | O | | | | | |
|---|---|---|---|---|---|---|
| O | O | | X | | X | |
|---|---|---|---|---|---|---|
| O | X | X | O | X | X | X |
|---|---|---|---|---|---|---|
| O | O | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 1
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| O | | | | | | |
|---|---|---|---|---|---|---|
| X | O | | | | | |
|---|---|---|---|---|---|---|
| O | O | | X | | X | |
|---|---|---|---|---|---|---|
| O | X | X | O | X | X | X |
|---|---|---|---|---|---|---|
| O | O | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 7.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| O | | | | | | |
|---|---|---|---|---|---|---|
| X | O | | | | | |
|---|---|---|---|---|---|---|
| O | O | | X | | X | X |
|---|---|---|---|---|---|---|
| O | X | X | O | X | X | X |
|---|---|---|---|---|---|---|
| O | O | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 1
|---|---|---|---|---|---|---|
| O | | | | | | |
|---|---|---|---|---|---|---|
| O | | | | | | |
|---|---|---|---|---|---|---|
| X | O | | | | | |
|---|---|---|---|---|---|---|
| O | O | | X | | X | X |
|---|---|---|---|---|---|---|
| O | X | X | O | X | X | X |
|---|---|---|---|---|---|---|
| O | O | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 3.
|---|---|---|---|---|---|---|
| O | | | | | | |
|---|---|---|---|---|---|---|
| O | | | | | | |
|---|---|---|---|---|---|---|
| X | O | | | | | |
|---|---|---|---|---|---|---|
| O | O | X | X | | X | X |
|---|---|---|---|---|---|---|
| O | X | X | O | X | X | X |
|---|---|---|---|---|---|---|
| O | O | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 5
|---|---|---|---|---|---|---|
| O | | | | | | |
|---|---|---|---|---|---|---|
| O | | | | | | |
|---|---|---|---|---|---|---|
| X | O | | | | | |
|---|---|---|---|---|---|---|
| O | O | X | X | O | X | X |
|---|---|---|---|---|---|---|
| O | X | X | O | X | X | X |
|---|---|---|---|---|---|---|
| O | O | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 7.
|---|---|---|---|---|---|---|
| O | | | | | | |
|---|---|---|---|---|---|---|
| O | | | | | | |
|---|---|---|---|---|---|---|
| X | O | | | | | X |
|---|---|---|---|---|---|---|
| O | O | X | X | O | X | X |
|---|---|---|---|---|---|---|
| O | X | X | O | X | X | X |
|---|---|---|---|---|---|---|
| O | O | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
I WON !!!
Better luck next time
irix1[73]%
TEST MODE: Error Checking &
Computer Win - horizontally
irix1[72]% a.out
Let's play Connect 4 !
Put your greeting and instructions here
This game will run in either test or play mode.
- Test mode is used while you are writing and debugging
your code and for grading (Uses a seed input by the player)
- Play mode is used after you have finished your project
and really want to play the game (Uses a random seed)
Which mode would you like to use:
1 - Test
2 - Play
Enter your choice: 1
Please enter a positive integer to be used as the
seed for the random number generator : 7
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 0
There is no column 0
Valid column numbers are 1 to 7
Play your piece in which column: 8
There is no column 8
Valid column numbers are 1 to 7
Play your piece in which column: -1
There is no column -1
Valid column numbers are 1 to 7
Play your piece in which column: 7
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 7.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 7
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 7.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 7
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 5.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | X | | O |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 7
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | X | | O |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 2.
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | X | | | X | | O |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 7
Column 7 is already full
Play your piece in which column: 6
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | X | | | X | O | O |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 3.
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | X | X | | X | O | O |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 6
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | O | X |
|---|---|---|---|---|---|---|
| | X | X | | X | O | O |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 6.
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | | X | O |
|---|---|---|---|---|---|---|
| | | | | | O | X |
|---|---|---|---|---|---|---|
| | X | X | | X | O | O |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 5
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | | X | O |
|---|---|---|---|---|---|---|
| | | | | O | O | X |
|---|---|---|---|---|---|---|
| | X | X | | X | O | O |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 3.
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | | X | O |
|---|---|---|---|---|---|---|
| | | X | | O | O | X |
|---|---|---|---|---|---|---|
| | X | X | | X | O | O |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 5
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | O | X | O |
|---|---|---|---|---|---|---|
| | | X | | O | O | X |
|---|---|---|---|---|---|---|
| | X | X | | X | O | O |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 4.
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | O |
|---|---|---|---|---|---|---|
| | | | | | | X |
|---|---|---|---|---|---|---|
| | | | | O | X | O |
|---|---|---|---|---|---|---|
| | | X | | O | O | X |
|---|---|---|---|---|---|---|
| | X | X | X | X | O | O |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
I WON !!!
Better luck next time
irix1[73]%
PLAY MODE: Human Win - vertically
Remember - Your output probably will not match mine in play mode.
What are the odds that it will match ? If you understand how you
are manipulating the random numbers returned by the call to rand()
then you should have no problem answering this question.
irix2[80]% a.out
Let's play Connect 4 !
Put your greeting and instructions here
This game will run in either test or play mode.
- Test mode is used while you are writing and debugging
your code and for grading (Uses a seed input by the player)
- Play mode is used after you have finished your project
and really want to play the game (Uses a random seed)
Which mode would you like to use:
1 - Test
2 - Play
Enter your choice: 2
A random seed was set
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 4
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | O | | | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 6.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | O | | X | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 5
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | O | O | X | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 3.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | X | O | O | X | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 4
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | O | | | |
|---|---|---|---|---|---|---|
| | | X | O | O | X | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 5.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | O | X | | |
|---|---|---|---|---|---|---|
| | | X | O | O | X | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 4
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | O | | | |
|---|---|---|---|---|---|---|
| | | | O | X | | |
|---|---|---|---|---|---|---|
| | | X | O | O | X | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 2.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | O | | | |
|---|---|---|---|---|---|---|
| | | | O | X | | |
|---|---|---|---|---|---|---|
| | X | X | O | O | X | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 4
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | O | | | |
|---|---|---|---|---|---|---|
| | | | O | | | |
|---|---|---|---|---|---|---|
| | | | O | X | | |
|---|---|---|---|---|---|---|
| | X | X | O | O | X | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
YOU WIN !!!
PLAY MODE: Computer win
diagonally (upper left to lower right)
irix2[81]% a.out
Let's play Connect 4 !
Put your greeting and instructions here
This game will run in either test or play mode.
- Test mode is used while you are writing and debugging
your code and for grading (Uses a seed input by the player)
- Play mode is used after you have finished your project
and really want to play the game (Uses a random seed)
Which mode would you like to use:
1 - Test
2 - Play
Enter your choice: 2
A random seed was set
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 5
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | O | | |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 7.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | O | | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 6
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 6.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | X | |
|---|---|---|---|---|---|---|
| | | | | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 4
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | X | |
|---|---|---|---|---|---|---|
| | | | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 3.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | X | |
|---|---|---|---|---|---|---|
| | | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 5
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | O | X | |
|---|---|---|---|---|---|---|
| | | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 5.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | X | | |
|---|---|---|---|---|---|---|
| | | | | O | X | |
|---|---|---|---|---|---|---|
| | | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 4
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | X | | |
|---|---|---|---|---|---|---|
| | | | O | O | X | |
|---|---|---|---|---|---|---|
| | | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 1.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | X | | |
|---|---|---|---|---|---|---|
| | | | O | O | X | |
|---|---|---|---|---|---|---|
| X | | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 4
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | O | X | | |
|---|---|---|---|---|---|---|
| | | | O | O | X | |
|---|---|---|---|---|---|---|
| X | | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 6.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | O | X | X | |
|---|---|---|---|---|---|---|
| | | | O | O | X | |
|---|---|---|---|---|---|---|
| X | | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 3
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | O | X | X | |
|---|---|---|---|---|---|---|
| | | O | O | O | X | |
|---|---|---|---|---|---|---|
| X | | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 1.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | O | X | X | |
|---|---|---|---|---|---|---|
| X | | O | O | O | X | |
|---|---|---|---|---|---|---|
| X | | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's your turn.
Play your piece in which column: 3
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | O | O | X | X | |
|---|---|---|---|---|---|---|
| X | | O | O | O | X | |
|---|---|---|---|---|---|---|
| X | | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
It's my turn and I choose column 4.
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | | | | |
|---|---|---|---|---|---|---|
| | | | X | | | |
|---|---|---|---|---|---|---|
| | | O | O | X | X | |
|---|---|---|---|---|---|---|
| X | | O | O | O | X | |
|---|---|---|---|---|---|---|
| X | | X | O | O | O | X |
|---|---|---|---|---|---|---|
1 2 3 4 5 6 7
I WON !!!
Better luck next time
irix2[82]%