Thread: Chess problem!

  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,708
    >> 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:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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.

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

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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.

  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, 11: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, 06:24 PM