Monday, 8 April 2013

The Vivekananda Youth Forum

They say that helping other people gives you immense joy.

They say that going out of your way to brighten someone's day fills you with satisfaction.

They say that extending a hand to someone in need can go a long way.

They are absolutely right.

-

For some time now, I have been involved with a Mumbai-based organisation called the Vivekananda Youth Forum (yes, the one in the title). It is a 25 - year old NGO that seeks to harness the talent and hidden potential of each individual in an effort to work towards a progressive, dynamic society. It was inspired by the thoughts and beliefs of Swami Vivekananda, a great Indian reformer, activist and saint. One of their numerous ongoing projects is a center called Sandhyalaya (evening school). It is there that I go to play my role in the community.

Sandhyalaya is a "school" for children living in slums, and provides remedial education, which involves Mathematics, English, values, life skills - basically whatever is needed to turn these children into responsible citizens. There are about 40 or 50 kids in the program, and 7 or 8 of us who teach them. Although sometimes I get the feeling that the teaching is mutual.

-

Hunched over, face rapt with concentration, he painstakingly writes out the answer to the problem. With baited breath, I lean over and glance at the culmination of his efforts, hoping, praying that I see what I want to see. But it is not to be. The mistake glares up at me - so trivial, yet causing the two of us so much pain. My frustration almost bubbles over. I want to scream at the injustice of it all. I am not angry at him, I am angry because I want him to learn, to succeed, to experience the feeling that accompanies every solved problem. 
Breathing deeply, I keep my emotions at bay. Slowly, laboriously, I point out the error in his answer and guide him towards the right solution. This time he gets it - a flicker of a smile appears on his face as he hands me his notebook. I, too, am temporarily at ease. Although I can't help but wonder: How many more of these moments await us?



The first thing that I noticed about the children in Sandhyalaya was their instant acceptance of me. From the first day that I started going there, they accepted me into their sphere, as if I had grown up with them. I was met with an approving chorus of greetings and smiles. Slightly perturbed, I did my best to reciprocate: never in my life had I met with such enthusiasm on walking into a room. I marveled at them - these children lived in the worst of conditions, with the worst of environments to grow up in. Yet they had the courage and fortitude to smile. Filth and squalid hutments surrounded their ramshackle homes, yet they nurtured an incredibly positive outlook on life. Most of them had dysfunctional families, and yet they showed a desire to better themselves. Not once in our interactions have I heard them curse fate, not once have they bemoaned the unfairness of their lives. It makes me feel ashamed when I whine about my misfortune; and I think about these wonderful children, who brave unimaginable setbacks every single day of their lives.
They are literally made of different stuff.

The quality of education that these Sandhyalaya kids receive in their regular schools is below zero - some of them don't even get the chance to attend school everyday, due to the fact that they have to work and earn money just to account for their meals. As a result, their level is below that of an average child of their age group. The fact that english is not spoken in their homes only adds to their difficulties. Whatever english they speak is during school hours only - at home they slip back into their vernacular. One time I found myself explaining the meaning of the word 'languages' to a child in the 9th grade! It got me thinking about the futility of it all. But then I thought of the other volunteers and teachers around me who have dedicated half of their lives to this endevour, and I thought that maybe it wasn't as hopeless as I was making it out to be.

For every frustrating episode at Sandhyalaya, there is also a success story. One ex-student (name withheld for privacy) is currently pursuing a Bachelor's degree in Commerce and has even joined the National Cadet Corps program! And the most amazing part is that after all these years, she has returned - this time as a volunteer, to give back to the institute what it gave her!

Over time, I have come to love and admire these kids. Their successes are mine. And when they don't succeed, it's like a personal blow to me. Throughout the week, I look forward to my evening sessions with them. And why shouldn't I? I get to do my bit for society, I get to break out of my daily routine and help people and I get to spend some time with a few remarkable individuals. Each and every time I go there, I return home with a smile, tinged with sadness - sadness at the poor quality of life of so many people. And this is not even the tip of the iceberg. But I take heart in the fact that all over the world, there are committed individuals who are dedicating all their time to making this world a better place. And I take pride in the fact that I too am playing my part, in my capacity, and I vow to continue working for the greater good wherever irrespective of where I go in the future.

-

"If you haven't got any charity in your heart, you have the worst kind of heart trouble."
                                                                                                                   - Bob Hope

