Prog 3: Pop Out

Write a program to play the game Pop Out, itself a variant of the game Connect 4. It is similar to tic-tac-toe, only you have to get 4 in a row. Furthermore, imagine that the board is "standing up," so that as you play each piece, it falls down as far as possible in the column in which it was played. The game is played on a board with 6 rows and 7 columns.  If a player has the bottom-most piece in a particular column, then instead of playing a new piece the player can select a column and remove their bottom piece, resulting in all the other pieces in that column sliding down one position.

You may work with a partner on this program.  If you choose to do this you must:

Running your program will look like the following, except you should have your own name and TA information. The boldfaced text is something that you type in.

Author: Dale Reed Assignment: #3, Pop Out TA: Edmund Hillary, Sat 1:00-1:05  Welcome to the game of Pop Out.  Choose a column in which to move and  try to get four pieces in a row, either horizontally, diagonally, or vertically. At any point you may enter 'x' to exit the program. Your moves will be marked by an 'X', and the computer's moves by an 'O'. If a player has a piece in the bottom row for a column, entering a  letter 'A'..'G' removes that bottom piece, sliding the remaining  pieces in that column down by one for a player.  --------------- | | | | | | | |  | | | | | | | |  | | | | | | | |  | | | | | | | |  | | | | | | | |  | | | | | | | |  ---------------  1 2 3 4 5 6 7 <- place piece  A B C D E F G <- remove piece  1. Enter column for X to play -> 4   --------------- | | | | | | | |  | | | | | | | |  | | | | | | | |  | | | | | | | |  | | | | | | | |  | | | |X| | | |  ---------------  1 2 3 4 5 6 7 <- place piece  A B C D E F G <- remove piece  2. Enter column for O to play -> 4   --------------- | | | | | | | |  | | | | | | | |  | | | | | | | |  | | | | | | | |  | | | |O| | | |  | | | |X| | | |  ---------------  1 2 3 4 5 6 7 <- place piece  A B C D E F G <- remove piece  3. Enter column for X to play -> 3   --------------- | | | | | | | |  | | | | | | | |  | | | | | | | |  | | | | | | | |  | | | |O| | | |  | | |X|X| | | |  ---------------  1 2 3 4 5 6 7 <- place piece  A B C D E F G <- remove piece  4. Enter column for O to play -> 5   . . .   --------------- | | | | | | | |  | | | | | | | |  | | | |O| | | |  | | | |X| | | |  |X|X|X|O|O| | |  |O|X|X|X|O|O|O|  ---------------  1 2 3 4 5 6 7 <- place piece  A B C D E F G <- remove piece  15. Enter column for X to play -> A Sorry, you can only remove your own piece.  Please retry.  15. Enter column for X to play -> D   --------------- | | | | | | | |  | | | | | | | |  | | | | | | | |  | | | |O| | | |  |X|X|X|X|O| | |  |O|X|X|O|O|O|O|  ---------------  Four in a row, X wins!

Exiting program...

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

Everything from previous programs; reading input as a string; methods (including return values and parameters)

Details & Hints: