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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:42:36+00:00 2026-05-30T23:42:36+00:00

Hello I am working on a tic-tac-toe project on my own. I am not

  • 0

Hello I am working on a tic-tac-toe project on my own. I am not taking a programming class so its not homework.

I have written pretty much the rest of the code and am now working on the AI.

For the AI i am going to have it take a copy of the (2 dimensional array) and it check if it can win in a move, then if the player can, then if it can in 2 moves, then the player and so on, there are some other things i will include. So in order to do this i think i need to pass a copy of the array, but i am not sure how to copy an array. So that is basically my question, how do you copy an array?

  • 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-30T23:42:37+00:00Added an answer on May 30, 2026 at 11:42 pm

    You can wrap the array into a class, in which case it’ll be copied automatically by the default-generated copy constructor and assignment operator:

    enum EField { empty, cross, oh };
    
    typedef std::array<EField, 9> TTTBoard;  // C++11, or use std::tr1::array
    

    Or do it manually:

    struct TTTBoard
    {
        EField data[9];   // or even EField data[3][3]
    };
    

    Now you can copy it at will:

    TTTBoard b;
    TTTBoard c = b;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have been working on a 2 player Tic-Tac-Toe game in java that
hello all i am working on a project in which i have a webpage
hello its really weird that a if and else statement is not working in
Hello i'm working on a blog app and I have a model: class Post(models.Model):
Hello I am working on a project for school and I have a sub-form
Hello I am working on wireless sensor network (Zigbee). WSN gateway device have a
Hello everyone i am working on a project which requires me to export some
Hello I have this list that i am working on. When i move the
Hello everybody my linq to sql selection does not working on dateTime field for
Hello I am working on a website and have a question why this is

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.