My first session at Sandhyalaya really changed me. It opened my eyes to the harsh reality of life, away from the sheltered environments of my home and school. The epiphany I experienced was like when the Grinch's heart grew three sizes, and a maelstrom of thoughts and emotions came surging up - Why didn't I start doing this years ago? What did these children do to deserve the life that they are living now? What can I do - How can I help?
I cried when I went home that night. I cried because I felt for these children, because the sheer inhumanity of their lives struck me, because I wanted a Utopian world where none of these problems would exist. I also cried because I realised that I was finally doing something where I could be of help to others, and I was grateful that I had made the decision to do so. I think that some of the tears were also because of the overwhelming hospitality I had received from the kids at Sandhyalaya.

I spent my first session at Sandhyalaya teaching a bright young boy how to factorise polynomials. He was quite receptive and could grasp concepts pretty well. As both of us got up after winding up the session, he told me something that no one had ever said to me before, with a genuine smile on his face:
"Thank you, sir."

It is moments like this that offset hours of frustration.

Monday, 4 March 2013

On Tennis, Rivalries and GOATS

The acronym GOAT, as used in tennis, stands for 'Greatest Of All Time'. It refers to those racket - wielding Demigods who make the sport look so easy with their prodigious talent and unquenchable thirst for victory. They are beyond human. They are beyond superhuman. They have, with their accomplishments, transcended the sport itself.

Throughout the history of lawn tennis, there have been a few elite players worthy of the GOAT title. Rod Laver, Bjorn Borg, John Mcenroe, Boris Becker, Jimmy Connors, Ivan Lendl, Pete Sampras and Andre Agassi naturally come to mind. And of course, we have the current 'Fab Four' of men's tennis - Roger Federer, Rafael Nadal, Novak Djokovic and Andy Murray, those superstars that are the epitome of the Golden Age of Men's Tennis.

But out of this collection of remarkable individuals, which single player can definitively be labelled the Greatest Of All Time? Which one of them can be placed on a pedestal and uplifted to a God-like status? Innumerable people have argued about this. Frustrating hours have been spent debating this question. Wars have been fought over this conundrum. And yet, a consensus has not been reached.

In this post, I am going to put forth my own views and talk about the current situation in the world of tennis. Hopefully, doing so will create some clarity in my own head, if not the minds of others.

-

Being an ardent follower of tennis myself,  I can only marvel at the dizzying heights which men's tennis has currently reached. The Fab Four have created a whole new game of their own, locked in their 4 - way rivalry, miles ahead of the rest of the field.


I want to use this post to talk about these 4 men, and the rivalries that have come to define the sport in recent years.

Andy Murray

Previously known as the 'Bridesmaid' of men's tennis, Andy was always the one who stood by the sidelines and let the other 3 taste Grand Slam glory. He came excruciatingly close to winning 4 Grand Slam finals, only to be beaten back every time (once by Djokovic, and thrice by Federer).

But he never gave up hope. Fighting like a true champion, he improved his game after every defeat, pushing himself to limits that even he didn't know existed. And success came in the form of a shiny US Open trophy, which he won after beating rival and long-time friend Novak Djokovic in a thrilling final in 2012.

His biggest rivalry is with Novak, and it's one that people are touting as the next big thing in tennis. However, with only 1 Grand Slam title under his belt, Murray is not, in my opinion, worthy of the GOAT title (Yet). All that may change in the years to come. We can only wait and watch as one of the survivors of the Dunblane School Massacre strives to reach the pinnacle of his sport.

Novak Djokovic

Currently the best tennis player in the world, Djokovic is a supreme athlete, an indefatigable fighter, and probably one of the best hard court players ever. He emerged on the scene as a brash, aggresive player when he shocked the world by beating Federer in the 2008 Australian Open final. He has, however, mellowed down over the years, becoming a more mature, more confident player, yet not losing that killer instinct even one bit.

And his endurance and strength (mental and physical) are, well, the stuff of legend. He has managed to push his body to a jaw-dropping level of fitness. Novak is not just one of the fittest tennis players, he's one of the fittest people on the planet. Combine that with his hunger for titles and never-say-die attitude and you have a champion indeed.

