Thread: Smart Program

  1. #1
    Registered User
    Join Date
    May 2005

    Smart Program

    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.

    For example:
    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.

  2. #2
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Missouri. Go Imos Pizza!
    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.
    void function(void)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 01:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM