Bug 418 - Error in markDestroyable() or destroyDestoyable() in Map.java
Summary: Error in markDestroyable() or destroyDestoyable() in Map.java
Status: CONFIRMED
Alias: None
Product: CandyCrush 2020
Classification: Unclassified
Component: Source Code (show other bugs)
Version: 1.0
Hardware: PC Windows
: --- enhancement
Assignee: jli262-c
URL:
Depends on:
Blocks:
 
Reported: 2020-11-18 22:29 HKT by ziruichen6-c
Modified: 2020-11-29 15:05 HKT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.