Announcement

Collapse
No announcement yet.

Disease Model Programming

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Disease Model Programming

    If I can do it any-one can!

    Here is a little bit of a disease model demo that I am working on. I am aware that it is not needed, I was just bored.


    Anyway, Amjayee or someone else with C++ experince, please critque, espically my use of Classes. It is not such much what the program does, but how the classes work. Is it all good? I am no sure how to add other modifiers now, ie. incubation, Deoendance od Environment, etc, but I will experiment.

  • #2
    Ehh, where is it?

    Sorry, for my ignorance, I would really like to see this demo, but I don't know where to find it........

    ------------------
    "I chose not to choose life. I chose something else."
    - Trainspotting
    "It is not enough to be alive. Sunshine, freedom and a little flower you have got to have."
    - Hans Christian Andersen

    GGS Website

    Comment


    • #3
      http://members.xoom.com/acchiron/disease.zip

      Sorry

      Comment


      • #4
        Thanks. I will check out the sourcecode as soon as possible.

        ------------------
        "I chose not to choose life. I chose something else."
        - Trainspotting
        "It is not enough to be alive. Sunshine, freedom and a little flower you have got to have."
        - Hans Christian Andersen

        GGS Website

        Comment


        • #5
          It is not a bad class at all - especially for someone who hasn't worked with c++ for very long. Nice and working class! The only thing I have to complain is, that usually the classes should be kept in their own files, and you should make a .h file with the class definition. Then you would #include the .h file into the main program.

          Anyway, please feel free to ask, if you don't know how to do certain thing!

          Comment


          • #6
            The sourcecode looks really cool, Heardie.

            But how come the program closes itself automatically just after being opened, if you don't open it from inside the compiler? I tryed opening my pop model (it's done - check the pop model thread) outside the compiler and the same thing happened. What can we do to avoid this, Amjayee?

            ------------------
            "I chose not to choose life. I chose something else."
            - Trainspotting
            "It is not enough to be alive. Sunshine, freedom and a little flower you have got to have."
            - Hans Christian Andersen

            GGS Website

            Comment


            • #7
              Ah, yes thanks for reminding me. The file is now almost complted. I wrote in the readme that it was completed but I forgot to do Dependance of Environment variable. Anyway, the file is updated at the address listed above.

              Joker
              --------------------
              Well the program from a Dos window. it is because when the program finishes, it is done, and has no more info to display, but in DOS all the old info still shows.

              Comment


              • #8
                Is there a way to stop it? Keep the windows opened untill the user shuts it down?

                ------------------
                "I chose not to choose life. I chose something else."
                - Trainspotting
                "It is not enough to be alive. Sunshine, freedom and a little flower you have got to have."
                - Hans Christian Andersen

                GGS Website

                Comment


                • #9
                  not that i know

                  just view it is dos

                  Comment


                  • #10
                    Windows console closes when the program ends. I don't know of any way to prevent that, except adding a line to the end of the program that requests the user to press any key. This way, the program will wait until some key is pressed and ends then. Like this:

                    cout << "Press any key to end the program";
                    cin >> some_char_variable;

                    This should be the last line of the program.

                    Comment


                    • #11
                      Look who's a prince! Wow!

                      Strange thing that happened with your status, Joker.

                      Comment


                      • #12
                        Thanks, Amjayee.

                        Anyway, it's not really a big deal with my post count. But I guess I should mail someone sooner or later.

                        ------------------
                        "I chose not to choose life. I chose something else."
                        - Trainspotting
                        "It is not enough to be alive. Sunshine, freedom and a little flower you have got to have."
                        - Hans Christian Andersen

                        GGS Website

                        Comment


                        • #13
                          Finally, I have some time to make some meaningful comments!

                          At the end of the program, put:
                          cin.ignore();

                          This means that it will wait till the user presses "enter" to continue...
                          "Beware of the man who works hard to learn something, learns it, and finds himself no wiser than before. He is full of murderous resentment of people who are ignorant without having come by their ignorance the hard way. "
                          -Bokonon

                          Comment


                          • #14
                            No problem, Joker.

                            BTW, I also have some suggestions for the model (sorry if I'm repeating comments from earlier ). Basically, an interesting pheonomenom happens when a city's population reaches a threshold of ~200,000 people. If this city comes in contact with a disease (that isn't too lethal), it will keep the disease in circulation forever. It eventually becomes a "child-hood disease" (think measles and small pox). That means infant/childhood mortality would significantly increase, but would not be disastrous to the civilization (besides the fact that kids have better immune systems than adults, kids play a much less significant role in keeping a society together and less resources are "wasted"). Besides, genetic resistances would be built up, and the disease would slowly lose effect.

                            On the other hand, if a smaller city or village has a run-in with a disease, it gets the majority of the population massacred, and keeps on getting massacred every time it connects with the disease. In addition, many of these people would be vital to holding the civ together, and the civ would subsequently collapse.

                            To go off on a related tangeant, religious values can affect the course of diseases (and vice-versa). For example, during the first and second centuries, a huge trading network was established between Rome, the Middle East, India, and China, for the first time. In Rome and China, the casualty rates from disease were horendous (Indians and the Middle Easterners, presumably, were more disease resiliant than the Romans and Chinese). In Rome, people were exposed to small pox and the measles for the first time (come the 6th century, it was exposed to the bubonic plague) - unfortunately, the disease info for China is a little more vague, but presumably, they were affected by the same diseases. Both times, the rates were around 1/3 of the population! In addition, Rome had the unlucky proposition of being all along the Mediteranean, and therefore exposed to trade. The smaller cities, therefore, were continually exposed to diesease, and their populations eroded. China faced a similar phenomenon. To go off in another tangeant, this, IMO, caused the collapse of Rome. The interesting thing (if that wasn't interesting enough ), is that both civs converted to a different religion during this era. At approximately the same time, China accepted Buddhism and Rome accepted Christianity. This was probably because these religions advocated helping the unfortunate, decreasing casualty rates greatly. In addition, these religions preached a benevolent God (relatively speaking, of course), reducing psychological agony over the fear of death and the death of relatives.

                            Errrmm.. uhh... that's all for now ...
                            "Beware of the man who works hard to learn something, learns it, and finds himself no wiser than before. He is full of murderous resentment of people who are ignorant without having come by their ignorance the hard way. "
                            -Bokonon

                            Comment


                            • #15
                              Hi Ramo!

                              Great to see you here again. And thank you for that programming trick.

                              ------------------
                              Vote Gore. For the sake of people, not god.

                              GGS Website
                              "It is not enough to be alive. Sunshine, freedom and a little flower you have got to have."
                              - Hans Christian Andersen

                              GGS Website

                              Comment

                              Working...
                              X