Prog 2:Trinity

Create an interface so two players can take turns choosing from among 9 playing pieces ( (A,B,C,)   (1,2,3)   (a,b,c) ) to try and get 3 pieces of a particular kind in a row in a 3x3 board. Play alternates between the two players.  Pieces can only be used once, and cannot be moved once played. Three in a row of a particular kind can be achieved by any of the following three possibilities:

[This game was created on 1/19/16 by Dale Reed and Pat Troy.]

Running your program will look something like what is shown below, where user input is shown in bold:

Program #2: Trinity Author: Dale Reed Lab: Tues 5am Date: January 22, 2016 System:  DevC++ on Windows 10

Welcome to Trinity, the game where there's three ways to get three in a row, in one of three rows or columns, or diagonals.  Play alternates between the two players. On each move select any available piece and an open board destination location.  A winning configuration is three of the same set in a row (e.g. b a c, A B C  or 3 2 1),  all 3 from the same set position (e.g. A 1 a,  B 2 b or c 3 C), or three in a row where each is a  different set member (1st, 2nd, 3rd) such as 2 A c, a B 3 or C 1 b.  

------------------------------------ Pieces available to play:

  A B C    1 2 3    a b c                 -----------   Positions: |   |   |   |    1  2  3 |-----------| |   |   |   |    4  5  6 |-----------| |   |   |   |    7  8  9  ----------- 1. Player 1 enter piece and position: A1

------------------------------------ Pieces available to play:

    B C    1 2 3    a b c                 -----------   Positions: | A |   |   |    1  2  3 |-----------| |   |   |   |    4  5  6 |-----------| |   |   |   |    7  8  9  ----------- 2. Player 2 enter piece and position: 26 

------------------------------------ Pieces available to play:

    B C    1   3    a b c                 -----------   Positions: | A |   |   |    1  2  3 |-----------| |   |   | 2 |    4  5  6 |-----------| |   |   |   |    7  8  9  ----------- 3. Player 1 enter piece and position: A2 *** Piece A is not available. Please retry: B6 *** Location 6 is already taken. Please retry: C8 

------------------------------------ Pieces available to play:

    B      1   3    a b c                 -----------   Positions: | A |   |   |    1  2  3 |-----------| |   |   | 2 |    4  5  6 |-----------| |   | C |   |    7  8  9  ----------- 4. Player 2 enter piece and position:

. . .

You need to know the following concepts in order to write this program:

Handling user input and output; Using functions with parameters; How to break down a bigger problem into smaller problems that are more manageable.

Notes / Grading:

Turning In Your Program

The name of the program you will turn in should be prog2 followed by your netid and the .cpp file extension.  In other words, if your netid is reed then your program would be called prog2reed.cpp     You must also zip up the file you turn in.  After zipping your program (e.g. prog2reed.cpp), you will likely end up with a file called something like prog2reed.zip.   Only turn in this single file, turning it in on Blackboard into the assignment Program2: Trinity.  Failing to follow these naming conventions and failure to turn in a zip file will result in a 5 point deduction, even if everything else is perfect in your program. 

Extra Credit

(up to 10 points) Play the game against a smart computer opponent.  Submit this into the "Program 2: Extra Credit" Assignment in Blackboard.  Extra credit program versions may not be submitted late.