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??
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??
>> 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; }
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 :-)
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.
That's a knight Salem ...
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.
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?