Question: Implement the ConnectFour ( int , int ) constructor, ensure it's written with good code style, then test it by writing a few lines of

Implement the ConnectFour(int, int) constructor, ensure it's written with good code style, then test it by writing a few lines of code in the cs1302.game.ConnectFourTester class to make sure the constructor only throws an exception when the board size is too large/too small. Also, your code should print out the instance variables of the ConnectFour object to make sure they are consistent with the diagrams in this document.
There are a few example test methods given in ConnectFourTester.java. However, those methods are not currently called from the main method. The provided tests are meant to test the full gameplay which requires all methods to be implemented. We will revisit this in a later step below.
Implement the getRows() and getCols() methods, ensure they are written with good code style, then test them by adding test code to the cs1302.game.ConnectFourTester class in a manner that is consistent with your constructor test code. You will want to, at a minimum, print out the return value from valid calls to getRows and getCols along with the instance variables from the ConnectFour object to make sure they are consistent.
Repeat this process to implement, check code style, and test the remaining methods in the order that they appear in the ConnectFour.java starter code.
As mentioned in the comments in ConnectFourTester.java, the provided tests do not cover all of the input scenarios that need to be tested. You should add methods to test additional scenarios. Please note that you can also test your code using the cs1302.game.ConnectFourCLI class and by using input redirection as discussed in class.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!