Advertisement
fosterbl

TicTacToe1D.java - Starter Code (Static)

Dec 10th, 2019
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.52 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class TicTacToe1D{
  4.    //Declare and initialize a static String array with 9 spots. Name it board.
  5.    
  6.    //Write a static method named initBoard to initialize all elements in board to spaces.
  7.    //The method receives no parameters and returns nothing.
  8.    
  9.    //Write a static method named displayBoard to print out the board in TicTacToe board style
  10.    //The method receives no parameters and returns nothing.
  11.    //Ex:
  12.    // X| |O
  13.    // -+-+-
  14.    // O|X|O
  15.    // -+-+-
  16.    // X|O|X
  17.  
  18.    
  19.    //Write a static method to do a move and name it move
  20.    //The method takes in a String representing the player (O/X)
  21.    //The method takes in an int representing the spot
  22.    //The method returns true if valid move (legal index and currently occupied by space) and puts the move in the board at index spot, false otherwise
  23.    
  24.    //Write a method called diagWin to check diagonals for win - return true if there is a winner, false otherwise
  25.    //The method receives no parameters
  26.    
  27.    //Write a method called vertWin to check verticals for win - return true if there is a winner, false otherwise
  28.    //The method receives no parameters
  29.    
  30.    //Write a method called horizWin to check horizontals for win - return true if there is a winner, false otherwise
  31.    //The method receives no parameters
  32.    
  33.    //Write a method called checkWin - if diagWin or vertWin or horizWin is true, return true, false otherwise
  34.    //The method receives no parameters
  35.    
  36.    //Write a main method to play the game.
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement