CS 135 Final Project - Spring 2006 Advanced Connect Four Problem

Connect Four is a two-player board game in which the objective is to be the first to get four of one's ... (20 pts) Computer turn incorporates “smart” move selection.
29KB taille 6 téléchargements 227 vues
CS 135 Final Project - Spring 2006 Advanced Connect Four Your assignment for the remainder of the semester is to design and implement a variation of a game Connect Four. Your task is to write a program to play a game of Advanced Connect Four. Have fun with it! Here are a couple of sites where you can play the game: • http://www.amazon.com/exec/obidos/ASIN/B00000IWI1/102-4612508-6997707 click on [Play (see it in action)] button • http://www.mathsisfun.com/games/connect4.html Basic Connect Four Rules: Connect Four is a two-player board game in which the objective is to be the first to get four of one's own discs in a line. The game is played on a board with 7 columns and 6 rows, which is placed in a vertical position. The players have 21 discs each, distinguished by color. The players take turns in dropping discs in one of the non-full columns. The disc then occupies the lowest unoccupied square on that column. A player wins by placing four of their own discs consecutively in a line (horizontal, vertical or diagonal), which ends the game. The game ends in a draw if the board is filled completely without any player winning.

Advanced Connect Four Rules: For the purposes of this Final Project the following modification will be made to the basic game. User will be able to customize the number of columns C and number of rows R on the board. Consequently, the number of disks each player will receive at the beginning of the game will change to (C*R)/2 if C*R is even or (C*R)/2+1 if C*R is odd. The maximum size of the board is 20 x 20.

Problem description: The main operation of the program: 1. Allow the user to continuously play games until he chooses to quit the program. 2. Allow person vs. person, person vs. computer play and computer vs. computer play. Each game allows for: • play of a new game or previously saved game • announcing the winner or a tie at the end of the game • computer moves can be randomly selected 3. Save a partially played game 4. Quit a game in play When a new game is started the player will select the desired size of the board, number of human players, symbols for their disks and who goes first.

Extra Credit It is possible to earn extra credit when writing this program!! The extra credit will only be checked if the other requirements of the program are fully functional. The extra credit must be fully functional and fully documented in the code and documentation for it to be graded. The grader will not search for it. The extra credit is as follows: • •

(20 pts) Allow user to specify the number of pieces to be connected in order to win. Therefore, a player can play a game of Connect Three, Connect Five, etc ... (20 pts) Computer turn incorporates “smart” move selection o a search of possible moves is examined to find one of the “best” to make instead of just random selection of a valid move

General Requirements 1.

2. 3. 4. 5.

6. 7.

8. 9. 10. 11.

No global variables are to be used (a grade of 0 will be given if used) Note: global constants are OK, for example max number of rows and columns of the game board. No string library use (a grade of 0 will be given if used) No intentional infinite loops (a grade of 0 will be given if used) Only one exit (return statement) from each function. The program must include a minimum of 10 functions (a grade of 0 will be given for less than 10 functions). The only action main function should perform is to call support functions. The submitted program must compile regardless of its state of completion (50% loss of grade for not compiling) The code must include comments (a brief description of each function as well as brief comments that allow one to follow your code w/out reading it line for line) (50% loss of grade for no, or meaningless, comments) E-mail submissions of documentation or code will not be accepted. Make a copy of everything you are turning in including the write-up and .cpp file There are no office hours on May 10. No projects accepted after 1:00 on Wed., May 10. A grade of zero is given for all late projects.

Due Dates: Regardless of whether you are turning your project in before the due date or on the due date you must hand in your project to one of the TAs or Instructors. Do not leave it in the hall or slide it under the door!!! Design Document All sections: Friday, April 28 by 1:00 pm (TAs office – SEM 255A) 30% loss of credit if turned in 1:00 – 4:00 on April 28 (CSE office - SEM 242) Zero credit after 4:00 pm, April 28. Program code and documentation All sections: Wednesday, May 10 from 9:00 - 1:00 pm (TA office – SEM 255A) Note: There are no office hours for help on May 10. No late projects will be accepted. A grade of zero is given for all late projects.

Materials to turn in: Design Document (100 pts) The design document minimally needs: • To be neatly typed and in a bound notebook/folder • a cover page (name, class, section, topic) • a printout design segment grading outline(download from cs135 webpage) • a brief description of the requirements of the program from the programmers perspective • a detailed description of your overall design o for each function  a description of the purpose of the function  a list of each input/output parameter and its purpose  detailed pseudocode or detailed flowchart using the format presented in class or found in the optional pseudocode text. • no language specific (C++) code is to be included in your pseudocode • any additional supporting documentation you might find useful o Hierarchy charts, flow charts, etc. Program Code and Documentation (200 pts) The code should be submitted on diskette or CD. The .cpp file should be included. Include examples of input/output files. Please test that your code compiles and runs when copied off the diskette or CD. The documentation minimally needs: • to be neatly typed and in a bound notebook/folder • a cover page (name, class, section, topic) • a printout final project grading outline (download from cs135 webpage) • initial statement of which parts of the program work, which don’t… what the grader should expect to find while running your code. For any extra credit done, a description of what was completed. • a user’s manual describing the full use of the program • a reflection of the process you went through in writing this program o what you learned, what you would redo if you did it again, how you would improve it, how it could be extended • pseudocode for the program with modifications to previous design to reflect code handed in • a detailed section of test cases with display printouts illustrating the functionality of the program (this is usually quite extensive) • a listing of the program code • any additional supporting documentation you might find useful