the skating part

Topics: Button, Reset, Player Pages: 6 (380 words) Published: February 9, 2014
Problem Analysis and Design
Input/Output

Input(s)Output(s)

Mouse:

Clicking the squares button to put X or O
Clicking the button reset to restart the game
Clicking the button for high scores (if added)

Keyboard:

Entering name for high scores (if added)

Monitor:

Buttons for squares and symbol
Button for restart
Present score
Visual tic tac toe
Button for how to play

Game Layout
Main Screen
*500 X 500 Applet

Player 1 Player 2

High Score Screen (if added)
*500 X 500 Applet

High Scores
Name Win/lose Selena 3/2 _ _ _ _

Other Screen
When the ? button is pressed, a message that indicates how to play the game will appear.

The players put a X/O on one of the 9 squares on each turn to try and form a line of 3 X/O. The player that first complete 3 squares in a row, column or diagonal using X/O wins.

Structure and Components
Buttons for Tic Tac Toe
Declare each button from 1-9”
Example:
Private JButton button1 = new JButton(“”);
Private JButton button2 = new JButton(“”);
Private JButton button3 = new JButton(“”);
Private JButton button4 = new JButton(“”);
Private JButton button5 = new JButton(“”);
Private JButton button6 = new JButton(“”);
Private JButton button7 = new JButton(“”);
Private JButton button8 = new JButton (“”);
Private JButton button9 = new JButton (“”);

Action Performed for Buttons
(Calculate whose turn it is)

count =1
count =3
count =5 true
count =7
count =9

false

Count=2
Count=4 true
Count=6
Count=8

false

(Display “X” or “O” on buttons)

start
false

a.getSource()==button1 true false

a.getSource()==button2 true false

a.getSource()==button3 true

false

a.getSource()==button4 true

false

a.getSource()==button5 true

false

a.getSource()==button6 true

false

a.getSource()==button7 true

false

a.getSource()==button8 true

false

a.getSource()==button9 true

false

(Determine who wins)
Horizontally

start

button1.getText() == button2.getText()
&& button2.getText()==button3.getText() &&button1.getText() !=””

button4.getText() == button5.getText()
&& button5.getText()==button6.getText()
&&button4.getText() !=””

button7.getText() ==...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Roller Skating Essay
  • Figure Skating Essay
  • speed skating Essay
  • Figure Skating Essay
  • The Joys of Skating Essay
  • The Skating Party Essay
  • Essay on The Math in Figure Skating
  • "The Skating Party" by Merna Summers Essay

Become a StudyMode Member

Sign Up - It's Free