Community Sites
Create your own community website and start earning today !
It's Free !
 
Communities Members BookmarksPolls Fresher Jobs Funny Photos B.Tech Projects New Member FAQ  



My Profile
Active Members
TodayLast 7 Days more...



Awards & Gifts
Online Exams

Fresher Jobs


Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi

Resources


Find educational articles, blogs, discussion threads and other resources.

Colleges


Find details about any college in India or search for courses.

website counter



JAVAcode for Chess


Posted Date: 15 Aug 2008    Resource Type: Articles/Knowledge Sharing    Category: Computer & Technology

Posted By: Rahul Jain       Member Level: Gold
Rating:     Points: 2



import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*

*/
public class chess extends Applet
{

int x=0,y=0;boolean flag=true;
Dimension d;
public void init()
{
d=getSize();
}

public void paint(Graphics g)
{
x=d.width/8;
y=d.height/8;


for(int i=0;i<=200-x;i+=x)
{
for(int j=0;j<=200-y;j+=y)
{
g.drawRect(i,j,x,y);

}


}
for(int i=0;i<=200-x;i+=(2*x))
{
for(int j=0;j<=200-y;j+=(2*y))
{
g.fillRect(i,j,x,y);
// g.show();
}
}
for(int i=x;i<=200-x;i+=(2*x))
{
for(int j=y;j<=200-y;j+=(2*y))
{
g.fillRect(i,j,x,y);
// g.show();
}
}

}
}





Responses

Author: Raghav    16 Aug 2008Member Level: Diamond   Points : 1
Hi Rahul,
I think this program will only draw a chess board. We thought it will create a chess game and we can play the game. but it seems it will only draw the chess board once it is executed. Can you write a program to generate a real chess game?

Raghav


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Java  .  Chess  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: List of the keyboard shortcuts that are available in Windows XP
Previous Resource: Another JAVA code for CHESS
Return to Discussion Resource Index
Post New Resource
Category: Computer & Technology


Post resources and earn money!
 
Related Resources

Watch TV Channels



Contact Us    Editors    Privacy Policy    Terms Of Use   

SpiderWorks Technologies Pvt Ltd. 2006 - 2007 All Rights Reserved.