[knights] [Bug 430403] A bug or a feature in castling?

2022-04-15 Thread Alexander Semke
https://bugs.kde.org/show_bug.cgi?id=430403

Alexander Semke  changed:

   What|Removed |Added

 Resolution|--- |FIXED
   Version Fixed In||22.08
  Latest Commit||https://invent.kde.org/game
   ||s/knights/commit/ce7a9b4604
   ||1295c61f9fbd07724e5c739ef8a
   ||923
 Status|CONFIRMED   |RESOLVED

--- Comment #5 from Alexander Semke  ---
Git commit ce7a9b46041295c61f9fbd07724e5c739ef8a923 by Alexander Semke, on
behalf of David Kaye.
Committed on 15/04/2022 at 08:35.
Pushed by asemke into branch 'master'.

Don't allow to perform castling if the non-moved rook was already
captured and its position is occupied by another piece.
FIXED-IN: 22.08

M  +2-2src/rules/chessrules.cpp

https://invent.kde.org/games/knights/commit/ce7a9b46041295c61f9fbd07724e5c739ef8a923

-- 
You are receiving this mail because:
You are watching all bug changes.

[knights] [Bug 430403] A bug or a feature in castling?

2022-03-21 Thread Dave Kaye
https://bugs.kde.org/show_bug.cgi?id=430403

--- Comment #4 from Dave Kaye  ---
Created attachment 147653
  --> https://bugs.kde.org/attachment.cgi?id=147653&action=edit
Patch file Bug 430403

Attached is a patch to fix this bug.

The bug allows the castling rook to be captured by either a knight or bishop. 
If the rook has not moved, then the present code assumes the position is
occupied by a rook and will castle with the piece that is in that position. 
The present code will not allow castling if the capturing piece is a rook or a
queen, since these will immediately put the king into check and prevent
castling.

The patch is a simple check to see if the rook's position actually contains a
rook.  The color could also be checked, but this is not necessary.  If the
location is occupied by an opponent's rook (different color) it will not allow
castling due to that rook putting the king into check.

-- 
You are receiving this mail because:
You are watching all bug changes.

[knights] [Bug 430403] A bug or a feature in castling?

2021-12-29 Thread Dave Kaye
https://bugs.kde.org/show_bug.cgi?id=430403

Dave Kaye  changed:

   What|Removed |Added

 Status|REPORTED|CONFIRMED
 Ever confirmed|0   |1

--- Comment #3 from Dave Kaye  ---
This is a bug in the castling code for Knights.  It is reproducible for both
king side and queen side castling.

The rules for castling are:
* king has not moved
* rook has not moved
* no pieces between the king and rook
* king is not in check
* king does not cross over a square that is attacked by the opponent's pieces
* king does not end the move on a square attacked by the opponent's pieces

All of these rules are passed in the attached game.  The unusual situation is
that the rook was captured - but the rook never "moved" so it passed the rules
tests.  A human would recognize the piece was not a rook and therefore not
castle.  An additional rule must be formulated specifically for a computer to
test if the piece is a rook.  It would reside in Knights castling routines.

Attached are game files that can be used to test the code.  The NEXT move in
the game will be the castling move, and will demonstrate the error.

-- 
You are receiving this mail because:
You are watching all bug changes.

[knights] [Bug 430403] A bug or a feature in castling?

2021-12-29 Thread Dave Kaye
https://bugs.kde.org/show_bug.cgi?id=430403

--- Comment #2 from Dave Kaye  ---
Created attachment 144946
  --> https://bugs.kde.org/attachment.cgi?id=144946&action=edit
test case O-O

-- 
You are receiving this mail because:
You are watching all bug changes.

[knights] [Bug 430403] A bug or a feature in castling?

2021-12-29 Thread Dave Kaye
https://bugs.kde.org/show_bug.cgi?id=430403

Dave Kaye  changed:

   What|Removed |Added

 CC||d...@linuxmail.org

--- Comment #1 from Dave Kaye  ---
Created attachment 144945
  --> https://bugs.kde.org/attachment.cgi?id=144945&action=edit
test case O-O-O

-- 
You are receiving this mail because:
You are watching all bug changes.