I was wondering how one would go about reading certain things from a file, which will be conditions to how something must work.
First of I know how to read data from a file, but let me explain with an example.
I want to write a small program where the user would be able to "manipulate" the ethics of the program, to function differently as they want to, without actually touching the source code.
Create a back bone for a card game, which stores things such as how many decks to use, how many cards in each deck, and what rules to use.
Now I myself don't want to hardcode all of that, and have been able to get as far as having multiple decks, and any amount of cards in a deck, each deck consisting of sets.
What my idea is, is to let the user create files, like mygardgame.cfg (which holds the basic info of the card game) and mycardgame.rls (which holds the rules of the card game).
Now each card game will be played through the program, so I am in need of a way on how to interpret rules created by the user, without any actual coding by the user.
What is the posibility of actually creating something like this ?
P.S The whole idea isn't to make a game, but allow user manipulation to software by creating rules, and having the software interpret the rules.
Well, it depends on what kinds of games you'd need to use. If they will always be similar to one another, you can divide it up into different fields such as the 'hot card' or the number of cards you can hold at once, etc. and read those values into a variable, as I assume you did with the decks and number of cards. You could even expand it to a 'type of game' field, which you could set to solitaire or party game, or whatever, and have different, preset, codes for each type of game, and even different sub-fields for each type.
If you're asking can a program create its own code, dynamically, to a certain extent, yes, but not to the extent that you're asking. At least, not that I know of. And if it is possible, then you're getting really deep into the workings of a computer.