July 02, 2012

My first hand at PROgramming

I came across the word programming in my eighth grade when I had no idea of what it is. Only cin and cout of C++ was taught when I had already started feeling I knew a great deal! In fact, even after my second semester got over, i.e. a few weeks ago, i was still under the false notion that I had a taste of what coding was.

Nevertheless, after semester II exams I was determined to understand a lot more about computers. Afterall, I was finally gonna do Computer Engineering! So, here it goes...

I started thinking of how much I knew in java. Then the rest I coped up Complete Reference by Herbert and Schildt. Then "Text Twist" was already on my mind since the P.L. had begun. (Actually, I was planning on a sudoku but it failed miserably!)

And there I was firm that I was gonna do TextTwist. Initially I had thought of making packages and then putting them together. Then I realised, I sucked at it! So first got started with the layout. Placed buttons, labels, etc etc. Inspired from my classmates, I thought that the background of my game shouldnt be a block of color. And hence, there I began, using Photoshop. Just clicking on random colors and gradient styles, I managed to pull off three decent images.

Then with the help of Anish, Kevin and Yashaswi, the background got finalised and I could play with one word. I was content with what I had done so far. Then began the real task, adding more words. So first Iwent through all file handling tutorials, believe me, this link has got everything you need (It saved my life):
Next I created my own list of 6 words and it was working well. My quest increased to ore number of words.

Google- all seven letter words.
There is one link you get with many meaningless words attatched to them! It made no sense asking the player to guess a meaningless word. So another 5000 meaningful wordlist was what I got. I copied the list to a txt file. Now I had two tasks:
1. Getting rid of the numbering before every word (1 to 5000!)
2. Seperating the 7 lettered words.

Initially I thought I would write a java code for both and alter my file then, realising that I was not able to solve the endless errors I kept getting, I opened my txt file in notepad.
Kept staring it for two minutes.
Step 1: Edit ---> Replace
Step 2: Find what: 1
Step 3: Replace with:
Step 4: Hit Replace!
Similarly all my numberings vanished! I was elated with the little common sense that struck my brain! :P

I managed to write down a code to seperate my 7 lettered words and then collaorated it with the game. It worked! The game had everything it needed, except - the text file had words in the small case which I had to convert to uppercase.
This time coding a java program was going tough, I was dumbstruck for two days.

Then, I tried finding tools in MSword to convert toUpperCase and I failed. Suddenly, the eureka moment arrived when my very own idea of find and replace could be used! a was replaced with A; b with B and in no time z with Z :)

Ran the game again,
it was perfect! Like how I wanted it to be!!

contains a zip folder of the game.
Although my graphics are very limited, code is not a smart one, yet the feeling of getting it right still makes me happy.

The whole process was a big learning, I enjoyeds every little bit of what I did and now, I am totally on with Programming!!
The more I code, the more I love doing it.
Guess I found a new passion... :)


No comments:

Post a Comment

Leave me a feedback, I'll be glad to hear you!

Popular Posts