Novak has a thrilling rivalry with all the other 3 - Federer, Nadal and Murray. During his remarkable 2011 season, he was on a 41 match winning streak, that was stopped only by Federer at the French Open. That particular season has been described by many as one of the best in tennis history. During that year, he swept up the Australian Open, Wimbledon and US Open titles.

In the present, Novak is in astonishing form, and is the man to beat. Look forward to many more titles from him in the coming months.

Rafael Nadal

In the unique history of tennis, there has probably not been any player as successful on any single surface as Rafael Nadal on clay. It's as if he was born from the red clay of the French Open. When he steps on to a clay court, it's as if the Gods themselves favour him, as he decimates whoever dares stand on the other side of the net.

With 11 Grand Slam titles (7 of them being at the French Open!), Nadal is surely on of the main contenders for the title of the GOAT. He is a relentless tennis player, tiring his opponents with his powerful baseline play,  striving to run after every ball that comes his way. In an amazing 2008 Wimbledon final (which many call the greatest tennis match of all time), Nadal chased down everything Federer could throw at him, as he wrested the title away from the Swiss master. That year, he proved that he wasn't just a clay court specialist, but a remarkable all-round player, capable of winning on any surface in any part of the world.

The Nadal - Federer rivalry is one of the most gripping rivalries in the the history of sport. While the head to head count is skewed in Nadal's favour (18-10), every single match of theirs has been a titanic encounter between the 2 greatest tennis players of their generation. Whenever a Federer-Nadal battle was underway, I would drop whatever I was doing at that time, and just marvel at the intensity of their game.

While Nadal has been out of action for the past 8 months due to a serious knee injury, he has made a successful comeback to the professional tour, and he's looking more dangerous than ever. I'm sure many a player is shaking in his shoes at the thought of facing Rafa again.

Roger Federer

How does one describe a man with a record 17 Grand Slam titles? A man who has dominated the world of tennis for the past decade? A man who, even at the age of 32, is not even contemplating retirement?

One simply cannot.

I am a true-blue Roger Federer fan. One hundred percent. So naturally, my words will be baised. But I will try to remain as dispassionate as possible, and keep the hero-worshpping to a minimum.

If Rafael Nadal is the God of Clay, then Roger Federer is definitely the Grass Court King. Having won 7 Wimbledon titles, he can definitely say that he owns the green lawn of Wimbledon. Many of his most exciting matches and greatest victories have come at the All England Lawn Tennis and Croquet Club.

In the word's of Jimmy Connors, "In the modern game, you're either a clay court specialist, a hard court specialist, or a grass court specialist . . . or you're Roger Federer." These words accurately sum up the performance of the Swiss Maestro, a man who has been one of the most prolific winners across all surfaces in the past decade.

When he plays, the world watches. When he plays, he creates a spellbinding sort of tennis magic with his elegant strokes. And when he plays at his best, he creates an aura of invincibility around him. His forehand groundstroke is considered one of the best ever, he is never afraid to chip and charge up to the net, and his game is complete - in every sense of the word.

Federer's biggest critics argue that he cannot be called the best player of all time as he has a losing head-to-head record against Nadal, his biggest rival. While this is most certainly true, his almost flawless record over the past 10 years shows just what kind of tennis player he is. He won 3 Grand Slams in a year, thrice (in 2004, 2006 and 2007) - an astounding feat by itself. While he may not have the stamina of Djokovic or Nadal's ability to reach every ball, his raw talent and majestic game make him who he is.

Roger Federer's wikipedia page states that many tennis analysts, critics and former players consider him to be THE greatest tennis player of ALL TIME. I couldn't agree more. He is a man who is synonymous with tennis, a man who hasn't lost the knack of winning, even though he is quite a few years older than his biggest rivals.  

Go Roger! (sorry for the fangirlism . . . . I just couldn't resist)


The Fabulous Four - Djokovic, Federer, Nadal, Murray

I've said what I wanted to say. I have put forth my opinions on these four extraordinary sportsmen. My job is done for now.

As for who should be called the GOAT, my opinion is pretty clear (like I said, I'm a Federer man through and through). But I leave it to you to decide.




Sunday, 23 December 2012

Photo Journal, Part 2

Hi guys!

As promised, I'm back with the continuation of my Photo Journal. Those who haven't read the first part can go to my post titled 'Photo Journal, Part 1'.

A quick recap: In part 1, I showed you some of my favourite photographs, divided into 2 groups: Group 1 on the photos I took during my road trip in the Himalayas, and Group 2 containing my best wildlife photographs. I had left Group 2 unfinished, which I shall be finishing in this post.

So, here goes:


Group 2 - Wildlife (Continued):

4) Brahminy Kite, taken in Shoja, Himachal Pradesh, India.



5) Shoe-Billed Stork, taken in Jurong Bird Park, Singapore. This one's a real angry bird!



