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 9225635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:37:43+00:00 2026-06-18T04:37:43+00:00

I am trying to make a Tic Tac Toe game using objects, classes, etc.

  • 0

I am trying to make a Tic Tac Toe game using objects, classes, etc. However, the user can input an option so that he/she can set the size of the board. At the moment, it can only do square shapes (3×3, 4×4, etc).

I have a diagram drawn out on a white board to explain what I will talk about next (ignore the right side about orders and raw axis, that’s for something else. Also all that really needs to be focused on is the table and for code): http://d.pr/i/5CY8

The width and height of the game board is set by the size the user imports (number by number). I then have two for loops to create a pointer to a new Square each time. An array list will hold our squares. However due to the location of the array list (it is in a header), I cannot assign the size of the two-dimensional array when it is created. Therefore, I need to dynamically allocate the size so I can set the size of the array so that the array list holding the squares when the size is inputted. However, I cannot figure out how to do this.

I have the code both in Pastebin and in Visual Studio 2012. I believe it would be easier to view the Visual Studio files, since there will be many Pastebin links.

List of links to Visual Studio files/code on Pastebin (sorry, I hit my link limit!): http://pastebin.com/spH3JaHP

  • 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-06-18T04:37:44+00:00Added an answer on June 18, 2026 at 4:37 am

    It looks like you’re using a 10×10 array (different from an arraylist/vector) to store your board state. The proper way to declare a 2-d array during runtime would be the new[] operator. For example:

    // header file
    Square::SquareState ** boardArray;
    
    // array generation
    int height, width;
    // get height, width
    boardArray = new Square::SquareState*[height];
    for (int i = 0; i < height; i ++)
        boardArray[i] = new Square::SquareState[width];
    

    You can then use boardArray as any old 2D array.

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

Sidebar

Related Questions

Basically i'm trying to make a tic-tac-toe game using C++ and SFML2 API. I
I am trying to make a Tic Tac Toe game in Silverlight that can
I am trying to make a Tic Tac Toe game in Python using the
I am trying to make a really simple Tic-Tac-Toe game. I have stored values
I have read a book and am trying to make a game of tic-tac-toe
I was trying to make Tic Tac Toe game for the monthly tutorial and
I am trying to make tic tac toe using websockets running on glassfish. I've
So I am working on a ModelViewController tic-tac-toe game homework and I am trying
I am trying to make a tic-tac-toe program, and want to know how I
I am trying to make a Tic Tac Toe program with java swing, and

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.