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

  • SEARCH
  • Home
  • 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 7862773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:16:33+00:00 2026-06-02T23:16:33+00:00

For my end of year project I need to develop an image processing and

  • 0

For my end of year project I need to develop an image processing and artificial intelligence application.

My image processing is already done, so I’m moving to the AI. However I have a problem here.

I will try to describe the situation here.

For a correct image processing I need an AI that can validate the board through the rules of checkers. So I need to check the current state of the play field with the last known state.

So for this I created an object with the currentBoard 2 dimensional array, and a method that validates the raw input of the board with the currentBoard (= last known state).

However, when another object — my image processing object — is finished with his method, it will change the array currentBoard in my AI object.

This is the same for a new array I created inside the main form. I think this happens cause of the heap/stack.

I hope I made my problem clear and understandable. I know I’m not the best in describing situations so please tell me when you don’t understand a part completely.

  • 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-02T23:16:35+00:00Added an answer on June 2, 2026 at 11:16 pm

    Arrays are reference types, so, as you’ve found, changing the array contents in one place will change it for any other code which holds a reference to the same object.

    To avoid changing the array, you should take a deep copy of your 2 dimensional array and work with the copy instead. Note that we have to take a deep copy of both the array and its internal arrays:

            int[][] original = {new[] {1,2,3}, new[] {4,5,6}};
    
            int[][] deepCopy = new int[original.Length][];
    
            for (int index = 0; index < original.Length; index++)
            {
                var row = original[index];
                int[] rowCopy = new int[row.Length];
                row.CopyTo(rowCopy, 0);
    
                deepCopy[index] = rowCopy;
            }
    

    You can also produce the same result using some simple linq:

    int[][] deepCopyLinq = original.Select(x => x.ToArray()).ToArray();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to get the exact start and end dates (month, day and year)
My web application allows end users to upload image. After the image is saved
I have a pretty big web application that I created last year using ASP.NET
I'm working on a project where I need to generate end-user documentation for a
I have a project where I need to extract a file from a zip,
Working on a end of the year project for school and chose to create
For my end of year project I am creating a password generator where you
How can I get last year's start and end date using PHP code? Is
My end goal is local development of a Radiant CMS installation. So, need rails
Error: End tag for 'optgroup' which is not finished. You have probably failed to

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.