6) Eye of the Peacock - taken in Dapoli village, Maharashtra, India.



7) I really don't know the name of this moth/butterfly, but it looks magnificent. Taken in Spiti Valley. Himachal Pradesh, India.



8) This is a photo of a Glassy Lizard, taken in a forest in Goa, India. It is probably my most prized photograph - I love the effect created by the interplay of light and shadows!




Anyway, that concludes my photo journal.

Hope you liked it!

Signing off,
Pratik.

Photo Journal, Part 1

Apparently, a picture says a thousand words. If so, then this blog post contains more than seventeen thousand words - quite a staggering number, isn't it? Read on if this has piqued your curiosity......

My interest in digital photography grew exponentially around the time I was in the 7th grade. Maybe it was because of my father, who has always been somewhat of a camera buff himself. Maybe it was because of my uncle, who had just bought a brand-new, awesome camera back then. I don't really know. What I do know is that I have loved photography ever since, and given the chance, I am more than willing to spend hours with my camera.

I love being able to capture the memorable moments of my life and the lives of those around me - some of them sad moments, some happy, some just plain hilarious, and some which induce introspect. Every time that I go back to a photograph that I have clicked, I see it in a new light; I see another aspect, another dimension to it. To me, photography is a way of immortalising a beautiful vista, or an inexpressible emotion.

Nature photography is something that I thoroughly enjoy and is very close to my heart (wildlife and environmental conservation is something that I care deeply about). Nothing matches the glory and beauty of a photograph of a massive, ancient Banyan tree, or a snap of a hawk soaring high. For me, part of the fun lies in the actual process of obtaining the picture - chasing a frisky woodpecker through a forest, or waiting in dead silence to photograph a timid Chital deer.

As the title suggests, this post is a photo journal of some of my favourite snaps out of all the photos I have ever clicked. Each one is special to me for a reason - because of the colours and clarity of the picture, the significance of the moment, or simply the overall effect of the photograph. I have divided the pictures into two main groups: Group 1 contains pictures I took on my 15 day road trip with my family in the Kinnaur and Lahaul-Spiti regions of the Himalayas (in Himachal Pradesh, India) during the summer of 2010, a journey that is one of the most memorable ones I have been on. Group 2 is a collection of my best (according to me) wildlife photos. I took all of these photographs with a Canon SX 10 Ultrazoom camera.

I guess I'll just get started with the photos now:


Group 1 - Himalayan Odyssey:

1) A beautiful snowdrift on a distant peak that I managed to capture while camping in Sangla village, Kinnaur:



2) Three adorable kids in a small hamlet in Hamchal Pradesh. You can't but help marvel at their expressions!



3) During the last 8 days of the trip, we were surrounded by dry ravines, barren, snowcapped mountains, and azure skies, with hardly any vegetation in sight, as we journeyed in the Spiti valley. Albeit a non-conventional kind of beauty, but beauty nonetheless!









4) This is a panoramic photograph of a mountain near Tabo village in the Spiti Valley. For some reason, it reminded me of chocolate ice-cream.



5) I just love the colour contrast between the sky and the mountainside in this one:




Group 2 - Wildlife:

1) Vulture in Spiti Valley, Hamichal Pradesh:



2) A Hanuman Langur silhouetted against the evening sky. Taken in Dandeli Forest Reserve, Karnataka, India.



3) Great Pied Hornbill, taken in Dandeli Forest Reserve, Karnataka, India.



I shall be ending this post here. But the photojournal is not yet done. It will be continued in my next blog post.

Good bye for now.


Pratik.



Wednesday, 19 December 2012

Mastermind

Hello world!

While this opening statement may sound cliche, I have used it for a very specific purpose - it's related to the main theme if this post. The phrase is a reference to the classic 'Hello World' computer program (Humorous wordplay. Ha ha). To the uninitiated, the 'Hello World' program is a computer program that displays the sentence 'Hello world!' on a display device - it is generally one of the easiest programs to write, irrespective of the language used. To those of you who got the reference, I suppose there is no point in explaining it and rendering the pun moot. 

