JCSP Infect
Author: Peter Welch

# Infect

The central canvas shows a growth medium in which an infectious organism can grow. It represnts a two-dimensional space of cells mapped on to a toroidal world - i.e. the left and right edges are adjacent, likewise the top and bottom edges. Each cell (pixel) in the canvas can be in one of three states:

- healthy (green)
- infected (red - how many is reported in the top left info label)
- immune (blue - how many is reported in the top right info label)

The medium evolves in cycles. In each cycle:

- if a healthy cell is nect to an infected one, there is a rate% chance that it will become infected. The value of rate is controlled by the slider on the left (and reported in the bottom left info label)..
- an infected cell may cease being infectious and become immune - it's still sick but it won't infect anyone. The chance (%) of its remaining infectious is governed by the top right slider (and reported in the bottom middle info label).
- an immune cell may recover and become healthy again. The chance (%) of an immune cell retaining its immunity is controlled by the bottom right slider (and reported in the bottom right info label). There is a very small chance that an immune cell may spontaenously become infectious again - this is not under user control.

Initially, the model is active and all cells are healthy (green). Other user controls are as follows:

- [LEFT MOUSE CLICK] introduces infection.
- [RIGHT MOUSE CLICK] immunises healthy cells (but does not change infected ones).
- [MIDDLE MOUSE CLICK] makes immune cells healthy (but does not change infected ones).

DRAGGING with the mouse button is PRESSED repeats the above CLICK operations over the cells it passes.

Pressing [SHIFT] at the same time as a mouse CLICK sprays the action over a much wider area - the spray pattern is random and changes each time. It is not necessary to keep the [SHIFT] key depressed whilst DRAGGING.

Pressing [CTRL] at the same time as a mouse CLICK locks (logically) the mouse button down. The mouse button can now be released and the system will respond to mouse movements as though it was being DRAGGED (i.e. as though the button was held down). The next mouse click (on any button) release this lock. [Note: this only applies to the LEFT and RIGHT buttons. JDK 1.1/1.2/1.3 all report the [CTRL] key pressed on the MIDDLE button regardless as to whether it really is pressed.]

Presing [SHIFT] and [CTRL] at the same time as a mouse CLICK combines the above effects.

Finally, there are [FREEZE/IUNFREEZE] and [RESET] buttons. The [RESET], which clears the medium back to all healthy cells, is only enabled if the system is frozen.

Challenge: with the initial settings of the slider rates, start an infection in the middle and try to eradicate it by spraying. Now try it with an infection from a corner region. Reduce the inititial immune persistence rate from 99% to 98%. Can you still eradicate it?

Experiment: with different settings of the sliders. The original version of this model had the two right-side sliders at zero.

Enjoy!