Monday, September 19, 2005

failure finder (or auto tests ++)

After I started writing autotests I began to noticed that I was still having bugs found in those classes that I had autotested. Every time a new bug was found I spent a fair amount of time trying to determining why my autotests hadn't found it. In the end I concluded that autotests can only get you so far because I wont think to call x(), y(), y(), y(), x() in my autotest even though I did happened to test x(), y(), x(). I can only comprehend a limited set of all permutations of interactions.

To automatically find some of these pairs would be set up. The first half of each pair is actions and the second set are verifiers.
For every action there is a verifier of the "state of the world" as known by that action. For example if you have the following functions:

setSize(x) { last = first + x; mySize = x;}
int mySize;

The action is setSize(x) and the verifier confirms that size() will return last() - first(). With this pair you are then able to randomly verify and set things. Somewhat similar to how you generate genetic algorithm. Once you find a failure you simply perform the same genetic algorithm search, but this time the goal is the smallest set of operations that can still reproduce the failure.
Then when you add function

clear() { last = 0; first = 0; }

the test would find a bug very quickly.

Sunday, May 15, 2005


icefox: Do you think people would want an SimAdmin game?
blarf2: hrm could I possibly be going deaf
icefox: Place computers, wire them up, add servers, backup servers, switches
icefox: Disaster! virus struck
icefox: Disaster! ISP went bankrupt and you don't have a reduntant backup!
icefox: Congradulates: your company has propered and is adding a call center. Add 100 terminals.
icefox: Warning: users on floor two are complaining about slow network speed
icefox: Disaster: A user has plugged in a cable from network a to network b no data is transfering, find cable and cut
icefox: The possiblities are endless
blarf2: icefox: sounds like something I wouldn't play, but it could be a fun way to create or abuse some sim game framework

Thursday, May 5, 2005

3D Programming IDE

It might be interesting to have a 3D environment be a programming world where each room/area would contain one statement of code.

Variable could be in game items.

  • type int- Coins/Bills
  • type string - Scroll/Books
  • type float - Water/Wines/Drinks

There are two aproches you could take with this idea. The first would be to have each room already defined and by playing the game you would in essance debugging and editing the application so you can complete the level.

Here is a sample level in crud ascii.

[foo=Hello World]
[print foo]
[a = 10]
[if a == 10] - [ a = 1]
[print a]
[while a != 10] - [ ]

A walkthrough of this level:

You enter the first room and there is a scrool on the floor which you pick up. The scroll says "Hello World" on it. There is a door in front of you. You walk through the door into the second room. On the wall above a door it displays "Hello World". You walk through the door and get 10 coins. Moving into the next room it has two doors. You turn and go into the room on your left. You get zapped and are left with one coin. Going back you go in the other room where it has on the wall "1". The next room has a open door and a closed door. The open door leads to a empty room. Confused you go back a few rooms and get ten more coins and then continue to the last room where the door to the exit is now open.

This way of using the ide is much more game orianted.

The second idea would be that you would be dropped off in a empty room. There would be a console type interface where you can modify the room. You can make that room do anything you want, but it can only do one statement. The room could contain coins or a jug of wine (w = 10.2) for example. Once the room gets a statement then one or more doors will appear. You can then go into the next room and modify it. When exiting the "ide" it would leave a level.c file that can compile and run with any normal compiler.

It might be interesting to open existing source in this environment to see how lost you get.