So I'm guessing that a lot of you have by now guessed what this post is all about. You're actually partially correct. Yes, this post is about computer programming. But no, it is not a generic post describing a programming language or its evolution.


In the 9th and 10 grade, I took a course in Java programming in high school. It was incredible fun - but I'm not going to focus on that right now (maybe in a later post). Anyway, after I started to get a feel of the language and had completed taking my first baby steps in program writing, I decided to get a little more adventurous. I consolidated my knowledge and Java coding skills and made up my mind - I was going to develop a  . . . . DUN DUN DUN . . . . game.

For my ambitious project (or so it seemed to me), I decided to develop a text-based emulator of the hugely popular board game, Mastermind. (Yes, the one with the coloured pegs). If you haven't heard of or played it, I suggest that you read up on the game before going further into this post (the Wikipedia article on the game is excellent).

In my version of the game, the user plays against the computer. It is the computer that decides the sequence of colours and the user who has to deduce the colour code in 10 turns. As in the original game, the computer does provide a clue after each turn. I haven't kept any provision for it to be the other way around - maybe I'll come up with that one some day. My first beta testers were my parents (my father is the one who introduced me to mastermind in the first place, way back when I was a kid) and my high school course teacher. 

I wrote the code using Java on BlueJ as an Integrated Development Environment (IDE). It turned out pretty well and I'm quite proud of it. While I haven't put it up on the Internet, I have put up the entire code below. Those of you who are interested in reading the code can scroll down the page.

-

CODE FOR MASTERMIND EMULATOR (IN JAVA):


import java.lang.*;
import java.io.*;

public class Mastermind
{
    long noseq[];
    int noseq2[];
    String seq[];
    String eseq[];
    char tmpseq[];
    int white;
    int black;
   
    static String nm;
    static String lines[];
    static int wordcnt = 0;
   
    public Mastermind()
    {
        noseq = new long[4];
        noseq2 = new int[4];
        seq = new String[4];
        eseq = new String[4];
        tmpseq = new char[4];
        white = 0;
        black = 0;
        nm = new String();
        lines = new String[20];
        wordcnt = 0;
    }
   
    public static void timeloop()
    {
        for(double j = 0.0; j < 25000000.0; j++)
        {
        }
    }
   
    public void timeloop2()
    {
        for(double i = 0; i < 7500000000.0; i++)
        {
        }
    }
   
    public void genSequence()
    {
        for(int i = 0; i < 4; i++)
        {
            noseq[i] = Math.round(Math.random()*10);
           
            if(noseq[i] > 6)
            noseq[i] -= 6;
           
            if(noseq[i] < 1)
            noseq[i] += 1;
        }
                    
        for(int i = 0; i < 4; i++)
        {
            noseq2[i] = (int)(noseq[i]);
        }
    }
   
    public void saveSeq()
    {
        for(int i = 0; i < 4; i++)
        {
            switch(noseq2[i])
            {
                case 1: tmpseq[i] = 'G';
                break;
               
                case 2: tmpseq[i] = 'B';
                break;
               
                case 3: tmpseq[i] = 'R';
                break;
               
                case 4: tmpseq[i] = 'Y';
                break;
               
                case 5: tmpseq[i] = 'P';
                break;
               
                case 6: tmpseq[i] = 'O';
                break;
            }
        }
    }
   
    public void assignColours()
    {
        for(int i = 0; i < 4; i++)
        {
            if(noseq[i] == 1)
            {
                seq[i] = "Green";
            }
       
            else if(noseq[i] == 2)
            {
                seq[i] = "Blue";
            }
       
            else if(noseq[i] == 3)
            {
                seq[i] = "Red";
            }
       
            else if(noseq[i] == 4)
            {
                seq[i] = "Yellow";
            }
       
            else if(noseq[i] == 5)
            {
                seq[i] = "Purple";
            }
       
            else if(noseq[i] == 6)
            {
                seq[i] = "Orange";
            }
        }
    }
   
