CIS*2430 Assignment TwoThe Big PictureThis assignment consists of two separate tasks.1. Write a text-based Connect Four game using object-oriented Java. Your solution must be in your A2 git...

Programming in Java


CIS*2430 Assignment Two The Big Picture This assignment consists of two separate tasks. 1. Write a text-based Connect Four game using object-oriented Java. Your solution must be in your A2 git repos- itory and must be in standard gradle layout. Your A2 repository has been initialized with empty files. 2. Review your own code with respect to cohesion and coupling and produce a written report. You can clone your assignment repo in one of two ways using a terminal or command prompt: • git clone https://gitlab.socs.uoguelph.ca/2430f22/≪your username here≫/A2.git • With ssh + vpn: git clone [email protected]:2430f22/≪your username here≫/A2.git This assignment is intended to be independent work. Your submissions will be programatically inspected to identify possible plagiarism. Learning Outcomes Completion of this assignment will help you master the learning outcomes noted below. • Differentiate between procedural and object-oriented paradigms. • Design and implement classes for an object-oriented program demonstrating correct use of encapsulation, constructors, method overloading, class invariants, accessors, mutators, instance variables and class variables. Grading Assignment Grade Calculation: (TTT + CR)*PI Component Symbol Grade Range Marking Process Connect Four TTT 0.0-70.0 Instructional team member marks submission on their own schedule during grading period Code Review CR 0.0-30.0 Instructional team member marks submission on their own schedule during grading period Personal Interview PI 0.0-1.0 Students must schedule the interview with an instructional team member using the scheduler on the course website. Failure to at- tend an interview will result in a grade of 0.0 for this component. 1 Task Descriptions Part 1: Connect Four You will create a text-based Connect Four game. Connect Four is a popular children’s game that has a similar game mechanic to Tic Tac Toe. The first task for any software development is to ensure that you understand the domain. • An online version of Connect Four: https://papergames.io/en/connect4 • The game rules: https://www.gamesver.com/the-rules-of-connect-4-according-to-m-bradley-hasbro/ Game Features • Game Play: It is sufficient to allow player vs player using the same keyboard on a board that is 7 spaces wide and 6 tall. You are not required to create a computer player. The program may exit after one game has been played or it may allow the user to request another game. • Load/Save: Your program must allow the user to save a partially complete game board to a comma separated text file (csv). The program must load a correctly formatted csv file and allow the game to resume. Saving should be done at the request of the players, not automatically. Players must be able to provide the desired name of the save file. An example CSV file is provided for you in your A2 repo. In the CSV file a 1 represents player 1, a 2 represents player 2 and a 0 represents an empty position. Your program must be able to recover gracefully from improperly formatted files or files with incorrect contents. Classes Your Connect Four game must be text-based. It should reprint the board after each turn in the same fashion that the TicTacToe game did for A1. Instead of colours use two different ascii characters of your choosing. Your solution must have the following classes: • Board: The Board class is responsible for maintaining the state of the board (where the pieces are), for creating the string representation of the board that is printed for the user, and for checking for win conditions (four in a row). Your Board class must provide methods that hide the implementation details of the board from any classes using the Board class. The private member variable that models the board may be an array or some other data structure of your choosing. • TextUI: The TextUI class is entirely responsible for interacting with the user. It does all of the printing for the program and is the only class that takes user input. • ConnectFour: The ConnectFour class is responsible for managing the turns, calling Board methods to update the state, asking the Board whether a win has been detected and telling the TextUI what to print. The Connect- Four class is a class with instance methods and instance variables, but it will also contain the main method that is run to play the game. You may create as many additional classes as needed. All classes in your program should include a toString() method to facilitate printing of the class. Required Coding Constructs The following coding constructs must be present and used correctly in your solution. • Exceptions: The validation of user input must include the use of exceptions. The validation of the save file for the board must also include the use of exceptions. Create custom exception classes as needed to facilitate correct handling of incorrect and correct user input and files. You may use exceptions in any other parts of the code as well. • Testing: You will create test cases for all of the public, protected, and package private methods in the Board class and implement them as junit tests. You can skip methods that are simple accessor/mutator methods. The skeleton junit file is provided in your A2 repository and the gradle file is already set up to facilitate running of tests. 2 • Javadocs: Create a javadoc comment for each public method of the Board class that includes, as a minimum, method purpose, parameters and return values. Create a javadoc comment that is placed before the class definition for each class in your solution. It should include a description of the purpose of the class and an @author annotation that identifies you as the author of the file. Evaluation This section has been revised as of October 10 This portion of the assignment is graded out of 70 marks. Your submission must compile without errors or warnings and must pass checkstyle to be awarded a grade other than zero. 40 of the marks are for demonstrating good object oriented design. Elements examined will include: • cohesion of classes and encapsulation • coupling of classes and allocation of responsibility and purpose for classes and methods • use of exceptions and error handling • test cases and testing 30 of the marks are for the functionality. Elements examined will include: • game play • win and tie conditions • user experience (UX) including considerations such as clear, informative messages to user, predictability of UI, and ease of use of UI Coding Conventions and Formatting You are expected to follow the coding conventions for the class. This includes adhering to the google coding style specified by checkstyle, but also includes things like completing the README file, adhering to the correct file/folder structure, ensuring that your repository has no extra files or fold- ers, writing complete and informative javadoc comments as required, choosing informative names for variables, methods and constants, etc. Failure to meet these expectations will result in deductions from your overall mark. No more than 30 points will be deducted. Part 2: Code Review The code review portion of the assignment must be submitted via the dropbox on moodle as markdown file or as a pdf file. Provide answers to the following three questions in your code review. Clearly indicate which question is being answered. The CK metrics jar file may be useful to you in conducting this code review but its use is not required. https://github.com/mauricioaniche/ck 1. Describe the test cases you used to test the Board class. Use the table format that is describe in the e-text to list the test cases. Include reasons why you feel the test cases you selected are sufficient. 2. Discuss the techniques you have employed to ensure your classes are cohesive and explain why those tech- niques are effective. Alternatively, you may discuss changes you would make to increase cohesion. You may use diagrams, charts or metrics to support your argument. Use specific examples from your assignment. 3. Discuss the techniques you have employed to ensure that your Connect Four game is not excessively coupled and explain why those techniques are effective. Alternatively, you may discuss changes you would make to reduce coupling. You may use diagrams, charts or metrics to support your argument. Use specific examples from your assignment. Evaluation This portion of the assignment is graded out of 30 marks. Each of the code review sections is allocated 10 of the 30 marks. Marks are given for thoroughness, thoughtfulness and for demonstrating a solid understanding of the OO principles involved. Up to 10 marks will be deducted from the total for poor grammar or spelling. 3 Personal Interview Your personal interview will be conducted virtually by a member of the instructional team During the interview you will be asked questions about your assignment submission. Some of those questions may involve you imagining a different solution than the one you submitted. Your response to each question will be graded using a 5 point scale and an interview grade calculated from those responses. The interviewer is not responsible for the final calculation of the interview grade. 4
Apr 05, 2023
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here