CSCI.UA0101: Homework 5

Section 001: 50 points
Section 002: 40 points + 5 bonus

Updates: None

Instructions:
Answer the questions stated in the following exercises by submitting plain-text or Java source code (.txt and .java extensions respectively) as stated in the exercises through NYU Classes. No word (.doc/.docx/etc.) or rich-text (.rtf) files please (in your text editor do "Save file as plain-text"). Java programs should be just the Java source code (not your .class files or Eclipse workspaces) unless otherwise stated.

In all files submitted include a documentation header using comments which include:

/**
 * [Description of the program]
 * @author: [Your Name]
 */

Points will be deducted for bad coding style (up to 25% of your grade), so:

For more details regarding good coding style guidelines see the grading criteria.

Part 1

40 points

Complete programming exercise 7.9 from the text (tic-tac-toe).

Your program should protect against the following situations:

You do not need to protect against the user inputting a string or anything other than an integer input.

Save and submit your program (just the source code) as TicTacToe.java.

Part 2

Required for honors students - 5 points
Bonus for regular students - 2.5 points

Update your code from Part1 so that the user is allowed to input the size of the playing board. Any square board size between 2x2 and 10x10 should allowed. The number of positions in a row/column/diagonal to win should always be the size of the board.

Part 3

Required for honors students - 5 points
Bonus for regular students - 2.5 points

Update your code from Part1 so that the user has the option to play a 1 player game against the computer as well.