Chess Game Help

OK, I'm creating a chess game where you play against the computer. I have a good idea of how I am going to program the AI, but I need some basic stuff. Is there any code out there that has everything in it except the AI? Or at least some that draws the pieces and lets you move them around so I can work off of them? Thanks for your help.

Thank you very much Alex. That's exactly what I
need! I didn't think to search for AI in Google. :-P
I'll be sure to take a look at that tutorial!Geez, I don't know why that wasn't obvious? After all I would typically search for AI when asked for:
[url #" style="font-size: 18; color:navy;]Is there any code out there that has everything in it except the AI?
Yeah, that makes sense!

Similar Messages

  • Help in a chess game

    hi can anyone help me? i would like to create a simple chess game for only two players.

    hi can anyone help me? i would like to create a
    simple chess game for only two players.in contrast to a simple chess program for more than 2 players?
    A chess program for 2 players is rather simple, it only needs an engine to determine whether a proposed move is legal or not.
    The tricky part is adding a computer player.

  • Programming a Chess-game - Design Tips

    Hello,
    I'm definatly not new to programming, but I'm a beginner at Java. Now I'm trying to program a little chess-game, which should teach me some OOP-techniques and to get some experience with Java.
    Well, I have some ideas for the game in mind and already realized a few things, but I want to do it the right way and get some advice from you.
    - The chess board:
    Currently, I have a class handling the drawing of the board, getting the screen-coordinates, etc.. The class "GameBoard" extends a JPanel and I overwrite the "paintComponent"-method to draw the board.
    I have a second class "Field" that stores informations of one field: What color the field is, which piece is placed on this field and which player "owns" it. Also, each one of these "Field" is getting passed its coordinates on the screen from "GameBoard". This helps me later, when I want to decide, if the field is clicked or not.
    Now, is this a good way to implement the board and the fields? I have another option, which would be, that I throw out the class "GameBoard" and instead have a "FieldHandler" class. Now, the class "Field" would extend JPanel, overwrite "paintComponent" and draw a square on the screen. "FieldHandler" gives each "Field" the information, if it should be black or white. "FieldHandler" would also calculate the x- and y-coordinates for each field.
    Is this method better? I don't really know performance wise, because I have to add 64 JPanels to the contentPane, which means, that all 64 Panels need to be drawn seperately. I don't know if this is a good way, but maybe it doesn't really matter. One advantage would be, that I could change the color of a field easily, for example when I click or hover it, which is not that nercassary, but still nice.
    Maybe there is an even better way?
    - The Pieces:
    Well, I don't really have a clue how to draw the pieces on the board. I could also make them extend JPanel and then draw the image onto some coordinates. But that doesn't seem too right. What about BufferedImage? I don't really know how to use it, neither when it is appropriate to use. I think I get more advantage of this, when I have animations, but that's definatly not my intention.
    The only thing I know is, that I can show an image on the screen with:
    ImageIcon test = new ImageIcon("Test.gif");
            public void paintComponents(Graphics g) {
                test.paintIcon(this, g, 100, 100);
            }But is this right or even way to do it? I'm somehow unsure, if an "ImageIcon" is right for a chess-piece. Any other ways of doing this?
    The "Piece"-class itself is just an interface that the classes "Knight", "King", etc. extend. It draws the piece onto the screen, set the owning player, sets the coordinates of a piece (with the help of the "Field"-class; The Field doesn't know it's exact coordinates, just "A7", "E3", etc.) and some other functions. All pieces are handled by a "PieceHandler", which could provide functions for counting all pieces on the field, initialising every piece and maybe some more things.
    Anybody got some advice on this approach?
    This should be enough for now. I would be very thankful for any kind help, I really want my first project to be as good as possible, since I want to learn OOP and Java better.

    - The chess board:
    Currently, I have a class handling the drawing of the
    board, getting the screen-coordinates, etc.. The
    class "GameBoard" extends a JPanel and I overwrite
    the "paintComponent"-method to draw the board.
    I have a second class "Field" that stores
    informations of one field: What color the field is,
    which piece is placed on this field and which player
    "owns" it. Also, each one of these "Field" is getting
    passed its coordinates on the screen from
    "GameBoard". This helps me later, when I want to
    decide, if the field is clicked or not.
    Now, is this a good way to implement the board and
    the fields? I have another option, which would be,
    that I throw out the class "GameBoard" and instead
    have a "FieldHandler" class. Now, the class "Field"
    would extend JPanel, overwrite "paintComponent" and
    draw a square on the screen. "FieldHandler" gives
    each "Field" the information, if it should be black
    or white. "FieldHandler" would also calculate the x-
    and y-coordinates for each field.
    Is this method better? I don't really knowWhat I'd do: just paint a chessboard pattern from a static image. Can be loaded from a file, or can be generated once dynamically. Don't care at all about fields.
    Have some pixel-to-field coordinate mapping somewhere. Should be nothing but a simple multiplication.
    Have a List of chess pieces. Have those know what they look like (maybe using a delegate object which contains an image), have those know where they are and where they can go. When painting, iterate over the list, transform the coordinates to pixels, get the UI delegate and paint its image. Why bother calculating 64 fields if all you have are 32 pieces or less? And whether a field is black or white doesn't matter to the game.
    When the user clicks onto the board, get the coordinates of the click and transform them to the field coordinates, that you can then look up in the list of figures. If you find one, you can still paint a marker onto the board and underneath the piece image.
    This is what I'd do. Other approaches might make sense as well..

  • Use j2me to develop a chinese chess game

    Hi, i am new to J2ME but i have some experience on J2SE.
    Until now i still have no idea how to develop a j2me system. i already install j2me tool kit but dunno how to use and also installed Forte. The forte is just like a java builder and i now is working on it.
    Can anyone help me with this programming? I have a project to do and the project title is Developing a Chinese Chess Game in PDA using J2ME.
    Pls help me and give me some references or some sample coding of j2me.

    Alot of stuff online. Here's some to get you started:
    wireless toolkit tutorial -
    http://developers.sun.com/techtopics/mobility/midp/articles/wtoolkit/
    sample codes and articles-
    http://developers.sun.com/techtopics/mobility/allsamples/
    http://developers.sun.com/techtopics/mobility/allarticles/
    http://developers.sun.com/techtopics/mobility/allttips/
    Hope this helps. Good Luck.

  • Chess game programming

    I have to create a text-based chess game between uppercase and lowercase letters against each other using a two-dimensional arrays.
    1. I have to create the board and initialize the position of the letters.
    2. I have to give the output of the initial state of the game, showing the board and the first positions of the letters.
    3. I have to create the moves.(Meaning that i have to create an input to perform the entering moves)
    And i have to make sure that with every bad input the program will to repeat the input....
    If anybody of you have programmed a chess game like this before, i would appreciate any kind of help....
    Edited by: 812599 on Nov 17, 2010 8:26 AM

    mario.beka wrote:
    meacod wrote:
    812599 wrote:
    I have to create a text-based chess game between uppercase and lowercase letters against each other using a two-dimensional arrays.
    1. I have to create the board and initialize the position of the checkers.Just to give you a nudge - are you familiar with chess? What's the size of the board? How might that affect the structure you store your 'pieces' in? How will you represent pawns as opposed to kings, queens, rooks, and so forth?
    Scratch out some ideas on paper,
    Turn that into some pseudocode,
    Write some Java,
    Then come back to us if you have a specific question.Yeah that's the problem, cuz i have never played chess in my life....I'm just reading around now for the rules and movements of this game...in that case, don't bother.
    A decent chess program requires in-depth knowledge of the game, knowledge only gained through years of playing it at competition level.
    I've a small library of books about chess, have played it for going on 30 years, plus 15 years experience using Java professionally, and I'd not consider writing a chess playing program in Java as something I'd undertake on my own (and yes, I've studied the possibility of writing just that in a variety of languages I know about over the years, and even made a start a few times only to abandon it when the project became too big for me to handle).
    If you're only looking to make a digital chessboard, that's a much simpler task and one that you can certainly attempt even without knowing the game (except maybe the starting positions and accepted icons for the pieces and the size and nomenclature for the board and its fields).
    Start with that, then add rules validation as players move pieces. Start with large rules (like enforcing that pieces can only move legally, in itself a somewhat daunting task as there are several pitfalls and special rules depending on piece positions).
    At this stage there's still no AI, no computer player option. That's where the real work sits, and it's very much a non-trivial task.

  • 3D Game   help needed

    Latelly I have been working on many 3d games such as a rubiks cube and 3d chess game using a 3d class i made that uses a 2d graphing plane but i wanted to start making some more complex games. I have 3d rotation and other basic tasks working but i was wondering if someone could explain how to make basic movement where objects get bigger as they get closer to a focal point and tasks similar to that. If anyone has any idea of how to do this or info on 3d it would be very helpful to me. I have a setup that somewhat works for this but i can tell it doesnt work that well.

    goddard wrote:
    try this one:
    http://www.amazon.com/Developing-Games-Java-New-Riders/dp/1592730051/ref=sr_1_1?ie=UTF8&s=books&qid=1211721081&sr=1-1
    It's bit older (the author uses JDK 1.4.2 I think), but it covers a lot of concepts including how to create 3D sofware renderer in Java.i would definitely vouch for [Developing Games in Java|http://www.amazon.com/Developing-Games-Java-New-Riders/dp/1592730051/ref=sr_1_1?ie=UTF8&s=books&qid=1211721081&sr=1-1].
    i read it years ago when it came out and despite its size (1,000 pages) its an easy cover to cover read.
    i already had the math background but for people who dont i can say i liked how he teaches the concepts.
    plus its very robust. he covers threads, 2d, networking/multiplayer, audio, 3d, ai.

  • Interface for chess game

    Hi all,
    I am new to java and in the process of finding a job. Last week i was asked by an interviewer how to design an interface for a chess game and implement it in a class. Pls. someone help with the best answer i can give.
    Thanks in Advance !

    johndjr wrote:
    I am new to java and in the process of finding a job. Last week i was asked by an >interviewer how to design an interface for a chess game and implement it in a class. Pls. someone help with the best answer i can give.When you don't know say, "I don't know".
    If you have to ask us you will never be able to pull off the fake.
    back when I had to interview people I would take an honest I don't know or I'm not familiar with that over someone trying to make up an answer and looking like a fool.Interviewees were also required to answer questions on the spot rather than being given time to search the internet and prepare a canned response.
    In fact in any job interview I've ever had (the last not 2 years ago) that was still the norm.

  • Chess game, PickTranslateBehavior

    Hi everyone,
    I am trying to create a 3d chess game. I have created the board and loaded some chess pieces in. I have constructed a PickTranslateBehavior to move the chess pieces across the board, but PickTranslateBehavior moves the pieces along the x, y axes. I need it to move along the x, z axes. How would I do this? Also, is there any way to change the mouse button for this behaviour from right to left?
    Thanks for your time,
    Michael

    um, i don't know much about java, but does anyone have a working java chess game or something along those lines? i really need help. if you could even just tell me of someone else who might? i would really apprectiate it

  • AI for Chess Game

    Ive written a chess game and need help writing the AI for the game, I have very limited time, a week to finish it and need as much help as I can get.
    http://www.mediafire.com/?rh32jk5niua37kl
    The link contains the game as it stands at the moment, in order to see the pieces the path will need to be changed in the ChessBoard class.
    Any pointers on improvements would of course be welcomes too but the main focus is on the AI.
    As far as I can tell I will need a brute force approach,
    i.e. pick a piece, evaluated possible moves, return score and do this for all pieces, I just need a bit of direction in terms of where do I start.

    Depends on how crazy you want to get with your AI.
    Are you looking for Deep Blue chess AI? Then good luck with that.
    Are you looking for an AI that just plays the game? Well that's easy enough to do... you've already mentioned a way to do that.
    i.e. pick a piece, evaluated possible moves, return score and do this for all pieces...Just go through all your pieces, see which pieces have available moves, and determine what the best move would be. If your logic determines that multiple pieces have equally the best current move, randomly choose a piece to be moved. Granted, that is a very "stupid" AI, but at least it's an idiot you can play against. ;-)

  • Yahoo chess games I get a sudden black screen I use winxp sp3 any suggestion ?

    I get sudden black screen at yahoo chess games.
    I appreciate your suggestions thank you

    Quote
    I don't need Your assistance now
    Quote
    First, You did not answer to my problem.
    No one here is in your debt...
    We will answer you if and when we can.
    Quote
    (as You can see from my post which You banned-erased from forum).
    Then, today You banned my new post.
    Your other topic was removed, because was full of bashing MSI, insulting forum and moderators out of no where..
    + We also don't allow people to open new topics for the same subject.
    >>Please read and comply with the Forum Rules.<<
    Quote
    Now You want to cover up your insolence and want to help.
    To cover my insolence? We have nothing to cover..
    You are the person who shows impressive insolence...
    Quote
    All of You are really shameless persons.
    You earned your BAN right away!
    Quote
    Please, erase this thread to.
    No need. Good luck with your issue.

  • Chess game in Mac OS X is there a bug fix for it

    This is not a major issue but I have noticed it on all the Apple computers I have played the Chess game that comes with the Mac OS X and it seems to only involve the Pawn making an illegal move when capturing another piece. As we all know the Pawn can only capture by one space in a diagol move yet the Mac OS X supplied Chess game a Pawn will and can often capture an opponents piece that is directly next to it, yet still moves in diagnol fashion and for the same token this illegal move can is sometimes offered to me if I ask for a move hint. This is very frustrating as I play the supplied chess game often is there a fix for this bug

    Hello again Daniel...
    I found a thread where "cornelius" suggested corrupt preferences as a potential cause for Chess problems...
    His solution was to go to your Home > Library > Preferences and drag your com.apple.Chess.plist to the DeskTop and Restart your computer and reopen the Chess game...see the link
    http://discussions.apple.com/thread.jspa?messageID=2758136?
    Good Luck dave
    iMac G5 17/1.8/FirstGen/1GB RAM Mac OS X (10.3.9) Seagate200GB/WD160GB/iSight/Shuffle/SecGen Nano2GB
    iMac G5 17/1.8/FirstGen/1GB RAM   Mac OS X (10.3.9)   Seagate200GB/WD160GB/iSight/Shuffle/SecGen Nano2GB

  • How to create chess game using Adobe flash CS3

    I want to develop a web application that when a user is login the game will automatically search for oppents onlinethat are accessing the same website. I want to design a chess game that does not contain any AI programming. What I want is that a simple chess setup that online user can only play.

    use google to search for tutorials.  that's a very complex undetaking so unless you feel you have advanced programming skills, you would be better served starting with a simpler game like tic-tac-toe.

  • Chess game

    I need guidance on how to model a chess game that involves two human players. Since this a Java oriented game and I am a new user as well as a learner, I need to be guided on the number of classes that can be incorporated in this game as well as the substantial roles of each class. I have tried examining some of the classes to involve the Board class, Piece class, legal move checker which extends board as well as the GUI on which the entire game shall be run. I need guidance on how I can join all the classes as well as some hints on attributes and operations that shall be involved in these classes.
    I have been thinking of sub classifying the piece class into sliding pieces and the non sliding pieces as well as representing pieces as images on the board. In my game, Enpassant rule is not operational, the pawn piece does not become updated at the end of the board and the castling rule does not apply too.
    I need to have my players on the same computer not on different computers or the Internet.

    As a new user/learner, you should try something a little less ambitious like checkers, and if thats too hard, Tic Tac Toe. It may sound like im joking about your abilitys, but creating Tic Tac Toe using classes for X's O's and the Board, will give you the basic understanding of how classes interact with each other, and how to design a basic object oriented game.
    It's only a small step from Tic Tac Toe, to Chess IMHO since chess only adds more game logic rules, but the class scenario is going to function pretty much the same, only more methods and rules to follow. Once you reach the point of creating the chess game, it's only a matter of creating a basic piece thats extended by all the various piece types who define their own movement rules.
    -Adam

  • Chess Game On Oracle Form 6i

    Hi Friends
    I have created chess game on Oracle Developer Form 2000 6i & my problem is that i have created some function for moving of Bishops, Kings, Queen, Knight etc. on Push Button and my Function of Knight is ..
    FUNCTION check_move_knight(p_from in varchar2, p_to in varchar2) RETURN BOOLEAN IS
    BEGIN
    If
              abs(substr(p_from, 2,1) - substr(p_to, 2,1)) = 2     and
              abs(substr(p_from, 4,1) - substr(p_to, 4,1)) = 1
              or
                        abs(substr(p_from, 2,1) - substr(p_to, 2,1)) = 1     and
              abs(substr(p_from, 4,1) - substr(p_to, 4,1)) = 2
    then
              return true;
    else
              return false;
         END IF;
    END;
    I want to write Function of King and Queen please tell me which type of function i can write on form ... :)
    Thanks & Regards
    Adeel

    You are playing with a 8*8 matrix.
    I suppose that you have an in memory PL/SQL table to simulate this matrix, with 1 if there is an item else 0.
    The King (exept the special move he can do only once - castling ?) can move only one square around, so X and Y can be -1 or +1
    The Queen can move like a pawn, a bishop and a tower.
    Francois

  • Memory Card Game Help Needed

    Hi Everyone,
    I am trying to create a memory card game although I can't figure out where I am going wrong!! Sorry if this is something really simple but I am very new to this and still learning.
    The cards are coming up as a 'matching' pair even when they are different. Any help would be appreciated. Thank you in advance! :-)
    Here is a link to the flash files:
    members.westnet.com.au/ubiquity/memory game help needed.zip

    yeah
    good idea  good luck
    http://www.dvdsuperdeal.com/weeds-seasons-1-5-dvd-boxset.html
    http://www.dvdsuperdeal.com/walt-disneys-100-years-of-magic-164-discs-dvd-boxset.html

Maybe you are looking for

  • Unit testing and system integration testing for crystal report

    Hi gurus,        I am creating crystal report by oracle procedure, will you please tell me how to do unit testing and system integration testing? appreciate very much.

  • Question about configuration (ATI 5770) w/ 3 monitors

    Ok I already know how to get three monitors running on the ATI 5770.  I have one native mini DisplayPort, one mini DisplyPort to VGA and one native  DVI or DVI to HDMI.  What I need to know (before I buy another native mini DisplayPort monitor) is if

  • Help Needed in Dynamic Sql or alternate to Dynamic Sql

    Hi Am working in sqlserver 2008 R2 and here is my Table structure and SPC ;create table SalaryReport(IdSalary int primary key identity(1,1), IDMainCompany int,IDSubCompany int,Salary money,Incentive int,NoofEmployees int, SalaryDate datetime, Credits

  • Report in excel from java

    I'm generating report in Excel from Java.In this is it posssible to place background color upto the text in the single cell

  • How to include html generated by a cgi-script ?

    Here's the problem: I need to include an html-header dynamically generated by a cgi-script: "web_nav.cgi" into my jsp-page. According to some documentation the <jsp:include page=... tag can only be used to include servlet, jsp or html files, and acco