Bug 418

Summary: Error in markDestroyable() or destroyDestoyable() in Map.java
Product: CandyCrush 2020 Reporter: ziruichen6-c
Component: Source CodeAssignee: jli262-c
Status: CONFIRMED ---    
Severity: enhancement    
Priority: ---    
Version: 1.0   
Hardware: PC   
OS: Windows   

Description ziruichen6-c 2020-11-18 22:29:54 HKT
The bug was found when running the entire program. Some items that should be destroyed have not been destroyed.

Steps to Reproduce: Create the following graphics in the test:
X X X
X X
Then call markDestroyable() and destroyDestoyable().


Actual Results: Only the three horizontal items have been destroyed.

Expected Results: All the above five items should be destroyed.
Comment 1 ziruichen6-c 2020-11-18 22:37:29 HKT
The error was caused by the format for writing code. The result returned by markDestroyable() is different from the expected.

The solution would be to correct the code.

Previous version:
boolean result = markSquareDestroyable()| markHorizontalDestroyable()| markVerticalDestroyable();
return result;

The problem would be that if one item is marked by markSquareDestroyable(), it would no longer participate in markHorizontalDestroyable()or markVerticalDestroyable().

After correcting:
boolean result = markSquareDestroyable();
result = result | markHorizontalDestroyable();
result = result | markVerticalDestroyable();
return result;
Comment 2 ziruichen6-c 2020-11-29 10:41:43 HKT
This is because the short circuit has occurred so that two behind functions didn't be called.