Bug 700 - When you try kill a piece with the same color, it throws exception
Summary: When you try kill a piece with the same color, it throws exception
Status: RESOLVED FIXED
Alias: None
Product: Chess Game - Group 24
Classification: Unclassified
Component: Chess (show other bugs)
Version: unspecified
Hardware: All All
: Normal normal
Assignee: Assan Kozhin
URL: https://github.com/glennsalter/cs3343...
Depends on:
Blocks:
 
Reported: 2022-11-06 13:26 HKT by sskawle2-c
Modified: 2022-11-24 21:58 HKT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sskawle2-c 2022-11-06 13:26:23 HKT
Steps to Reproduce:
1.	Execute App.java
2.	Kill a piece with the same color

Expected Results: 
Move should be invalid and ignored.

Actual Results:
Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError
	at chess.chess.Move.setKilledPiece(Move.java:21)
Comment 1 Assan Kozhin 2022-11-19 16:39:22 HKT
Add an if statement to check if the piece being eaten has the same colour as the eater in
`public boolean makeMove(Point start, Point end)` in Game.java.
https://github.com/glennsalter/cs3343-chess/commit/4999a0f52f039271012b978d598aef788a938bc9.
Comment 2 sskawle2-c 2022-11-24 21:58:37 HKT
(In reply to Assan Kozhin from comment #1)
> Add an if statement to check if the piece being eaten has the same colour as
> the eater in
> `public boolean makeMove(Point start, Point end)` in Game.java.
> https://github.com/glennsalter/cs3343-chess/commit/
> 4999a0f52f039271012b978d598aef788a938bc9.

The new link to the commit: https://github.com/glennsalter/cs3343-chess/commit/4999a0f52f039271012b978d598aef788a938bc9