Download presentation
Presentation is loading. Please wait.
Published byAbigail McGee Modified over 9 years ago
1
J AVA A SSIGNMENT 1
2
O VERVIEW Tic Tac Toe How it should work Using the supplied methods What you need to do How we will test your code
3
T IC T AC T OE Basic Tic Tac Toe Game Uses column and row to decide where to put a mark Does basic checking to prevent errors
4
H OW IT SHOULD WORK 1. Program is started and player X begins 2. Player types in a column and row in the form of ‘A2’ 1. Program checks that the box is not already set, if so it re asks for a new column and row 2. Otherwise it sets that box to an X 3. Game checks to see if there is a winner 4. Game prints out board 5. Player O is asked for location 1. Program checks that the box is not already set, if so it re asks for a new column and row 2. Otherwise it sets that box to an O 6. Game checks to see if there is a winner 7. Game prints out board 8. Repeats until a winner found or all 9 boxes are filled 9. Game exits
5
U SING THE SUPPLIED METHODS tictactoe Class public static void main ( String[] args ) tictactoeboard Class char[] getboard() void printboard() int modifyboard(String move, char XorO) char checkboard() GameHelper Class public String getUserInput(String prompt)
6
W HAT YOU NEED TO DO You need to write and test the following methods: modifyboard checkboard main
7
H OW WE WILL TEST YOUR CODE Our tester will ‘reach into’ your code and test each method individually. We will check that every combination of X and O results in the correct win We will check that your modifyboard method wont let us place move where there already is and X or an O We will check that your code runs overall
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.