Saturday, June 18, 2011

A new step to JAVA: Baghchal

Baghchal is a Nepali board game, traditionally played in drawn lines on tables with the help of stones. Four big stones used to be "Bagh" and 20 small stones used to be "Bakhra". With the advancement in technology, Baghchal is now available in software. People are now able to play it in their PCs, Laptops. 

As i introduced Baghchal, we may think that i have something to do with it. Yes it has; I have made Baghchal in JAVA. My GUI of Baghchal is shown in figure below.


There are four tigers(baghs) in four corner of Baghchal board. Twenty goats(bakhra) are outside of the board. We can see two messages "Its goat turn" and "Its tiger turn", which are activated and faded according to the turn. If tiger wins the match "Tiger won!!!" will be activated, and if goat wins the match "Goat won!!!" will be activated.

Tiger wins the match if tiger eats at least five goats. The tiger winning situation is as shown in figure below. You can notice that the "Tiger won!!!" message is activated. 


Goat wins the game if goats are able to block all possible path of tigers. It is like locking all four tigers in a cage. Goad winning situation is shown in figure below. You can notice that the "Goat won!!!" message is activated.


Interested can download my game and try at once, click here.
How to play: Instructions (you can find this in README.txt file of baghchel.rar as well)
============================================================
    * place "baghchal" image folder to your "c:\" drive of computer
    * run Baghchal.jar
  
    * to play game press "r" key from keyboard. (r=restart game).
    * use arrow keys (top,down,right,left) for selection
    * use space to place/move object.
        * to palce goat:      select empty location using selection arrow keys
                      and press "space".
        * to move goat/tiger: select goat/tiger to move using selection arrow
                      key. select empty location usign arrow keyand
                      then press "space".
============================================================

Friday, June 10, 2011

Simple block game: Java work

Mr Sulabh Bista wrote an article about different programming languages in SEEE magazine, Encipher-2010. The title of his article "Learn language for life" was an inspiration for me. He suggested four important languages: Phython, PHP, MATLAB, JAVA. I knew MATLAB and i decided to learn JAVA. From then, it has been about 8-9 months and now I am in the level of making simple GUI games (I had made snake and ladder, published earlier in this blog). I also can't help thanking Mr Pranav Nandan for his kind support during my initial learning days. 

Taking about this block game, it is a simple single player game, you have to put all red blocks in brown square to win. The GUI in "stage 1" looks like as shown in figure below:

figure: sample GUI of stage 1

Blue areas are restricted, objects can not go there. To move red object, user has to push it by blue object. User can not push red object if two or more blocks are in same line or there is blue area after red object. To load different stages, press different keys: 1,2,3,4,5,6,7,8,9,0,-,+ (There are all together 12 stages). To move blue object, press: w = up, a = left, s = down and d = right. You can win if you could place all red objects in brown square.

To play game, download "blockgam.rar" file from here
(Warning: Please carefully read "read it.txt" , don't forget to place image folder "blockgam" in C:\ drive of your computer). Please comment down if you have any problems and suggestions about this game.

Visualization of Electromagnetic wave in MATLAB

Wave is imaginary and mysterious thing to us. Many of them are invisible and we even don’t know their pres...