Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSC310-01 Data Structures and Algorithm Analysis (Spring 2023) Assignment 2 Due Date: Monday, February 13, 2023 Extend the 3 by 3 Tic-Tac-Toe program in assignment

image text in transcribed
image text in transcribed
image text in transcribed
CSC310-01 Data Structures and Algorithm Analysis (Spring 2023) Assignment 2 Due Date: Monday, February 13, 2023 Extend the 3 by 3 "Tic-Tac-Toe" program in assignment \#1 to allow up to 6 players and any board size ( M by N ) including the following features: 1. The program would allow 3 and up to 6 human players. Each game is played by the SAME number of players once it starts 2. The program will capture player's full names (first name and last name separated by space(s)). A valid player's name consists of only alphabet letters. Players' names are entered one player at a time per line. 3. The first player's piece is " a ", the second player's piece is " b ", and so on. The fifth player's piece is "e". All pieces are lower case alphabets. The players keep their pieces throughout the game. 4. The players can specify the size of the board (up to 11 by 15) for EACH game. The number of rows and columns are input on separate prompts. Each game might have a different board size. The minimum size of the board is 3 by 3 . 5. Player with piece " c " starts the first game. The order of players will be in the round robin sequence "a", " b ", " c ", " d ", " e ", " f ", and then back to "a". Depending on the number of players, the round robin sequence might wrap around earlier before it reaches " e ". 6. The initial game board (example: 46 ) should exactly like the one below: 7. All players' names should be displayed in the format of starting with a capitalized letter and followed by all lower-case letters. 8. Only the first name of players is to be used in subsequent prompt messages (\#9 below). However, the full name will be used in displaying game statistics (\#14 below) 9. The program will prompt user's move accordingly using only the first name of the player. 10. A player's move is specified as row character (A.K, or a.k), followed by column 9. The program will prompt user's move accordingly using only the first name of the player. 10. A player's move is specified as row character (A..K, or a.. K), followed by column number (1..15), a single entry, e.g. D5, K12, b4, d6, etc. The row character can be upper case or lower case. 11. The program would redraw the board ONCE after each move. 12. A player wins the game if he has three of his pieces consecutively horizontally, vertically or diagonally;anywhere in the board, which is defined as a winning configuration. 13. If one player wins, ALL possible winning (NOT potential winning) configurations will be displayed on the board in upper case of his/her piece. All other pieces remain unchanged. 14. At the end of each game, the program would display the total number of games played and the number of games each player wins, loses and draws in a table form. The full names of the players are used in the statistic display and are aligned right, in the order of players entered the game. The number in the statistics also aligned right (assuming a maximum of 1000 games can be played any time. An example of such statistics is as below: 15. If a game ends with someone winning, the next game starts with the player AFTER the winner of the previous game in the round robin sequence, i.e. the winner of the previous game will be the last one in the next game. The round robin sequence is as described in \#5 16. If a game ends in a draw, the next game starts with the players after the previous game starter in the round robin sequence. 17. The program would allow multiple games to be played until the players select to quit at the end of any game. In addition, your program should account for all possible user input errors. You should use C++ for this assignment. You cannot call any library functions except In addition, your program should account for all possible user input errors. You should use C++ for this assignment. You cannot call any library functions except those dealing with 1/O and string handling functions. Sophisticated graphic display is NOT necessary, and it wouldn't get you extra points. All is required is a neat and reasonable user-friendly user interface. Your program should execute interactively on the machines in the department's lab. Please test your program thoroughly and make sure it is free of errors. Points will be deducted for each error that I discover for you. Please also pay attention to program design and follow all the good programming practice. I reserve the right to deduct points based on these criteria. Submit: Program design Hierarchical diagrams/ Structure charts Procedure specification Program listing Testing cases with Justification Results of test cases

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

12. What are their values? (ethical stance in society)

Answered: 1 week ago