Bug 581 - The "GRE" game has all the nodes with the same words inside of it.
Summary: The "GRE" game has all the nodes with the same words inside of it.
Status: RESOLVED FIXED
Alias: None
Product: CS3343_Kunkun_Loves_English
Classification: Unclassified
Component: File System (show other bugs)
Version: 1.0
Hardware: PC Windows
: --- critical
Assignee: ruixinli7-c
URL:
Depends on:
Blocks:
 
Reported: 2021-11-19 22:36 HKT by xuezhwang2-c
Modified: 2021-11-20 11:08 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 xuezhwang2-c 2021-11-19 22:36:42 HKT
Summary:

When I was testing the game, I found that no matter which basketball I clicked, it always prompt the word "divulge" (specifically, on the screen, it is "di___ge"). 

Steps to reproduce:

1. Enter the login scene and click the button "GRE"
2. In the playing scene, you may click any existing basketball and the word appears in the hint board is exactly the same.

Expected outcome:

It is expected that the words in the basketball should not only be different, but also randomly selected from the words list every time we enter the game.

Actual outcome:

The actual outcome is described as above. All the basketballs have exactly the same word.

Concern:

I doubt that this might be the problem of the file system. As in this system, you will read the file and randomly select some words from the it. However, it may also be the bug in the Map (game object component).
Comment 1 ruixinli7-c 2021-11-19 22:52:18 HKT
(In reply to xuezhwang2-c from comment #0)
> Summary:
> 
> When I was testing the game, I found that no matter which basketball I
> clicked, it always prompt the word "divulge" (specifically, on the screen,
> it is "di___ge"). 
> 
> Steps to reproduce:
> 
> 1. Enter the login scene and click the button "GRE"
> 2. In the playing scene, you may click any existing basketball and the word
> appears in the hint board is exactly the same.
> 
> Expected outcome:
> 
> It is expected that the words in the basketball should not only be
> different, but also randomly selected from the words list every time we
> enter the game.
> 
> Actual outcome:
> 
> The actual outcome is described as above. All the basketballs have exactly
> the same word.
> 
> Concern:
> 
> I doubt that this might be the problem of the file system. As in this
> system, you will read the file and randomly select some words from the it.
> However, it may also be the bug in the Map (game object component).

Hi, Xuezhen. Thanks for reporting this bug. Actually, your guess of the bug is exactly correct. It is the bug in the file system instead of the map (in game object system). There is a buggy code in the TxtReader.java and XMLReader.java.
The code is wordlist.add(index);

We then change to the following:

while (sc.hasNextLine()) {
   WordInfo i = new WordInfo(sc.nextLine(),sc.nextLine());
   wordlist.add(i);
}
which will generate random words which has the same number of words as the number of map nodes.