Showing posts with label Coding. Show all posts
Showing posts with label Coding. Show all posts

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

 

Wednesday, October 2, 2013

Code Guru: Gateways 2013

Very tight finish for the first 5 places
 

Parth Vora (I)
Samik Banik(II)
Udhay Raj (III) 

Rank 4-10 in order 

Vivian Ambrose,
Tenzin Chemi,
Talat Ahmed ,
Palak Goyal,
Pramod Das, 
Dharmappa Immannavar,
Bharat Lakkur

Congratulations !!!!


      World War Z

50 by 50 array where 
0 is empty 
1 is soldier
2 is Bullet
3 is Mine

       Level 1 Viewer   
               (Show 0 as space and soldiers as #, bullet as | and mine as * )
       Level 2 Set Army (x1,y1,x2,y2)  
       Level 3 March Past ( make a group of soldiers march in different directions N S E W)
       Level 4 Silver Bullet(when soldiers walk into it they die and bullet can kill umlimited no of soldiers)
       Level 5 Land Mine   (when soldiers step on it all around die)
       Level 6 Moving Bouncing Bullet
       Level 7 Armies, Bullets,Mines (support multiple battalions, mines and bullets)

Saturday, February 5, 2011

Code Guru : Revelation 2011


Winners: Heena Gupta (I) , Sowmya (II), Aditya G (III)

Other is top 10 in order
Charu J, Jyotsana, Raju K, Boopalan R, Rakesh K, Lakshminarayan, Nibedita S
Questions Were

1. In Zee land , they study Zaths. Some numbers are considered as Zamazing number and some as Zawesome
A number is considered Zawesome if 2109 is found somewhere in the number together
eg. 122312109876
A number is considered Zamazing if 2109 is found somewhere in the number
eg. 12921990982
Write a program to check if an inputted number is Zamazing or Zawesome or not

2. If A thinks of a 4 digit number in which each digit is unique, B takes a guess
eg. A thinks : 7345 B Says 9647 : A says 1 Zing (because 7 is correct but in wrong place) 1 Zong (because 4 is correct and in right place)
eg. A thinks : 7345 B Says 9347 : A says 1 Zing (because 7 is correct but in wrong place) 2 Zong (because 3 and 4 is correct and in right place)
Game is over if B Guesses 7345 and A says 4 Zongs !!!
Assume both numbers have no repetition of digit
Create a game where computer thinks of a 4 digit number and lets users answer with a 4 digit number . Computer should reply how many zings and zongs. Computer should allow user to attempt as many time needed to zolve the puzzle

3. Make a an array of 9 by 12 as shown in sheet 2.
0 means land 8 means rain drops
Make the exact landscape as displayed in the next sheet under Level 1
Level 1: Raindrops fall in each round but they do not go side ways
Level 2: Raindrops try to fall if not possible slide in case gap at lower level. In case 2 drops in contention for slide preference for the one drop which slides right as this is the Northern Hemisphere ??
Level 3: Multiple round of rain should work
Level 4: Make it work in this different landscape, If a drop can fall both left and right it will fall right
Level 5: In case a whole is made at bottom of the land show how the water will flow out

4.Make a variation of Zing Zong (question 2) where user thinks of a number and computer takes guesses
A good algo will solve any 4 digit number in 7 or less guesses