    public void instructions()
    {
        System.out.println();
        System.out.println("There are 6 main colours in this game: Green, Blue, Red, Yellow, Purple & Orange.");
        System.out.println("Each colour has a corresponding letter:");
        System.out.println("G – Green");
        System.out.println("B - Blue");
        System.out.println("R - Red");
        System.out.println("Y - Yellow");
        System.out.println("P - Purple");
        System.out.println("O - Orange");
        System.out.println("The letters written next to the colours are used to select the respective colours during the game.");
        System.out.println("It is recommended that you write down the color code(key) as it will not be displayed again.");
        timeloop2();
               
        System.out.println();
        System.out.println("The computer will select a random sequence of 4 colours out of the 6 main ones.");
        System.out.println("A colour may be repeated.");
        System.out.println("Your job is to deduce the correct sequence of colours in 10 chances.");
        System.out.println("In each chance, you will have to enter your own sequence to see if it matches with the computer’s sequence.");
        System.out.println("After you have entered your sequence, the computer will compare the 2 sequences & display a message.");
        System.out.println("If a colour in your sequence is present in the computer’s sequence at the same position, you will be");
        System.out.println("given a white peg (the word white will be written on the screen).");
        System.out.println("If a colour in your sequence is present in the computer’s sequence but at a different position, you ");
        System.out.println("will be given a black peg (the word black will be written on the screen).");
        timeloop2();
       
        System.out.println();
        System.out.println("Example 1:");
        System.out.println("Computer’s sequence:  Green Blue Red Yellow");
        System.out.println("Your sequence:       Green Orange Yellow Red");
        System.out.println("Display:              1 white & 2 black");
        System.out.println("Green is at the same position in both sequences (1 white).");
        System.out.println("Red is at different positions in the 2 sequences(1 black).");
        System.out.println("Yellow is at different positions in the 2 sequences(1 black).");
        timeloop2();
       
        System.out.println();
        System.out.println("Example 2: ");
        System.out.println("Computer’s sequence:    Orange Orange Purple Yellow");
        System.out.println("Your sequence:         Orange Red Purple Green");
        System.out.println("Display:               2 whites");
        System.out.println("Purple at position 3 in both – 1 white");
        System.out.println("Orange at position 1(your sequence) & position 1(computer’s sequence) – 1 white");
        System.out.println("The orange at position 2(computer's sequence) will not give a black peg as the orange at 1 is giving a white.");
        System.out.println("This holds true for all such cases in the game.");
        timeloop2();
        System.out.println();
       
        wordcnt = 0;
       
        lines[0] = "You will get 10 chances to solve the code.";
        lines[1] = "In every chance, you will have to enter a sequence based on the result of the previous sequence.";
        lines[2] = "The sequence should consist of only the starting letters of 4 colours based on the key displayed earlier.";
        lines[3] = "Example: For Green Blue Red Yellow, you will enter – GBRY (no spaces!!). ";
        lines[4] = "You are now ready to play the game. Good Luck!!! ";
        while(wordcnt < 5)
        {
            timeloop();
               
            for(int i = 0; i < lines[wordcnt].length(); i++)
            {
                System.out.print(lines[wordcnt].charAt(i));
                timeloop();
            }
           
            System.out.println();
            wordcnt++;
        }
        System.out.println();
        System.out.println();
    }
    public void game()throws IOException
    {
        String ch = new String();
        char ch1[] = new char[4];
        white = 0;
        int wh[] = new int[4];
        black = 0;
        int bl[] = new int[4];
        int cnt = 1;
              
        InputStreamReader reader = new InputStreamReader(System.in);
        BufferedReader input = new BufferedReader(reader);
       
        System.out.println("The computer has selected a random sequence of 4 colours. You have 10 chances to deduce it.");
        System.out.println("A final reminder: the 6 colours are - Green, Blue, Red, Yellow, Purple & Orange.");
        System.out.println("PLEASE TURN ON THE CAPS LOCK ON YOUR KEYBOARD AS ALL SEQUENCES HAVE TO BE ENTERED IN CAPITAL LETTERS ONLY!");
        System.out.println();
       
        outer:
        do 
        {
            saveSeq();
           
            System.out.print("Chance " + cnt + ":         ");
       
            ch = input.readLine();
           
            for(int i = 0; i < 4; i++)
            {
                ch1[i] = ch.charAt(i);
            }
           
            for(int i = 0; i < 4; i++)           //white
            {
                if(ch1[i] == tmpseq[i])
                {
                    wh[i]++;
                    ch1[i] = 'Z';
                    tmpseq[i] = 'Z';
                }
            }
       
       
            for(int i = 0; i < 4; i++)           //black
            {
                for(int j = 0; j < 4; j++)
                {
                    if(i != j)
                    {
                        if((ch1[i] == tmpseq[j]) && (ch1[i] != 'Z'))
                        {
                            bl[i]++;
                            ch1[i] = 'Z';
                            tmpseq[j] = 'Z';
                        }
                    }
                }
            }
           
            for(int i = 0; i < 4; i++)
            {
                black += bl[i];
                white += wh[i];
            }
           
            if(white == 4)
            {
                System.out.println();
                System.out.println("Congratulations " + nm + "! You have won the game.");
                break outer;
            }
            
            else
            {
                System.out.print("                                " + black + " Black & " + white + " White");
                System.out.println();
                System.out.println();
               
                for(int i = 0; i < 4; i++)
                {
                    wh[i] = 0;
                    bl[i] = 0;
                }
            }
           
            black = 0;
            white = 0;
           
            cnt++;           
        }
        while(cnt <= 10);
       
        System.out.println();
       
        if(white != 4)
        {
            System.out.println(nm + ", you have been unable to deduce the correct code. You have lost the game.......");
            System.out.println("The correct sequence was:");
            for(int i = 0; i < 4; i++)
            {
                System.out.print(seq[i] + " ");
            }
        }
    }
   
