$29
Aim: Write a program to handle the basics of a two-player game of Tic-Tac-Toe.
Requirement: Design the project using OOP in Java!
Let’s get started!
o Create a directory structure to hold your work for this course and all the subsequent labs:
▪ Suggestion: CS202/Lab2
Introduction
o Tic-tac-toe is a paper-&-pencil game for two players, X and O, who take turns marking the spaces in a 3×3 grid.
o The player who succeeds in placing three respective marks in a horizontal, vertical, or diagonal row wins the
game.
o The following example game is won by the second player, O:
Game Simplified:
o Need to design two versions of the game: Two players or Player Vs. Computer
◦ The player always moves first and is X. The computer is O.
◦ The only tricky part about the game is determining if a given person has won.
o Play continues until one player has scored three in a row or all squares have been filled with no winner.
o The players can play in only those squares that are not already occupied by either player.
o The program ends when the game is won by either player or the game is a draw.
Suggestions:
o Whenever/wherever possible, your program should have classes that imitate real world objects
o Interaction between classes should only occur using the methods!
o Use Scanner class to Input the user’s selection of letters.
o First get a simple two player version of your game correct!! Then try the Computer Vs. Player version.
o Your main function should be in the TicTacToe class
Examples (SAMPLES ONLY – NOT REQUIRED TO REPLICATE!):
Submitting your work:
o All source files and class files as one tar-gzipped archive.
◦ When unzipped, it should create a directory with your ID. Example: 2008CSB1001 (NO OTHER FORMAT IS ACCEPTABLE!!! Case sensitive!!!)
o Source files should include the following: (Case-Sensitive file names!!)
◦ TicTacToe.java / .class
◦ Any other supporting or required files
o Negative marks for any problems/errors in running your programs
o If any aspect of the game / rules are confusing, make an assumption and state it clearly in your README file!
o README file should also have instructions on how to use/run your program!
o Submit/Upload to Google Classroom
o Marks Allocation
◦ 2-Player Version [10 points]
◦ Computer vs. Player Version [10 points]
◦ Coding Style [2 points]
◦ README [3 points]