A Strategy for Writing Simulations:
experiment, have fun and learn.


There are many strategies for writing simulations. The trick is to find a way that works for you. The technique I find most useful is to engage in an ongoing dialog with your computer. What I mean is this: compose a small piece of code and try it out. Check to see that your application is doing what you intended it to do. Write a little, run it and debug it. Creating a program procedes in incremental steps. Programming is simpler when you work in a visual development environment. You don't have to worry about building things like Windows, buttons and track-bars; you just drag and drop them on your screen. You can devote your full attention to the logic of the world you are building. As you assemble your model it is important to see how it behaves at every step. Create a color graphic visualization of each important part. To see what is going on you need to create a clear window in order to see into your synthetic world. Sometimes known as a Graphical User Interface, it is the GUI (pronounced "gooey") that presents you with the ever-changing color map of this virtual reality. As you write the logic of your artificial world, you should also write your interface. If you can see what your code is doing as your write it you will reap two benefits. You will see how your world behaves, and if it behaves badly you can lean why. You will gain experience and confidence through your failures as well as your successes. Start with little steps. Try little things to see what they will do before putting them together into larger things.


Save all your project files every few minutes. That way if you add code that stops your computer dead you can easily go back to where you were before it crashed.
Copy all your project files to your ZIP disk before leaving your desktop machine. If the workspace is erased, which happens regularly, your files will be destroyed.

What are the objects in the world you are modeling? How will you represent them in C++?

How will you visualize and render your world?

How will your world unfold through time?

As time unfolds, how will your agents interact with one another and with other objects?

Step through one round of the simulation:

Drop in Run and Stop buttons:

Weave back and forth through all the steps above and below:

Most of all, experiment, have fun and learn.