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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:34:46+00:00 2026-06-11T05:34:46+00:00

This isn’t so much a technical question as it is a style question. I’m

  • 0

This isn’t so much a technical question as it is a style question. I’m making a generalization of peg solitaire for Android, and there’s going to be different levels you can play. Each of them will have different starting configurations for the board, different sets of moves you can do, etc. Right now I have it programmed with a single basic level, and all those variables are initialized that way originally.

Do I add a text file that has all the different kinds of levels, and program it to read it from the text file? Do I add a Level class with all of this information from each level, and make several Level objects when it initializes? Do I make a Level class, but initialize it by reading the levels from a text file?

I’m sure all the methods would work, but is there a standard way to do it? I’ve never programmed anything like that before.

  • 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-11T05:34:48+00:00Added an answer on June 11, 2026 at 5:34 am

    There really isn’t a standard way to do what you want, it really depends on the complexity of the data you need to store to do each level initialization. Is this data going to change or is it static? Does it make sense to have it properly organized and separated from code logic? These are questions you need to answer yourself cause it’s your game and we don’t know all the details.

    Given that, you decide if you should store that data in an XML file, TXT file or something else. There really isn’t a correct answer. But you should (IMO) always have some sort of Level class, that’s the right way to go in a OOP context. The constructor could have the necessary parameters to build the level from the XML/TXT/whatever data. It could also have all the level parameters so you could initialize everything by code, if you need to for some reason. And, of course, don’t forget the getter/setter methods for all those level attributes.

    One thing I think you shouldn’t do is to “make several Level objects when it initializes”. You should separate your game logic from the data, you shouldn’t mix both that way.

    Probably not the answer you were looking for, but it’s mostly up to you.

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

Sidebar

Related Questions

This isn't much of a coding question as opposed to seeking help on going
This isn't really a technical question so I apolgoise if I ruffle any feathers!
This isn't a style question. Its more about the proper use of the language
This isn't a question of what stress testing tools are out there. I'm afraid
This isn't the best question ever, but since search engines feel the need to
This isn't a question that I am expecting a specific answer to since it
This isn't strictly a programming question, but I'm asking it here because it's certainly
This isn't a code question for once, but it definitely has me confused. Basically,
This isn't the best programming question but lets face it, the server fault guys
This isn't a question that has a black/white yes/no answer, this is more a

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.