J AVA A SSIGNMENT 1. O VERVIEW Tic Tac Toe How it should work Using the supplied methods What you need to do How we will test your code.

Slides:



Advertisements
Similar presentations
What is Tic-Tac-Toe?.
Advertisements

Continuation of chapter 6…. Nested while loop A while loop used within another while loop is called nested while loop. Q. An illustration to generate.
Tic tac toe v1.2 Made by Rogonow XX PC: X YOU: O The PC-player with mark X goes first. After the PC, you place the mark O at the position of a green oval.
Picture It Very Basic Game Picture Pepper. Original Game import java.util.Scanner; public class Game { public static void main() { Scanner scan=new Scanner(System.in);
1 Convert this problem into our standard form: Minimize 3 x x 2 – 6 x 3 subject to 1 x x 2 – 3 x 3 ≥ x x 2 – 6 x 3 ≤ 5 7 x 1.
Tic-Tac-Toe Using the Graphing Calculator for Derivatives.
Big Java by Cay Horstmann Copyright © 2008 by John Wiley & Sons. All rights reserved. It is common to use two nested loops when filling or searching: for.
Chapter 13 ARRAY LISTS AND ARRAYS. CHAPTER GOALS To become familiar with using array lists to collect objects To learn about common array algorithms To.
Chapter 13 ARRAY LISTS AND ARRAYS CHAPTER GOALS –To become familiar with using array lists to collect objects –To learn about common array algorithms –To.
9-May-15 Notes on Style Testing the TicTacToe game.
Tic Tac Toe Game Design Using OOP
1 Project 6: Tic Tac Toe. 2 Tic Tac Toe A Challange Project 10 Points extra credit on final grade OK to work in groups of 2 or 3.
CHAPTER 10 FUN AND GAMES Group 1: Xiangling Liu.
TIC-TAC-TOE FELIX CHEN CLUSTER 5: Computers in Biophysics and Robotics.
PLANNING THE TIC TAC TOE GAME BY NEEL DAVE. TIC TAC TOE INSTRUCTIONS Tic Tac Toe Instructions The basic concept of Tic Tac Toe 1.This is a game for two.
Tic Tac Toe Architecture CSE 5290 – Artificial Intelligence 06/13/2011 Christopher Hepler.
Conditionals Lab Dan Maselko. Overview  Gain familiarity with working with conditionals  Become familiar with using the modulus operator  Understand.
Integer Tic Tac Toe Let’s Begin Rules: 1.Erase all x’s and o’s from the previous game before you begin. 2.Decide which player will be x’s and which will.
Methods and Parameters in Java. Methods in Java Also known as  functions, procedures, subroutines For example  System.out.println()  Math.sqrt() Provide.
Loops For While Do While. Loops Used to repeat something Loop statement creates and controls the loop.
Representing a Game Board In a game, we represent the action taking place using an array – In a very simple game, we use individual variables to represent.
Arrays (III) H&K Chapter 8 Instructor – Gokcen Cilingir Cpt S 121 (July 15, 2011) Washington State University.
BINGO! Topic Create Your Game Card You will need a blank piece of paper.
Random (1) Random class contains a method to generate random numbers of integer and double type Note: before using Random class, you should add following.
Today in CS161 Lecture #4 Solving Problems with Computers Walk through the Tic Tac Toe Algorithm Getting ready for Creating Programs Turn the Inches to.
Computer Programming for Engineers. Outline Tic-Tac-Toe (O-X Game) Drawing 3x3 grid Receiving the inputs Checking for a winner Taking turns between.
1 CS 177 Week 12 Recitation Slides Running Time and Performance.
TIC TAC TOE. import java.util.Scanner; import java.util.Random; public class PlayTTT{ public static void main(String[]args){ Scanner reader = new Scanner(System.in);
Integer Tic Tac Toe Let’s Begin Rules: 1.Erase all x’s and o’s from the previous game before you begin. 2.Decide which player will be x’s and which will.
CPSC 217 T03 Week V Part #1: Iteration Hubert (Sathaporn) Hu.
CS Class 15 Today  More practice with arrays  Introduction to Multi-dimensional arrays Announcements  Programming project #4 due 10/23 by midnight.
Problem Decomposition and Abstraction. Problem Solving Which one is easier:  Solving one big problem, or  Solving a number of small problems?
Introduction to State Space Search
Checkers A Matlab Project by Spenser Davison, Edward Dyakiw, Justin Pezzi, and Scott Wu.
Print Row Function void PrintRow(float x[ ][4],int i) { int j; for(j=0;j
When constructing a two-dimensional array, specify how many rows and columns are needed: final int ROWS = 3; final int COLUMNS = 3; String[][] board =
2-dimensional Arrays A 2-dimensional array has rows and columns It is actually an “array of arrays” A Tic-Tac-Toe board is an example of a 3 by 3 2-d array.
Tic – Tac – Toe ! Choose a square by clicking on “box #” Choose a square by clicking on “box #” If the person choosing the square gets the problem correct,
Tic-Tac-Toe Review of Scale Factor Fill in the 9 squares with any letters A-Z (no repeats). TICTACTOE.
A 2-D Array is a structure that storage space both vertically and horizontally. Thus, the array has both rows and columns. 2-D Arrays are used to create.
Lecture 5 of Computer Science II
Chapter 8 – Arrays and Array Lists
Tic-Tac-Throw! How to Play: X or O
O X X O O X X O X O X O O X O X O X Tic Tac Toe Graphical
CS305J Introduction to Computing
Lesson 5 Functions I A function is a small program which accomplishes a specific task. For example, we invoke (call) the function, sqrt(x), in the library.
Tic – Tac – Toe ! Choose a square by clicking on “box #”
IPad Center.
Multi-dimensional Array
Functions in C.
Review.
The winner is the first player to reach 20 points
Tic – Tac – Toe ! Choose a square by clicking on “box #”
Tic – Tac – Toe ! Choose a square by clicking on “box #”
AP Java Warm-up Boolean Array.
Announcements & review
Tic – Tac – Toe ! Choose a square by clicking on “box #”
Pasa números Divide students in to teams and have each team sit in a row. Give each student a dry erase marker and something to erase with. Each team gets.
Tic – Tac – Toe ! Choose a square by clicking on “box #”
The winner is the first player to reach 20 points
Tic Tac Toe application
Tic – Tac – Toe ! Choose a square by clicking on “box #”
Structure diagrams for lab 13
Tic – Tac – Toe ! Choose a square by clicking on “box #”
Tic-Tac-But No Toe In the following tic tac’s there are four numbers
Tic – Tac – Toe ! Choose a square by clicking on “box #”
Tic – Tac – Toe ! Choose a square by clicking on “box #”
Tic – Tac – Toe ! Choose a square by clicking on “box #”
Tic-Tac-Toe Game Engine
Data Structures & Programming
Presentation transcript:

J AVA A SSIGNMENT 1

O VERVIEW Tic Tac Toe How it should work Using the supplied methods What you need to do How we will test your code

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

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

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)

W HAT YOU NEED TO DO You need to write and test the following methods: modifyboard checkboard main

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