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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:56:24+00:00 2026-05-31T09:56:24+00:00

I am currently storing game data such as a sequence of moves in a

  • 0

I am currently storing game data such as a sequence of moves in a multi-dimensional array, that is defined as:

private final int[][] gameMoves = {{1},{2},{0},{3},{1,4},{1,4,5},{2,4}} 

The array is of course much bigger.

I feel that there should be a more elegant way to do this, possibly storing the data separately from the code using either an XML file or the SQLite database and then retrieving it in a while-loop.

If using an XML file, what would be the format and what would be the method of retrieval?

If using an SQLite database, what would be the way to get the data inside the database before executing the source code?

Any examples would be much appreciated.

  • 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-31T09:56:26+00:00Added an answer on May 31, 2026 at 9:56 am

    If this is data that never gets changed, there isn’t really any reason to persist it, especially if it gets read from frequently, since you’ll be taking a performance hit in the reading thereof. If anything, perhaps a separate package containing game data objects each providing ‘gameMoves’, might be a winner.

    Or, if you’re tied to the separation from a conceptual and/or requirement standpoint, JSON might be a good way to go, as it’s more directly tied to multidimensional arrays than a XML file might be, and certainly easier to work with for that than a DB.

    for example, your JSON file might be:

    [1, 2, 3, [45, 6, 7], 8, [9, 10]]
    

    You could then use the JSON library to parse it with minimal fuss:

    JSONArray data = new JSONArray(textFromFile);
    
    for(i = 0; i < data.length; ++i) {
        //Read data
    }
    

    See http://developer.android.com/reference/org/json/JSONArray.html

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

Sidebar

Related Questions

I'm currently having an issue storing mouse coordinates into an array in which a
I'm currently running a 12-node Cassandra cluster storing 4TB of data, with a replication
I'm writing an interactive fiction game in java from scratch. I'm currently storing all
I am currently working on a system for storing and retrieving data from a
I am currently programming a game that requires reading and writing lines in a
I'm currently storing my sqlite db file in the App_Data folder as per ASP.NET
I have a DateTime? field. Its currently storing UT. I would like it to
What is the best way to retrieve the current date? Currently I am storing
Possible Duplicate: Which collection for storing unique strings? I am currently using a Dictionary<string,
currently, this is the preg_replace string that I have. $mtg_post['post_content'] = preg_replace([^\\x20-\\x7e], ,$ability); This

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.