Project Deliverable 3 Personal Software Process Psp1 Javadoc Exception Handling

I need help with this assignment:

Project Deliverable 3 Personal Software Process (PSP1, JavaDoc, Exception Handling) Points: 50 —————————————————————————————————-

Instructions:

This assignment has to be completed by each student individually. NO COLLABORATION IS ALLOWED. Submit the following: YourASURiteID-ProjectDeliverable3.zip This compressed folder should contain the following files: 1. Connect4.java (Game Logic Module) 2. Connect4TextConsole.java (Console-based UI to test the game) 3. Connect4ComputerPlayer.java (logic to play against computer; generate computer moves) 4. JavaDoc documentation files (index.html and all other supporting files such as .css and .js files generated by the tool). Submit the entire folder. 5. Completed Time Log, Estimation worksheet, Design form, Defect Log, and Project Summary provided at the end of this assignment description 6. A few screen shots showing test results of your working game and answers to reflection questions written inline in this document 7. Readme file (optional: submit if you have any special instructions for testing)

—————————————————————————————————-

Connect4 Game: Connect4 is a 2-player turn-based game played on a vertical board that has seven hollow columns and six rows. Each column has a hole in the upper part of the board, where pieces are introduced. There is a window for every square, so that pieces can be seen from both sides. In short, it´s a vertical board with 42 windows distributed in 6 rows and 7 columns. Both players have a set of 21 thin pieces (like coins); each of them uses a different color. The board is empty at the start of the game. The aim for both players is to make a straight line of four own pieces; the line can be vertical, horizontal or diagonal.

Reference: https://en.wikipedia.org/wiki/Connect_Four —————————————————————————————————-

Program Requirements: To the previously developed Java-based Connect4 game, add a module to “play against the computer”. Can you take a look at my source code and give me a good starting point and help in how to finish it as a separate class called Connect4ComputerPlayer.java in the core package that generates the moves for the computer player. The logic to automatically generate computer moves does NOT have to be sophisticated AI algorithm. A naïve algorithm to generate the moves is sufficient for this assignment.

• Continue to make use of good Object-Oriented design • Provide documentation using Javadoc and appropriate comments in your code.

• Generate HTML documentation using Javadoc tool • Make sure you provide appropriate Exception Handling throughout the program (in the previously created classes as well)

Sample UI as shown in the figures below. 

| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Begin Game. Enter ‘P’ if you want to play against another player; enter ‘C’ to play against computer.

>>C

Start game against computer. It is your turn. Choose a column number from 1-7. 4 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |X| | | |

and so on..

—————————————————————————————————-

Personal Process: Follow a good personal process for implementing this game. You will be using PSP1 in this assignment. So, in addition to tracking your effort and defects you will have to estimate the effort and defects for the “play against computer” module as well as adding exception handling to previously created classes.

Here’s my code:

import java.util.Scanner;

 public class connect4

 {

   public static void main(String[] args)

   {

       Scanner in = new Scanner(System.in);

       char[][] grid = new char[6][7];

       for (int row = 0; row < grid.length; row++)

       {

           for (int col = 0; col < grid[0].length; col++)

           {

               grid[row][col] = ‘ ‘;

           }

       }

       int turn = 1;

       char player = ‘X’;

       boolean winner = false;     

       while (winner == false && turn <= 42)

       {

           boolean validPlay;

           int play;

           do {

               display(grid);

               System.out.print(“Player ” + player + “, Choose a column number from 1-7: “);

               play = in.nextInt();

               validPlay = validate(play,grid);

           }while (validPlay == false);

           for (int row = grid.length-1; row >= 0; row–)

           {

               if(grid[row][play] == ‘ ‘)

               {

                   grid[row][play] = player;

                   break;

               }

           }

           winner = isWinner(player,grid);

           if (player == ‘X’){

               player = ‘O’;

           }else{

               player = ‘X’;

           }

           turn++;         

       }

       display(grid);

       if (winner){

           if (player==’X’)

           {

               System.out.println(“Black won”);

           }else

           {

               System.out.println(“Red won”);

           }

       }else

       {

           System.out.println(“Tie game”);

       }

   }

   public static void display(char[][] grid)

   {

       System.out.println(” 0 1 2 3 4 5 6″);

       System.out.println(“—————“);

       for (int row = 0; row < grid.length; row++)

       {

           System.out.print(“|”);

           for (int col = 0; col < grid[0].length; col++)

           {

               System.out.print(grid[row][col]);

               System.out.print(“|”);

           }

           System.out.println();

           System.out.println(“—————“);

       }

       System.out.println(” 0 1 2 3 4 5 6″);

       System.out.println();

   }

   public static boolean validate(int column, char[][] grid)

   {

       if (column < 0 || column > grid[0].length)

       {

           return false;

       }

       if (grid[0][column] != ‘ ‘)

       {

           return false;

       }

       return true;

   }

   public static boolean isWinner(char player, char[][] grid)

   {

       for(int row = 0; row<grid.length; row++)

       {

           for (int col = 0;col < grid[0].length – 3;col++)

           {

               if (grid[row][col] == player  &&

                   grid[row][col+1] == player &&

                   grid[row][col+2] == player &&

                   grid[row][col+3] == player)

               {

                   return true;

               }

           }         

       }

       for(int row = 0; row < grid.length – 3; row++)

       {

           for(int col = 0; col < grid[0].length; col++)

           {

               if (grid[row][col] == player  &&

                   grid[row+1][col] == player &&

                   grid[row+2][col] == player &&

                   grid[row+3][col] == player)

               {

                   return true;

               }

           }

       }

       for(int row = 3; row < grid.length; row++)

       {

           for(int col = 0; col < grid[0].length – 3; col++)

           {

               if (grid[row][col] == player  &&

                   grid[row-1][col+1] == player &&

                   grid[row-2][col+2] == player &&

                   grid[row-3][col+3] == player)

               {

                   return true;

               }

           }

       }

       for(int row = 0; row < grid.length – 3; row++)

       {

           for(int col = 0; col < grid[0].length – 3; col++)

           {

               if (grid[row][col] == player  &&

                   grid[row+1][col+1] == player &&

                   grid[row+2][col+2] == player &&

                   grid[row+3][col+3] == player)

               {

                   return true;

               }

           }

       }

       return false;

   }

 }

Duepapers
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.