Sunday, February 28, 2010

A simple Java-based Program

hey there,am back....this time, it's java. given below is my code for a simple one-player cum(no pun intended, you pervert!) two-player
TicTacToe game...i coded it in java on BlueJ Environment but it works the same in any Java editor...
you are free to copy the code (its below the seperator) and check out the output after compilation (don't worry, there ain't no syntax or
logical errors)...have fun...just one thing, please don't forget to give me credits whenever some one lese scrutinizes your copy of the
code...thanks...
ps:- if you ain't no programmer, then you are free to just check out the code and marvel at the beauty of Java...

============================================================================================================================================

/**Author:- Aakash, the Angel of Death
 * Version:- 1.1
 * Comments:- This is a simple, user-friendly game. Parts of the code from the original has been modified to increase its compatibility with users.
 *            This is a freeware, not meant for commercial use. Can be didtributed freely.
 *            All rights reserved. No part of the code can be copied without prior permission.
 *            Enjoy!!!
 */

/**Instructions:- This is a two-player game. It is controlled entirely by the key-board. There is no requirement of the mouse.
 *                To make a move, enter the place where you want to put in your symbol i.e either a 'X' or an 'O'.
 *                The layout is shown below with corresponding place numbers.
 *                   |   |
 *                 1 | 2 | 3
 *               ----|---|----
 *                 4 | 5 | 6
 *               ----|---|----
 *                 7 | 8 | 9
 *                   |   |
 *                Enjoy yourself...
 *               
 *Contact:- e-mail: jens.aakash@gmail.com
 *          phn:- +919432555534
 *          facebook:- search for "Aakash Einstein"
 */

