Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3314370
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:13:29+00:00 2026-05-17T22:13:29+00:00

i’ve never been this frustrated in my life. cant even do the basics here..

  • 0

i’ve never been this frustrated in my life. cant even do the basics here.. just need to make a simple tic tac toe program. i feel so alone in this world right now.. i get the basic idea, but can’t put it together logically.

Class instance variables:

  • private char[][] board; private char
  • player; // ‘X’ or ‘O’

Methods:

  • public TicTacToe()
  • public void print()
  • public boolean play(String s)
  • public boolean won()
  • public boolean stalemate()

Here’s what i’ve got for code:

import java.util.Scanner;

public class Six1
{
    public static void main(String[] args)
    {   
    TicTacToe ttt = new TicTacToe();
    ttt.TicTacToe();
    ttt.print();
    }

    static class TicTacToe
    {
        private char player; // 'X' or 'O'
        private char[][] board;

        // make board
        public TicTacToe()
        {
            // construct board
            board = new char[3][3];

            // initialize elements
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    board[i][j] = ' ' ;
                }
            }
        }

        // print board
        public void print()
        {  
            for ( int i = 0; i < 3; i++)
            {
                System.out.println("  ");   
                for( int j = 0; j < 3; j++)
                {
                    System.out.print(board[i][j] + " ");
                }
                System.out.println("\n------");
            }
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T22:13:29+00:00Added an answer on May 17, 2026 at 10:13 pm

    You don’t have a lot done yet, but what you have seems mostly reasonable. You may be over-complicating things by using an inner class. And you’ll need to put something in main if you want something to happen.

    You can’t write the whole program all at once. You can either start at the top and work down to the details, or work on the details and then assemble them into a working whole.

    Working top-down

    If you’re not sure where to start, this can be a good way to get things moving. Write the main body of the code using whatever functions you wish existed. Maybe you’d start with

    public static void main(String[] args) {
        printBoard();
    
        while (!isWinner()) {
            readMove(); // get move from stdin and mark on board
            printBoard(); // redraw board
        }
    
        printWinner(); // say who won
    }
    

    It’s ok that these functions don’t exist yet. Once you’ve got the main level, start implementing these made-up functions, using more made-up functions if necessary. Repeat until you get down to simple functions that you do know how to implement.

    If you want to compile your code without implementing every method, you can use throw new UnsupportedOperationException("not implemented"); as the body of any methods that need to return values.

    Working bottom-up

    If you know you’ll need certain pieces but aren’t sure how they’ll fit together, start with this method.

    You know you’ll need some way to ask the user what move they want to make. So create a function that does that and test it on it’s own. You know you’ll need a way to check if there’s a winner. Hardcode some values into board[] and test your isWinner() function. Once you’ve got some working pieces you can assemble them into larger and larger chunks until you’ve got a functioning program.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.