Bug 737 - Wrong queen movement
Summary: Wrong queen movement
Status: RESOLVED FIXED
Alias: None
Product: Chess Game - Group 24
Classification: Unclassified
Component: Chess (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- major
Assignee: Assan Kozhin
URL:
Depends on:
Blocks:
 
Reported: 2022-11-28 00:58 HKT by gsalter2-c
Modified: 2022-11-28 16:31 HKT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gsalter2-c 2022-11-28 00:58:55 HKT

    
Comment 1 gsalter2-c 2022-11-28 16:27:45 HKT
Steps to reproduce:
1. Run App.java
2. Make moves: 1. d4 d5 2. Qa5

Expected results:
Last move is a valid move, move should be executed.

Actual results:
Recognized as invalid move, move not executed.
Comment 2 gsalter2-c 2022-11-28 16:31:42 HKT
Reason:
Logic of queen movement didn't work properly on one edge case. When queen wants to move diagonally to the edge of the board, it can't.

Resolution:
Rewrite logic of code to check for edge cases, the reason was that in one specific case we used < operator instead of <=. Also, I rewrote code to use more concise for loop instead of while.

https://github.com/glennsalter/cs3343-chess/commit/8fd6d15523f7541b26fcd5c612faa29adc6eabc9