Chess problem!

This is a discussion on Chess problem! within the C Programming forums, part of the General Programming Boards category; I am in DIRE need of some help with this chess problem, i have been struggling with how to get ...

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    1

    Chess problem!

    I am in DIRE need of some help with this chess problem, i have been struggling with how to get the program to output the kill positions of a rook. Can anyone help??

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,600
    >> Can anyone help??

    How can anyone help you if they don't know what the specific problem is? Post the code you are having trouble with.
    Code:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

  3. #3
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926
    what is the code that you have now? We can't help if we don't know how you are going about writing the program :-)

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,344
    Probably needs some kind of algorithm, having taken into account all the pieces which move in straight lines

    Code:
    void rook ( int row, int col ) {
        struct foo { int r, int c } moves[8] = {
            { +2, +1 },
            { +2, -1 },
            // 6 other relative positions
        };
        // loop over all 8 positions, row + moves[i].r etc
        // check that its within bounds of the board
        // if anything is at the new position, flag it
    }
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    That's a knight Salem ...

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,344
    Bugger, so it is
    I just assumed he wanted the one which didn't move in straight lines...

    Since SAE_Rico84 is hardly forthcoming with additional information, I've lost interest.
    It's basically a "tell me where I can download GNU chess source code" post anyway.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  7. #7
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    It's a pretty vague post. Your hope is after requesting clarification, they'll come back with some code or a better description of the problem. The kill positions of a rook? Do you mean from an arbitrary square? Are there any other pieces on the board?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  5. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 05:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21