import java.io.*;
class TicTacToe
{
    public static void twoPlayers()
    {
        System.out.println("Instructions:- This is a two-player game. It is controlled entirely by the key-board. There is no requirement of the mouse.");
        System.out.println("               To make a move, enter the place where you want to put in your symbol i.e either a 'X' or an 'O'.");
        System.out.println("               The layout is shown below with corresponding place numbers.");
        System.out.println("                  |   |");
        System.out.println("                1 | 2 | 3");
        System.out.println("              ----|---|----");
        System.out.println("                4 | 5 | 6");
        System.out.println("              ----|---|----");
        System.out.println("                7 | 8 | 9");
        System.out.println("                  |   |");
        System.out.println("               Enjoy yourself...\n\n");
       
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String arr[][] = new String[3][3];
        String p1 = "", p2 = "";
        int i, j, c=1, f=0;
        for(i=0;i
        {
            for(j=0;j
            {
                arr[i][j] = ".";
            }
           
        }
        do
        {
            try
            {
                System.out.print("Enter player 1's name : ");
                p1 = br.readLine();
                f=0;
            }catch(Exception e)
            {
                f=1;
            }
        }while(f==1);
        do
        {
            try
            {
                System.out.print("Enter player 2's name : ");
                p2 = br.readLine();
                f=0;
            }catch(Exception e)
            {
                f=1;
            }
        }while(f==1);
        f=0;
        i=1;
        for(i=0;i<9;i++)
        {
            if(c%2!=0)
            {
                System.out.println("\n"+p1+"'s move.");
                enter(arr,c);
                c++;
            }
            display(arr);
            if(hasWon(arr))
            {
                f=1;
                break;
            }
            if(isFull(arr))
            break;
            if(c%2==0)
            {
                System.out.println("\n"+p2+"'s move.");
                enter(arr,c);
                c++;
            }
            display(arr);
            if(hasWon(arr))
            {
                f=2;
                break;
            }
            if(isFull(arr))
            break;
        }
        System.out.println("\n\nFinal state : ");
        display(arr);
        if(f==1)
            System.out.println("\n\nCongartulations "+p1+"!!! You win!!!");
        else if(f==2)
            System.out.println("\n\nCongratulations "+p2+"!!! You win!!!");
        else
            System.out.println("\n\nNo winner. Game even.");
        System.out.println("\f");
        main();
    }
    static void display(String arr[][])
    {
        System.out.println("\f");
        System.out.println("                  |   |");
        System.out.println("                1 | 2 | 3");
        System.out.println("              ----|---|----");
        System.out.println("                4 | 5 | 6");
        System.out.println("              ----|---|----");
        System.out.println("                7 | 8 | 9");
        System.out.println("                  |   |");
        System.out.println();
        for(int i = 0;i<3;i++)
        {
            for(int j=0;j
            {
                System.out.print(arr[i][j]+" ");
            }
            System.out.println();
        }
    }
    static String[][] enter(String arr[][],int j)
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int i=0, f=0, r=0, c=0;
        if(j%2!=0)
        {
            do
            {
                try
                {
                    System.out.print("Where do you want to enter your move? : ");
                    i = Integer.parseInt(br.readLine());
                    f=0;
                }catch(Exception e)
                {
                    f=1;
                }
            }while(f==1);
            switch(i)
            {
                case 1 : r=0; c=0;
                break;
                case 2 : r=0; c=1;
                break;
                case 3 : r=0; c=2;
                break;
                case 4 : r=1; c=0;
                break;
                case 5 : r=1; c=1;
                break;
                case 6 : r=1; c=2;
                break;
                case 7 : r=2; c=0;
                break;
                case 8 : r=2; c=1;
                break;
                case 9 : r=2; c=2;
                break;
                default :
                System.out.println("Wrong move. Please re-enter.\n");
                enter(arr, j);
                break;
            }
            if(arr[r][c].equals("."))
            arr[r][c]="X";
            else
            {
                System.out.println("Position already filled. Please enter a different position.\n");
                enter(arr, j);
            }
        }
        else if(j%2==0)
        {
            do
            {
                try
                {
                    System.out.print("Where do you want to enter your move? : ");
                    i = Integer.parseInt(br.readLine());
                    f=0;
                }catch(Exception e)
                {
                    f=1;
                }
            }while(f==1);
            switch(i)
            {
                case 1 : r=0; c=0;
                break;
                case 2 : r=0; c=1;
                break;
                case 3 : r=0; c=2;
                break;
                case 4 : r=1; c=0;
                break;
                case 5 : r=1; c=1;
                break;
                case 6 : r=1; c=2;
                break;
                case 7 : r=2; c=0;
                break;
                case 8 : r=2; c=1;
                break;
                case 9 : r=2; c=2;
                break;
                default :
                System.out.println("Wrong move. Please re-enter.\n");
                enter(arr, j);
                break;
            }
            if(arr[r][c].equals("."))
            arr[r][c]="O";
            else
            {
                System.out.println("Position already filled. Please enter a different position.\n");
                enter(arr, j);
            }
        }
        return arr;
    }
    static boolean hasWon(String arr[][])
    {
        int i, j, p1=0, p2=0;
        for(i=0;i
        {
            for(j=0;j
            {
                if(arr[i][j].equals("X")==true)
                    p1++;
                else if(arr[i][j].equals("O"))
                    p2++;
            }
       
            if(p1==3 || p2==3)
                return true;
        p1=0;
        p2=0;
        }
               
        for(i=0;i
        {
            for(j=0;j<3;j++)
            {
                if(arr[j][i].equals("X"))
                    p1++;
                else if(arr[j][i].equals("O"))
                    p2++;
            }
       
            if(p1==3 | p2==3)
                return true;
        p1=0;
        p2=0;
        }
       
        for(i=0;i
        {
            if(arr[i][i].equals("X"))
                p1++;
            else if(arr[i][i].equals("O"))
                p2++;
        }
        if(p1==3 | p2==3)
            return true;
        p1=0;
        p2=0;
        for(i=0,j=2;j>=0;i++,j--)
        {
            if(arr[i][j].equals("X"))
                p1++;
            else if(arr[i][j].equals("O"))
                p2++;
        }
        if(p1==3 | p2==3)
            return true;
        return false;
    }
    static String[][] computersMove(String arr[][])
    {
        int i, j, p=0, k, m, r, c, q=0;
        for(i=0;i
        {
            for(j=0;j
            {
                if(arr[i][j].equals("X"))
                p++;
                else if(arr[i][j].equals("O"))
                q++;
            }
        if(q==2)
        {
            for(k=0;k<3;k++)
            {
                if(arr[i][k].equals("."))
                {
                    arr[i][k] = "O";
                    return arr;
                }
            }
        }
        q=0;
        if(p==2)
        {
            for(k=0;k<3;k++)
            {
                if(arr[i][k].equals("."))
                {
                    arr[i][k] = "O";
                    return arr;
                }
            }
        }
        p=0;
    }
    p=0;
    q=0;
    for(i=0;i<3;i++)/** column**/
    {
        for(j=0;j<3;j++)
        {
            if(arr[j][i].equals("X"))
            p++;
            else if(arr[i][j].equals("O"))
            q++;
        }
        if(q==2)
        {
            for(k=0;k<3;k++)
            {
                if(arr[k][i].equals("."))
                {
                    arr[k][i] = "O";
                    return arr;
                }
            }
        }
        q=0;
        if(p==2)
        {
            for(k=0;k<3;k++)
            {
                if(arr[k][i].equals("."))
                {
                    arr[k][i] = "O";
                    return arr;
                }
            }
        }
        p=0;
    }
    p=0;
    q=0;
    for(i=0;i<3;i++)/** right dia**/
    {
        if(arr[i][i].equals("X"))
        p++;
        else if(arr[i][i].equals("O"))
        q++;
    }
    if(q==2)
    {
        for(j=0;j
        {
            if(arr[j][j].equals("."))
            {
                arr[j][j]="O";
                return arr;
            }
        }
    }
    q=0;
    if(p==2)
    {
        for(j=0;j<3;j++)
        {
            if(arr[j][j].equals("."))
            {
                arr[j][j]="O";
                return arr;
            }
        }
    }
    p=0;
    q=0;
    for(i=0,j=2;j>=0;i++,j--)/** left dia**/
    {
        if(arr[i][j].equals("X"))
        p++;
        else if(arr[i][j].equals("O"))
        q++;
    }
    if(q==2)
    {
        for(k=0,m=2;m>=0;k++,m--)
        {
            if(arr[k][m].equals("."))
            {
                arr[k][m]="O";
                return arr;
            }
        }
    }
    if(p==2)
    {
        for(k=0,m=2;m>=0;k++,m--)
        {
            if(arr[k][m].equals("."))
            {
                arr[k][m]="O";
                return arr;
            }
        }
    }
    outer : for(i=0;i<3;i++)
    {
   inner : for(j=0;j<3;j++)
        {
            if(arr[i][j].equals("."))
            {
                arr[i][j]="O";
                break outer;
               
            }
        }
    }
    return arr;
}
               
               
    static void main()
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        System.out.println("Welcome to TicTacToe.\n---------------------\n\nWhich type of game do you want to play?\nPress 1 for 1'Player game \nPress 2. for 2'Player game.\nPress 3. for Exit.\n");
        int f=0, ch=0;
        do
        {
            try
            {
                System.out.print("Your choice : ");
                ch = Integer.parseInt(br.readLine());
                f=0;
            }catch(Exception e)
            {
                f=1;
            }
        }while(f==1);
        switch(ch)
        {
            case 1 : System.out.println("\f");
            onePlayer();
            break;
            case 2 : System.out.println("\f");
            twoPlayers();
            break;
            case 3 : System.out.println("\f");
            System.out.println("Thank you.");
            return;
            default : System.out.println("Wrong choice!!!\n\n\n\n");
            main();
            break;
        }
    }
    static void onePlayer()
    {
        System.out.println("Instructions:- This is a one-player game. It is controlled entirely by the key-board. There is no requirement of the mouse.");
        System.out.println("               To make a move, enter the place where you want to put in your symbol i.e either a 'X'.");
        System.out.println("               The layout is shown below with corresponding place numbers.");
        System.out.println("                  |   |");
        System.out.println("                1 | 2 | 3");
        System.out.println("              ----|---|----");
        System.out.println("                4 | 5 | 6");
        System.out.println("              ----|---|----");
        System.out.println("                7 | 8 | 9");
        System.out.println("                  |   |");
        System.out.println("               Enjoy yourself...\n\n");
        String arr[][] = new String[3][3], player = "";
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int f=0, i,j, c=1;
        for(i=0;i<3;i++)
        {
            for(j=0;j<3;j++)
            {
                arr[i][j] = ".";
            }
        }
        do
        {
            try
            {
                System.out.print("Enter your name : ");
                player = br.readLine();
                f=0;
            }catch(Exception e)
            {
                f=1;
            }
        }while(f==1);
        f=0;
        for(i=1;i<=9;i++)
        {
            if(c%2!=0)
            {
                System.out.println(player+"'s move.");
                enter(arr,c);
                c++;
            }
            display(arr);
            if(hasWon(arr))
            {
                f=1;
                break;
            }
            if(isFull(arr))
            {
                f=0;
                break;
            }
            if(c%2==0)
            {
                computersMove(arr);
                display(arr);
                c++;
            }
            if(hasWon(arr))
            {
                f=2;
                break;
            }
            if(isFull(arr))
            {
                f=0;
                break;
            }
        }
        display(arr);
        if(f==0)
        System.out.println("No winner. Game even.");
        else if(f==1)
        System.out.println("Congo!!! "+player+" you win!");
        else
        System.out.println("Computer wins.");
        System.out.println();
        main();
    }
    static boolean isFull(String arr[][])
    {
        for(int i=0;i
        {
            for(int j=0;j
            {
                if(arr[i][j].equals("."))
                return false;
            }
        }
        return true;
    }
}

=============================================================================================================================================
DONOT COPY THIS OR THE SEPARATORS OR ELSE THE CODE WILL NOT COMPILE!!!

i hope you'll have fun with this simple TicTactoe program...it ain't much, but it's hard work...

well, more later...bye...

Signing out,
Aakash, the Angel of Death...

My Immortal Acoustic Chords

Hey people, am back....this time, with a few musical stuff you might like...i know, evanescence ain't much of metal but hey, they are musical
and magical and Amy Lee...man, her voice just weaves magic...am in love with her voice...muah, Amy!!! Love ya...

anyways, i had posted this thing on ultimateguitar.com ages ago, but those guys apparantly found it bullshit so they didn't post it on their
website...i guess that's my bad luck but hey, wait up, i tabbed these and they sound just perfect...and it's easy too...
so, all you musicians out there (preferably guitarists), here Evanescence's My Immortal for you...this is the version or rather the
Carbon-copy of the thing i uploaded on ultimateguitar.com

============================================================================
Track:- My Immortal
Artist:- Evanescence (performed by Amy Lee)
Album:- Origin
============================================================================

Tabs and Chords by:- Aakash, the Angel of Death.
e-mail:- jens.aakash@gmail.com

============================================================================

An awesome, heart-touching song by Evanescence...I really loved it...Amy Lee
has done a great job and her vocals are just too good...way to go, Amy!

Although these tabs and chords are for the acoustic version, they sound
great on electric as well...trust me, I have tried it out and I bet you won't be disappointed by the sound

============================================================================

Tuning:- Standard
Chords used:- A, c#m, F#m, D, E

Intro:- RPGO on - A (barre) and C#m (barre)

    A        C#m
e|-----------------|-----------------
B|-----------------|-----------------
G|---------6-------|----------6------
D|---7---7---7---7-|---6---6---------
A|-----7-------7---|-----4-----------
E|-5---------------|-4--------------- x2

Playing pattern:- During the first two Verses, play the intro.
          During the pre-chorus and chorus, play it as chords.

#NOTE#
======

A word of advice...try playing the open D and E chords...except in the last
line of the third verse.

And now, the song with chords...


VERSE 1:- (RPGO on A and C#m)

A                     C#m 
I'm so tired of being here
A                       C#m
suppressed by all of my childish fears
A
and if you have to leave
  C#m 
I wish that you could just leave
A
because your presence still lingers here
C#m
and it won't leave me alone


Pre-CHORUS:- (Play as chords)

F#m      C#m
   These wounds won't seem to heal
F#m      C#m
    this pain is just too real
F#m     C#m                E
there's just too much that time cannot erase


CHORUS:- (Play as chords)

F#m      D         E         C#m
When you cried I'd wipe away all of your tears
F#m        D          E          C#m
When you'd scream I'd fight away all of your fears
F#m      D         E            C#m
And I've held your hand through all of these years
F#m        D     E          
but you still have all of me

REPEAT Intro twice.


VERSE 2:-(RPGO on A and C#m)

A                    C#m
You used to captivate me by your resonating light
A                        C#m
but now I'm bound by the life you left behind
A                   C#m
Your face it haunts my once pleasant dreams
A                         C#m
your voice it chased away all the sanity in me

F#m      C#m
   These wounds won't seem to heal
F#m      C#m
    this pain is just too real
F#m     C#m                E
there's just too much that time cannot erase

F#m      D         E         C#m
When you cried I'd wipe away all of your tears
F#m        D          E          C#m
When you'd scream I'd fight away all of your fears
F#m      D         E            C#m
And I've held your hand through all of these years
F#m        D     E          
but you still have all of me


VERSE 3:- (Play as chords but gently)

D             F#m              E                 D
I've tried so hard to tell myself that you're gone
F#m                     C#m
but though you're still with me
D             E          
I've been alone all along


F#m  D  E  C#m x2 (Play it with vigor and as chords)


F#m      D         E         C#m
When you cried I'd wipe away all of your tears
F#m        D          E          C#m
When you'd scream I'd fight away all of your fears
F#m      D         E            C#m
And I've held your hand through all of these years
F#m        D     E          
but you still have all of me

OUTRO same as Intro...play it twice...but if you feel like, try then you may play it thrice as well...! HAVE FUN!!!

============================================================================


Well, that was Evanescence's My Immortal for you...hope you liked it...please rate it and you are most welcome to mail me about how you liked it...i'll be waiting for your mails...

============================================================================

more next time....catch ya guys later....bye...

signing out,
Aakash, the Gothic Progeny...

An Apology



hey people, am back....guess my first blog was a bit too much...i mean, hey, even i found it to be too much(!). don't take anything to heart
though...that was my first blog so i thought, "why not show some attitude?" guess i ended up hurting many sentiments and stuff...so here i
am, ready to apologize for my mistake...

SORRY...am really sorry...if i have hurt your emotions or fellings by my words, then am really sorry...but the fact remains that i do know
that what i have written (about god) is pretty logical, minus the abuse. in fact, i really exaggerated a bit too much. i mean, i really
am a hard-core metalhead and a follower of metal to the core. i really am a goal keeper and i do dive to make saves...but i'd suggest you
take a look at mistakes...they are unforgivable...simply unforgiveable...i mean, how many keepers miss volley shots which even a two-year
old can catch??? guess what, the ball just slipped between my fingers and into the goal...! yeah, like i say it, "Just my bad luck going from
bad to Worse!"

guys, see, the kind of person i am is really for you to decide. i mean, after my first post, a few of my friends read them and suggested that
i show less amount of attitude there on the blog because they seemed to think that i was just trying to prove that i am a bad guy. believe me,
i actually was trying to potray myself as a bad guy...don't know what got into me...i have this really bad habit of showing too much of
attitude and that gets my friends really pissed with me sometimes... :-( man, some stuff are real hard to drop...but hey, no hard feelings,
nothing personal, okay? in case you never knew, i happen to be a real friendly person anda dedicated friend and i just love to make friends!
in fact, i can make friends very easily...just talk to me once and you'll know that this time, i ain't fibbing...

Oops! i deviated too much from the topic of this blog...see, that's another of my faults...am sorry again...well, people, if i have hurt you
in anyway, than i am really sorry...won't happen again, i promise! just give me another chance...oh yes, and one last thing, i'll be using
"fuck" and its derivatives in my blogs, so please don't feel insulted...they ain't for you, it's just that i can't stop using the word to show
excess of feelings and emotions...guess it's another thing that's impossible for me to change...

well, apart from this, am pretty much a teen like you all...you know, 17 and all...bustling with energy, struggling with classical physics,
organic chemistry, difficult math, macbeth and the Romantic Poets, enjoying music and exploring the world of music with my guitar, playing soccer to my heart's content
everytime am on the field and of course, programming a hell lotta stuff in Java...just love the language...thanks to Sun Microsystems and
James Gosling(i hope i got the name and spelling correct!) though...

wow! looks like i have written enough already...but my fingers are itching to write more...guess i'll satisfy the itch with a good program...
i'll be back later!!! bye!!! stay well...

those of you who wanna contact me, here's some contact info...
e-mail: jens.aakash@gmail.com
phn:- +918100428129 (call or sms, anything!)
facebook:- search for "Aakash Einstein". it's got my pic...just lemme know how u came to get my contact, ok??? send a personal message, that
       is when you add as a friend in facebook...

c ya!!!


signing out,
Aakash, the Angel of Death...

Friday, February 26, 2010

An Intro...

                     The Journey Begins...

Hey there!!! Wussup??? Everything fine??? Well, lemme introduce myself...this is Aakash, better known as The Angel of Death or The Gothic Progeny...I know, it sounds a bit wannabe type but, hey dude, that's me...accept it or raise your fuckin' standard!!!

Well, am a huge soccer freak. I just love the game...you can say I live for soccer...I play 'keeper, and am one of those keepers who actually dive to make a save...am a die-hard fan of Arsenal and Germany...and i consider Jens Lehmann, the Great to be my idol....

When it comes to muzik, am completetly into metal....you know, metal and the higher genres like Heavy Metal, Thrash Metal, Black Metal, Power Metal, Death Metal, Gothic Metal....and the list continues....i just loooove to head-bang and the bloody and gory stuff...i just love them....you can say that i am a complete gothic.......blood doesn't scare me and the gore makes me want for more....

Once, someone asked me,"Do you believe in God?" My answer, "you fuckin' crazy??? who the fuck said this bastard called GOD exists??? you prove it to me, then i may consider...". that's my attitude towards god....that mother fucker simply doesn't exist! i mean, when we have technology and science with us, do we need to believe in some bullshit imaginary "super" creature just because our ancestors used to waste loads of cash behind it??? come on now, who needs god??? we are better off wothout him....tell me something, we are told that god loves us all (Slayer sang, "God Hates us All")...then how come the world is so full of misery and pain and sorrow? isn't god supposed to be saving our asses??? i mean, in two words, "fuck god." period...and please, if you think that god does exist, then this blog ain't for you...in my further blogs,i'll be screwing god up like crazy! and still if you don't believe me, then i'd suggest you just raise your motherfuckin' intellect before coming in front of me....





phew....that was something...to people who are of the same opinion as me, Welcome to my Blog....and to those who simply ain't like me, just  "fuck off and die!!!" guess that was a hell lot for the "good dudes".....more later....see ya!!!

to the metal-heads,
signed,
Aakash, the angel of Death