Chess Program Development

Hello,
I'm in the process of developing a chess program to be played over a distributed network. Due to the complexity of the problem I'm going to be starting with the very basics. I've read some of the previous posts on this forum about chess games and found them very helpful. I've already made a text-based Tic-Tac-Toe game, which was suggested as a good starting point on this forum, and I would like to do the same with the chess game to start with. I figured that this would enable me to concentrate on the game mechanics. Below is a brief outline of how I would like to go about it:
1)Game class - used to set up the game and alternate the turns between the players
2)Board class - maintains the current game state and where the pieces are. Checks for mates, check mates, stalemates and draws (after 50 moves) as well as illegal moves.
3)ChessPiece - this will be an abstract class which will contain information about the colour of the piece, whether it has been captured or not and its position on the board
4)The specific pieces themselves will be sub-classes of ChessPiece. This would contain information about what type the piece is, type of move it is capable of and how much it is worth.
Is there anything else that would be useful to include in these classes that would make development of the game easier?In a previous post, someone suggested representing the Board as ChessPiece[8][8]. Would this be a good idea? Would it be worth keeping track of which squares on the board are black and which are white?What would be a good way of checking for illegal moves efficently if I'm going to use an array?
Thanks in advance

representing the Board as ChessPiece[8][8]. Would this
be a good idea?Choosing how to represent the board is a trade off:
1) array[8][8]: looks like a human thinks of a chess board but can have a performance impact if you're writing an AI. Keeping x & y coords is simple but it complicates checking for when a piece can move off the board, particularly knights.
2) array[10][10]: same as [8][8] but this eases the range checking because you keep a ring of "out of bounds" squares around the board. Knights can still move off the board in one jump though, so you could use array[12][12] to solve this if you're not too worried about memory.
3) array[64]: a little faster than [8][8] but suddenly keeping (x,y) coords is trickier. Checking for out of bounds moves is a little easier though.
4) or you could use an array[100] (or [144]) to include the ring of out-of-bounds squares as in (2) above.
Whatever you do you should develop the API first before deciding which setup you want to use. IIRC most big chess progs use a straight arrays like 3 or 4, but that's because they're written in assembler ;-)