    public static void main()throws IOException
    {
        Mastermind mf4 = new Mastermind();
       
        InputStreamReader reader = new InputStreamReader(System.in);
        BufferedReader input = new BufferedReader(reader);
       
        int ch = 0;
        wordcnt = 0;
       
        lines[0] = "Welcome to Pratik Gandhi's version of the all time classic game - MASTERMIND!!!!!!!";
        lines[1] = "This game is a challenge for people of age 10 & above.";
        lines[2] = "All you need to play this game is a peice of paper, a pen and some logic.";
        lines[3] = "";
        lines[4] = "To get started, type in your name & then press enter.";
        while(wordcnt < 5)
        {
            timeloop();
               
            for(int i = 0; i < lines[wordcnt].length(); i++)
            {
                System.out.print(lines[wordcnt].charAt(i));
                timeloop();
            }
           
            System.out.println();
            wordcnt++;
        }
        nm = input.readLine();
        System.out.println();
        wordcnt = 0;
       
        lines[0] = "To play after reading the instructions, press 1 & then press enter.";
        lines[1] = "To start the game straightaway, press 2 & then press enter.";
        while(wordcnt < 2)
        {
            timeloop();
               
            for(int i = 0; i < lines[wordcnt].length(); i++)
            {
                System.out.print(lines[wordcnt].charAt(i));
                timeloop();
            }
           
            System.out.println();
            wordcnt++;
        }
        System.out.println();
        wordcnt = 0;
       
        ch = Integer.parseInt(input.readLine());
       
        switch(ch)
        {
            case 1:
            {
                mf4.instructions();
                mf4.genSequence();
                mf4.saveSeq();
                mf4.assignColours();
                mf4.game();
            }
            break;
           
            case 2:
            {
                mf4.genSequence();
                mf4.saveSeq();
                mf4.assignColours();
                mf4.game();
            }
            break;
        }
    }
}


CODE ENDS HERE.


That's all for this post.

Hope you enjoyed it!

Pratik.

Tuesday, 27 November 2012

Kooky

Hey.

This post is about someone very special to me.

I adore her and she adores me back. My mood lightens up every time I see her. If I've had a rough day, I seek comfort in her presence - the most amazing part is that she is always there to listen.

For those of you who have started to think I'm talking about my girlfriend, this is who I am actually talking about:
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.



Yep. 'She' is my canine best friend:  Kooky.

Kooky actually is my 'semi-pet'. What do I mean by that?
She is technically a stray dog, but chooses to spend almost all of her time in the building in which my apartment is. She has been a resident of the building since before we moved in, and my parents, this other family living in the building and I take care of her. It's hard to guess her age, since she's always so youthful and full of life!

