首页 > > 详细

CSC171 Project 3 A Graphical Tic-Tac-Toe

 CSC171 — Project 3

A Graphical Tic-Tac-Toe Game
Due: Wednesday, Dec 2 2020, 1159pm
Objective
Your objective is to implement a simple graphical game of Tic-Tac-Toe which allows two
human players to play against one another. For more information on the game, see https:
//en.wikipedia.org/wiki/Tic-tac-toe. The game is played on a 3x3 grid between two
players. Each player takes a turn marking a square with either an X or an O. The first
player to get three in a row (horizontal, vertical, or diagonal) wins the game. If all the
squares are filled and no one wins, the game is a draw.
You are allowed to work with one partner on this project. Both of you must of course be
currently enrolled in CSC 171. Both team member’s names and NetIDs must be stated
in every implementation file and the readme. It should be abundantly clear who worked
together.
1 Program Design and Requirements
Your program should consist of two visual panels. An upper panel for displaying stats, the
current player’s turn, and a new game button. The lower panel will be used to display the
game board and to interact with it.
As with all Java programs, your main program filename must match the public class exactly,
therefore your program must be named TTTGame.java and your class name must be named
TTTGame. This will be the program that we run to grade your project, so following this
simple naming convention will make life less challenging for your TAs. You are free to
create additional classes or files as you see fit. Please be thoughtful when choosing private,
protected, or public access modifiers when declaring methods and fields throughout your
project.
Because it complicates grading, you are not allowed to have any package declarations.
Including package declarations in your submission will cause you to lose points.
It should be possible for you to complete this project through careful drawing of the game
board by overloading paintComponent in a custom JComponent. To simplify the graphical
aspects, you may design your program to display a lower panel of exactly 480x480 pixels
in dimension. This will allow you to easily map from (x,y) coordinates generated by
MouseEvents to regions of the board. The figure below is annotated with coordinates
which you may use to simplify your program design.
I recommend the following design:
• a custom JPanel for displaying the stats
• a custom JPanel for displaying the board
• a custom JFrame with vertical BoxLayout for putting everything together
You do not have to follow this exact design – as long as your program is functional (you
can play a game of TTT, start a new game, detect winners, and update the scores) – then
you will receive full credit. In particular, you are free to use any Swing components that
you would like. You may find JLabels and JButtons particularly helpful. If you these
Swing GUI controls for the top panel, then you will most likely also want to make the top
panel’s layout be either a FlowLayout or a horizontal BoxLayout.
2 Documentation
Please include a readme in this submission which describes the state of your code and
your general design. If everything works, you can simply write that everything works and
2
describe your design. Otherwise, describe what does and does not work when you submit
it, as well as your general design. Your readme should be plain text – no docx, rtf, or pdf
files please.
In your readme file and all of your implementation file(s) please include your name and your
UR NetID, as well as the name and NetID of your partner if you are not working alone.
In the implementation file this should be written using a comment. This class involves
a lot of students, so including this information is very helpful to us when we grade your
submissions.
Lastly, please be sure to comment your program source code as appropriate. This is
especially important when declaring constants, making assumptions about parameters to
be passed, or the order it which methods must be executed. It will also provide a useful
historical record in the event that you wish to review your early works sometime in the
future.
3 Submission and Collaboration
Zip your implementation files (i.e., all your Java source code) and your readme together into
a zip file named tttgame_NETID.zip, where NETID is replaced with your actual NetID. If
you work with a partner (see below), then you should include both team member’s NetIDs
in the name your file, as in tttgame_NETID_NETID.This will help us to efficiently grade
your submissions. (Note: your NetID is what you use to log into Blackboard, and forms
the username component of your university email address.)
As stated earlier, you are allowed to work with one partner on this project. Both of you
must of course be currently enrolled in CSC 171. Both team member’s names and NetIDs
must be stated in every implementation file and the readme. It should be abundantly clear
who worked together. Only one team member should submit the project zip file, the other
team member should submit a text file that states the name and NetID of their partner,
and indicates that their partner is submitting the zipfile.
The project deadline is December 2nd 2020 at 1159PM.
4 Grading
Your grade for this assignment will be based on the following criteria:
• 20% Clicking new game button resets game board and leaves statistics unchanged.
3
• 25% Game board works (valid moves accepted, invalid moves rejected, reasonable
graphics).
• 25% Win conditions recognized and displayed to screen.
• 10% Current player’s turn indicated during games.
• 10% Win/lose/draw statistics displayed and accurately tracked.
• 10% Design and Documentation (i.e., tricky code commented, informative readme,
NetIDs and names in all files, etc.)
 
联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!