Similar Messages

  • ABAP program developed in one system will it run in another system.

    Hi All,
           I have a very important query.
    I know that SAP 4.7, BW 3.1 and SAP CRM 4.0 have same kenel release SAP Basis 620.(please correct me if I am wrong)
    If Kernel in these systems are same, will an ABAP program developed in one system (say SAP 4.7) also work in another system (say CRM 4) with same kernel.
    This is very important me.
    Please help.
    With Regards
    Amit

    Hi Amit,
    1. If we transport a program from R/3
       to BW or CRM,
       It will work inside BW,CRM
       Bcos the basis/abap layer is always there in such systems.
    2. However, if the program uses some tables/FMs etc,
       which are not there in the Bw/Crm,
       then it may give error. thats all.
    Regards,
    Amit m.

  • Question about Java programming development

    There are five phases in java program development. They are: edit -> compile -> load -> verify -> execute
    However, every time I develops program. I only experience phase 1, phase 2 and phase 5. I always miss phase 3 and 4. When do the class loader and bytecode verifier work? How do they work?
    Second question, how the legitimate programs can execute automatically without typing command java to invoke the interpreter?

    lighthero wrote:
    I still have some questions.
    1. I want to run the program just like the commercial software such as Adobe and MS Office.(just double click to run the program.) How do I execute a java program without typing command java every time?Create an executable JAR: [http://java.sun.com/docs/books/tutorial/deployment/jar/index.html]
    >
    2. How does the JIT compiler work?[http://www.google.ca/search?q=Java+JIT]

  • How to open program developed using labview 8.2 in labview 7.1?

    Dear friends,
             I need to open program developed by using  labview 8.2 in labview 7.1.help me in this regard?

    In order to open it up, you have to backsave it to 7.1. You would need to first save it to 8.0 and 8.0 can save it as a 7.1 file. Attach your VI and ask if someone can do it for you if you don't have the intermediate version.

  • A program developed in Visual Studio are ...

    To run the Visual Studio (Visual c ++, Visual Basic, Visual c #, etc.) in the development of the program I need the .NET Framework? Can I add a drive must have Visual Studio .NET framework? If there any .Net framework should not do that if the .NET
    framework to be driving without a development program in Visual Studio or Visual Studio without the use of the .NET framework? If you let me know.
    And Can I decompile a program developed by visual c ++? Visual Basic or Visual c # is that we know, decompile.
    Wait for a good answer.
    *** Use the Google Translator meaning may not be accurate ***

    You may be better off finding a support channel in your native language, as the question is difficult for me to understand.
    Does a computer need .NET to run Visual Studio?  Yes.  Installing Visual Studio on your computer will also install .NET
    Does a computer need .NET to run an application created in Visual Studio?  A native C++ application does not require .NET to be installed on the computer that is to run the application.  Programs created in C#, VB or C++/CLI do
    require .NET.  Normally you will use an install program to install such an appliaction
    Normally you cannot decompile C++ programs in a useful way.  C# and VB can usually be decompiled in a useful way because they contain a lot of metadata in addition to executable instructions (such as variable names and object structures). 
    C++ strips all that information from its binary files and it cannot be easily restored.

  • Sorting criteria not validating in Z Programe development

    We are in process of data fatching in a Z development program and faced with following situation;
    1. We pass criteria as Fiscal Year 2010 and posting date as 01.04.2010 to 30.04.2010
    2. Accourding to above input we fatch data in MSEG table
    3. But when passing the MSEG reference field into header table MKPF we find different date (i.e. October 2010) which is different from initial data range (i.e. April 2010)
    It seems that we are unable to put date check criteria,
    How could we initiate the date check successfully. Kindly suggest.
    Regards
    Mayoor

    Sir ;
       we seek your Guidance within Following Criteria :
    1.) we r under the process of sorting data having material movement with Financial Impects
    2.) how to sort data from the related tables since we have two year's that is Material year and fiscal year.
    3.) we desire to sort data specific to particular date range with in one Period 
    Plz. advice.

  • How to get Access key for ABAP Program development in HANA Studio

    Hi,
    I have got instance for ABAP on HANA development system.
    But while creating new program it is asking me for Access key, since I do not have user id pwd for service market place I couldnt able to create the access key.
    Can any one suggest the way to create ACCESS KEY??
    Thanks,
    Ram

    Dear Ram,
    it seems that you need to follow the chapter 6.1 in the documentation...:
    Kind regards, Stephan

  • Here's my chess program

    If anyone wants to try it out you can download the .java files here...
    http://www.geocities.com/john_harnagel/chess0_1.zip
    If you find any rules errors please let me know, but in advance, the en-passant rule was not implemented. Everything else should work.
    On a side note, does anyone know how to make the program close down when the frame is closed? Right now it just kind of sits there, which I assume is pretty bad.
    The main program is in Chess.java, can I add something to close the program?
    public class Chess
         public static void main (String[] args)
              Chess_GUI frame = new Chess_GUI();
              frame.show();
    }

    frame.setDefaultCloseOperation(frame.CLOSE_ON_EXIT);Here is the error when I inserted that into my main method...
    C:\Program Files\Xinox Software\JCreator LE\MyProjects\Exercises\Chess\ChessGame\Chess.java:13: cannot resolve symbol
    symbol : variable CLOSE_ON_EXIT
    location: class Chess_GUI
              frame.setDefaultCloseOperation(frame.CLOSE_ON_EXIT);
    ^
    1 error
    Process completed.

  • Guide for simple program development using screens

    Hi guys!
    I want to learn development in ABAP using screens. Can you advise me some links or send some documents on this? The best would be Simple examples..
    I can develop FMs already..
    Thank you!
    Olian

    Hi,
    Can you check out the links below it will help you in learning module pool programs
    http://wiki.ittoolbox.com/index.php/FAQ:What_is_module_pool_program_in_abap%3F
    http://help.sap.com/saphelp_46c/helpdata/en/35/26b1aaafab52b9e10000009b38f974/content.htm
    http://sap.mis.cmich.edu/sap-abap/abap09/sld011.htm
    http://sap.mis.cmich.edu/sap-abap/abap09/index.htm
    http://www.geocities.com/ZSAPcHAT
    http://www.allsaplinks.com/files/using_table_in_screen.pdf
    http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm
    http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
    http://www.sap-img.com/
    http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm
    http://www.sapgenie.com/links/abap.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm
    <b>Reward points for helpful answers,</b>
    Satish

  • Command Line Instant Messaging Program Developing Help

    Does anybody know a good tutorial for developing instant messaging programs?Or has anybody developed a similiar program like MIRC using java?
    If u have any ideas please help me.

    There are quite a few java implementations for irc out there. Take a peek at sourceforge.net and search for Java IRC, that should get you started. This is a quite complex matter, so please get a first overview and get back with more detailed questions.
    Off Topic: MIRC... those were the times...

  • Program development assistance

    Dear forum users/viewers,
    I am developing a Tic Tac Toe program that is required to check for winning instances as the first step of the logical processing of the program.
    I have developed a for loop that will go through each cell of a 3x3 board, and I can perform operations at each cell as necessary:
    for( int row=0; row<=2; row++ )
    for( int col=0; col<=2; col++ )
    A few questions... the first is, when I go to check each cell, I want to develop a statement or code segment that will check the current cell that its at, based on Row and Col values, and realize that if a piece (X or O) is located on this location, then it should check all the surrounding, neighboring positions to see if one or more pieces exist that match the piece located at the current coordinates. The problem is, when I go to create this code segment, I am stuck at how I am not to run into an out of bounds error when checking for pieces in neighboring positions.
    For example: On a 3x3 board, say I have a piece at Row 0, Column 2, making the piece at the upper right hand corner. If the code segment used to check for surrounding pieces is executed, and it realizes that it goes to check a location that is possible for neighboring the current location, such as "Column + 1" or "Column - 1", it will be looking at a new location that is not valid on the board. How do I avoid this? What ways can you think of to resolve an out of bounds issue like this?

    The problem is, when I go to create this code segment, I am stuck at how I am not to run into an out of bounds error when checking for pieces in neighboring positions.You can avoid the exceptions by using an if statement. For instance if(row==2) then you wouldn't try doing anything with row+1.
    Another way would be to avoid ever getting into a situation where the exception could arise. A TTT win must touch one of the lefthand squares (col==0) and/or one of the top ones (row==0). And these 5 cells are the ones that need be checked. Such an approach doesn't simply generalise though if you are playing a generalised game to get n in a row on a mxm board (m>n).

  • Which is the best user-friendly IDE for swing program development

    Which is the best user-friendly IDE for swing program development

    I have seen Sun's Forte and IBM's Visual Age for Java.
    But Borland's JBulider 7 Personal Edition is far more superior than any of these.Borland's JBuilder is the Best.
    Ranga.

  • Does programming/developing work well with the mini mac

    has anyone downloaded wcode 4 using the mini mac and is there problems with using this application for developement on the mini mac

    mpap,
    The thread bananaman referenced is one reason I posted my question here.  Perhaps I was just lucky, I received my T500 March 20th and the ATI 3650 worked fine right out of the box with Google Earth 5.0.  If yours is reasonably new I don't see why it shouldn't work as well.
    By default GE chose OpenGL for the Graphics Mode (see Tools/Options/3D View in GE).  I'd suggest checking the Graphics Mode setting in GE.  I'd also check to see that your ATI card is actually being used, and that your on-board graphics isn't being used instead.  Apart from that I have nothing else to offer as I didn't need to fool around with anything for it to work.  But I have worked with other computers where GE's defaults didn't work and some fiddling had to be done with the Graphics Mode settings.  So you might want to try DirectX mode, and even try checking the "Use safe mode" box so see if that makes any difference.
    Good luck,
    Frank 

  • A suitable keyboard for program development

    As a C++ programmer, I'm sick of constantly having to do battle with my Mac's appalling keyboard. Poor kinetic feedback. Poor keys (on my aluminium, flat-key model) that I have to stab really hard, no hash key, no insert key etc etc. Yes I know that the missing keys can be simulated using convoluted key combinations but it's a real pain when you need them so frequently. Fortunately it's a USB device so replacing it shouldn't be a problem.
    Is there a particular keyboard that you other Mac programmers would recommend or should I just head out to my local PC store and buy a standard PC keyboard?

    RayNewbie wrote:
    Apple must be the first manufacturer in history to develop, test and market a keyboard without the advice of a touch typist. This gem makes me giggle every time I hear about stringent, thorough beta testing.
    Absolutely, Ray! The aluminium keyboard looks lovely but it must surely rank as one of the least useable keyboards ever designed..! It's impossible to type accurately at any reasonable speed. Apple are so full of bull**it..!
    Tom Gewecke wrote:
    Those aren't code pages, just keyboard layouts. See if one of these helps:
    http://liyang.hu/osx-british.xhtml
    Thanks for the link, Tom. I unpacked the download (it had 4 x files) and moved the files to */Library/Keyboard Layouts* - then I rebooted and am now stuck. Where can I actually select one of these alternative layouts? In my System Preferences I've looked under Hardware->Keyboard, Personal->Language & Text and System->Universal Access but I can't see anything different from what was there before.
    I'm sure it'll be somewhere obvious but I can't find it....

  • LV FPGA program development without hardware

    I am trying to evaluate an NI FPGA solution to a control problem. I have the LV FPGA software module
    through our university license, but I don't have the
    hardware. I want to be able to develop a LV vi and
    debug it without the hardware. But LV won't let me
    create the AI, AO, etc. blocks without the hardware,
    even though the FPGA example code does run with those
    blocks in LV. Is there some way to work around this?

    When you have the LabVIEW FPGA module installed, you should be able to target a RIO device in LabVIEW even if you don't have the hardware installed. To change targets in LabVIEW, click the Execution Target pulldown menu in the LabVIEW splash screen or got to Operate>>Switch Execution Target...
    Once you are targeted to a RIO target the functions palette on the diagram will change and give you the FPGA specific functions including AI, AO, DIO, etc.
    Christian L
    Christian Loew, CLA
    Principal Systems Engineer, National Instruments
    Please tip your answer providers with kudos.
    Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system,
    or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject
    to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense

Maybe you are looking for

  • Problem with commons.fileupload

    I'm using Tomcat 4.1 and before I couldn't get the compiler to find the package until I put it in my %JAVA-HOME%\jre\lib\ext folder. After I did that I could compile just fine. Now when I try uploading a file I get 'NoClassDefFoundError'. I read that

  • How to update CONDITIONS for SERVICES in ME51N, ME52N.

    Hi All, My requirement is to update the CONDITIONS for SERVICES for the transaction ME51N, ME52N. I'm using BAPI_REQUISITION_CREATE to create the Purchase Requisition. Thanks.

  • Importing Videos No Longer Works

    Recently, iPhoto stopped recognizing and importing videos from my cameras. I used to work fine, now, I'm not sure what happened, it no longer works. Is this common or just occurring for me? Any comments appreciated. peace, michael

  • Strange character in facebook in Chrome. After messing with Helevetica neue

    Hi everyone, I have this strange character in facebook in chrome. First of all, before this problem arise, I was messing around with helvetica neue font to display properly in google chrome, and also I deleted many international fonts using monolingu

  • Stops working when  "Starting up panels..."

    Just bought Adobe Creative Suite 5.5 Design Standard.  InDesign refuses to load.  I get the error message: Adobe InDesign CS5.5 has stopped working. A problem caused the program to stop working correctly. Windows will close the program and notify you