You might be wondering why we named her Kooky, especially when the more conventionally used pet name 'Cookie' was already available. (And no, it wasn't just for the sake of originality)
We call her Kooky because she really is Kooky. And by Kooky, I mean a wee bit crazy. (Don't look so shocked. I still love her and everything) It's just that her behaviour is a little weird. At some time during the day, she might be lying peacefully under the shade of a tree, the epitome of quiet indifference. While at some other time, she would be racing up and down the street, jumping like a circus performer, and just acting totally whacky. It's almost as if she suffers from a Split - Personality Disorder: Dr. Dog and Mrs. Crazy!

Although Kooky has a beautiful voice (I've heard her bark at other dogs), she rarely makes a sound, except when another canine strays into her territory. The amazing thing is that she has a voice, yet she CHOOSES to remain silent! It's like she's a saint or something. Her self-imposed muteness is one of the things that makes her so mysterious and enigmatic.

The past 4 years of my life have been graced with Kooky and her fun-loving, carefree nature. She reminds me that being in a good mood can really make life seem much rosier. And she always knows how to bring a smile to my face.

This post is for you, Kooky.




Tuesday, 20 November 2012

Science Fiction

Boldly Going Where No Man Has Gone Before


Hi.

I know it's been a while since I've written a blog post. It's just that I have been SO SO busy with facebook my exams. I shall definitely update my blog more frequently from now on. (I promise)

Anyway, that's enough of my excuses. Now, on to the main topic of this blog : 

Science Fiction. (I'm already salivating)

A couple of weeks ago, I started reading my first Isaac Asimov novel: 'The Caves of Steel', part of his series on robots. (Yes, I know - I started reading Asimov pretty late in life - I'm disgusted with myself too. Somehow I never came around to reading his work, which is surprising, since I ABSOLUTELY LOVE TO READ.)



















As expected, I loved it. It bound me in a web of literary fantasy. It floored me. It left me craving for more. I loved how he managed to integrate robots into human society (although there were a few bumps along the way) and how his characters literally came to life. As science fiction, it was every bit as exciting as it promised to be.

However, what amazed me most was how a writer in the 1940's and 50's could have possibly foreseen a future so far ahead and so far removed from his time! The more I thought about it, the more mind - blowingly   (pardon me, grammar Nazi's) amazing it seemed. In his time there were no personal computers, no mobile phones, manned spacecraft had not yet been launched. And yet there was this man - a remarkable individual possessing powerful foresight. You could say he was the da Vinci of his time.

Asimov himself believed that his most enduring contributions would not be his work as a biochemist or the textbooks on science that he wrote, rather his famous Three Laws of Robotics. They boggled people's minds. They gained a cult following of their own. Such was the 'scientific imagination' of Isaac Asimov.

(For those unacquainted with Asimov's 3 laws of robotics, here they are:

1. A robot may not injure a human being, or, through inaction, allow a human being to come to harm.
2. A robot must obey all orders given it by human beings except where such orders would conflict with the 1st law.
3. A robot must protect its own existence as long as such protection does not conflict with the 1st or the 2nd law.)

Another man who had similar visionary thinking was Gene Roddenberry, the creator of Star Trek. His brainchild elevated him to the status of international icon. As a die-hard Star Trek fan myself, I have a great deal of respect for the man. In the 1960's, when technology was still primitive by today's standards, Gene Roddenberry envisioned phasers, the warp drive, a galactic federation of planets and an era when man's primary aim was not the accumulation of wealth, but the expansion of his knowledge and preservation of galactic peace!

The 3 heroes of the original Star Trek series 


Granted, the special effects seen on the original Star Trek series might seem outdated compared to the visual feast that is Avatar or the Transformers movies, but what it lacked it graphics it made up for in ideas and imagination. The technology shown in Star Trek - laser guns, spacecraft travelling faster than light, teleportation, is technology that we might see after hundreds of years (if at all we do obtain it)! American physicist Michio Kaku credits Star Trek with being one of the factors that got him interested in science in the 1st place. In his books 'Visions' and 'Physics of the Impossible' he explains how the technology seen on Star Trek might one day become reality.

Science fiction might one day become reality. (How I ache for that day!) What seems like exaggerated imagination today might become commonplace many years from now. What shouldn't change, however, is man's thirst for achieving the impossible. The world needs more Asimovs and Roddenberries if we are to convert science fiction into scientific fact. 

The world needs its thinkers. But what it needs even more is its dreamers. 

Live long and prosper.