Thursday, July 16, 2015

Code Guru : Gateways 2015 : Mango Frenzy


Article Written By : Jibrael Jos

Code Guru 2015 was very well contested. There were 32 participants from M.Sc and MCA of Christ University. The completion was a solo event and all in a race for time. Net time was 1 hour. The Top 10 Code Gurus are:

I - Diganta Das (MCA)
II - Amlanjyothi Saikia (M.Sc Comp Science)
III - Jonathan Paul (MCA)

Position IV to X are :
Diarra Cheick Oumar, Akashdeep Bhattacharya, Kaiwalya Limaye,
Teresa Mary Philip, Tushar Chindalia, Fifie Francis, Nivetha Yadhavan

Congratulations to one and all !!!

The questions inspired by my Ph.D. research area were

Mango Frenzy
     
0.     Create a 30 by 30 world initialize to zero, Display as given in table.

1.       Create a Rectangle Mango of given length and breadth hanging from a stem (size 5,2) at position (0,14) . Display it.
2.       Hard Code Mango length as 20 by 20 starting at 5,25.
3.       Add Right Weevil at given x and y … Weevil eats his way to right side.
4.       Add Seed Weevil which moves to center/seed of mango.
5.       Add a Fruit Fly which flies around the mango in anti-clock wise steps of 3.
6.       Add an Eating Fruit Fly, like step 6 but also eats on the way.
7.       Mango part below drops down when right weevil eats thru the mango.

 

0
Nothing
Space
1
Stem
*
2
Mango
#
3
Fruit Fly
F
4
Eating Fruit Fly
E
5
Right Weevil
W
6
Seed Weevil
S

Sunday, July 12, 2015

Coding the Rainfall


Written by Jonathan Paul (III MCA)

Its amazing to watch how one can find so much to learn from the nature around us. Inspired by nature is this piece of challenge in which we had to simulate a situation where in rain water would be trapped in trenches and pits.
 
    It always seems to be a daunting task when we face a new challenge, but we have to understand that every problem has a solution. It’s only the time that we need to worry about, nothing else.
    So it began; I loaded a matrix with 1 representing water, 2 representing air and 3 representing land. The challenge I faced was in realising that gravity starts from the surface (a hint :P). Also, we should ensure that molecules behave naturally, fall drop by drop, and last but not the least, we should ensure that we do not add or remove molecules by faulty logic.
    The other constraints were that water molecules need to settle down and ensure they are in a stable equilibrium state. Only a layer of water molecules could settle on the surface of land. Water would flow down slopes and would accumulate in crevices.
    The fun part was added by Prof. Jibrael Jos, when he asked us to drain the water through a hole in the surface. My joy knew no bounds when I saw the water flowing out literally “naturally”.
                                    

 

Coding the Conway’s Game Of Life

Written by Jonathan Paul (III MCA)
 
It was very hard to understand initially, “What is this Game of Life?”. It seemed so confusing. I was puzzled when Prof. Jibrael Jos first spoke to us about it . But then I read the four simple rules which determined the life of cells; approached sir, and he explained the life of an oscillator (Blinker). I was amazed ! It was like knife going through butter.
    I immediately got down to code it. Few if and else conditions, a little bit of concern for boundary conditions and ensure that no cells in the present generation were affected by cells of next generation ; gave me an ample of joy watching my first species oscillating on the terminal.
Then came the time to tweak the simulation. Sir asked us to discover new species. Just imagining the fact that I might find a new species in the huge ocean of the probabilistic matrix was awe-inspiring.
I wrapped the world of this simulation to allow an infinite space. Also provision for loading of discovered species into the world was given. Existing discoveries of interesting species was included in the simulation.

It was an interesting affair. I could watch these little bots moving on my screen for eternity. It has been an amazing experience coding this. And if you are interested to have fun, join the endeavor of finding new species.
 
 
 
I call this life a Village. It has a glider, blinkers which look like windmills, beehives, blocks which resemble huts, and loaves (food barn). I had fun, hope you do too.

Wiki URL : https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life