Report On Cellular Automaton Sir: Purpose
Report On Cellular Automaton Sir: Purpose
APPROACH:
Step1: Create two 2-Dimensional Arrays which are in our case Array1 and UpdatedArray. We
initializing the Infectious count to some integer value and a method to count the infectious in the process
of this simulation.
Step2: Step 2 is more specific about Start button which is the main part to start the graph
simulation. This start button had initialized three Labels which shows the counts on the form whenever
we click the start button. we start with the Array Array1 by initializing the susceptible as 0 in the grid
of 50 X 50, next we will place the infectious agents in different places of the 50 X 50 using random i and j
locations.
Step3: Here the basic task is to declare another 2-Dimensional array called UpdatedArray and
here comes the most crucial part of our program which is tells if infectious count greater than zero then
enter the while loop and change the surrounding 8 neighbors of the infectious agent to infectious ones, so
we here used the [i , j] coordinates to represent the neighbors. The most confusion part is when we
declare 50 X 50 Grid so i and j travels from 0 to 49 positions if they exceed 49 we will get Array index
out of bound exception. Basically the implementation goes as Susceptible represented by 0, Infected
represented by 1 and Recovered represented by 2.
Step4: Last part is to copy the UpdatedArray values to Array1 (which is initial array) and passing
the values to the graph content in the form which are dragged from the tool box. These inputs are
transferred to the graph whenever start button is clicked and it shows the infectious count graph which is
bell shapes which clearly shows that the infectious count starts increasing up to a certain point and starts
decreasing.
We together worked on the project where we analyzed the problem dealing with exceptions Array
out of bound and Graph implementation.
Array Index out Of Bound Exception in detail as we are dealing with 2-Dimentional
50X50 Grid. [Known fact but if we miss it, it has a great impact].
Solution:
By restricting i and j values from 0 to 49, frequently placing printing statements to keep
tract of indexes.
Problem2:
How to plot a graph in C# with values taken from .cs file and inputting variable into the
form to draw graph.
Solution:
Learnt from YouTube C# classes and implemented in our project. So whenever we need
to write a logic to button double click it and this code is related to Graph
this.chart1.Series["DiseaseSpread"].Points.AddXY(DAYCOUNT,TotalInfectious());
which tells that the series name is DiseaseSpread and add DAYCOUNT as x and
TotalInfectious as y axis.
Resources used:
1. YouTube: https://www.youtube.com/watch?v=82jnryBxsnI
2. C# tutorial: http://www.tutorialspoint.com/csharp/