Bug 577

Summary: The system tells the player he wins even if the sprite is not tracked
Product: CS3343_Kunkun_Loves_English Reporter: shangpguo2
Component: AlgorithmAssignee: xuezhwang2-c
Status: RESOLVED FIXED    
Severity: blocker CC: mingyaliu8-c, xuezhwang2-c
Priority: ---    
Version: 1.0   
Hardware: PC   
OS: Windows   

Description shangpguo2 2021-11-19 20:48:26 HKT
Summary:

Hi, When I am playing. I found that the system told me I was win even if I didn't successfully trap cxk yet, i.e. the cxk should be surrounded by 6 filled basketball, but when it is only surrounded by 4, the system says I am win.

Steps to reproduce:

1. click the basketball at (5, 7), fill the correct word.
2. click the basketball at (5, 5), fill the correct word.
3. click the basketball at (4, 5), fill the correct word.
4. click the basketball at (6, 5), fill the correct word.

Actual Result:

The playing scene automatically terminate and redirect to ending scene.

Expected Result:

Since the sprite is not trapped yet (6 basketballs can trap the cxk), it is expected that the game should continue to run.

Possible reason:

I suspect it is because your algorithm is wrong, when it computes whether the sprite can move or not.
Comment 1 xuezhwang2-c 2021-11-19 21:00:43 HKT
(In reply to shangpguo2 from comment #0)
> Summary:
> 
> Hi, When I am playing. I found that the system told me I was win even if I
> didn't successfully trap cxk yet, i.e. the cxk should be surrounded by 6
> filled basketball, but when it is only surrounded by 4, the system says I am
> win.
> 
> Steps to reproduce:
> 
> 1. click the basketball at (5, 7), fill the correct word.
> 2. click the basketball at (5, 5), fill the correct word.
> 3. click the basketball at (4, 5), fill the correct word.
> 4. click the basketball at (6, 5), fill the correct word.
> 
> Actual Result:
> 
> The playing scene automatically terminate and redirect to ending scene.
> 
> Expected Result:
> 
> Since the sprite is not trapped yet (6 basketballs can trap the cxk), it is
> expected that the game should continue to run.
> 
> Possible reason:
> 
> I suspect it is because your algorithm is wrong, when it computes whether
> the sprite can move or not.

Hi, Shangping. Thank you for your valuable discovery. 

The problem is indeed in the algorithm component and your concern is right. 

In the shortest path algorithm, these is a statement:
if(n == map.getDummy()) {
        res = temp.getNodeInformation().abstractPos;
	return res;
}
After checking the detailed implementation of abstractPos. I found that it seems tp swap the x and y in reversed order. As a result, it wrongly checks the dummy node (indicating the boundary in the algorithm component), hence, causing the problematic returned value. The problem is fixed after I modify the content in abstractPos.