Bug 647 - In the AI mode, after the snake first die, snake would always die
Summary: In the AI mode, after the snake first die, snake would always die
Status: RESOLVED FIXED
Alias: None
Product: CS3343 2021/22 Group16 Greedy Snake
Classification: Unclassified
Component: Model section (show other bugs)
Version: Ver 3.0
Hardware: PC Windows
: --- critical
Assignee: Baron Qu
URL:
Depends on:
Blocks:
 
Reported: 2021-12-05 17:46 HKT by Baron Qu
Modified: 2021-12-05 17:58 HKT (History)
1 user (show)

See Also:


Attachments
Related code to init coordinate (15.36 KB, image/png)
2021-12-05 17:58 HKT, Baron Qu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Baron Qu 2021-12-05 17:46:11 HKT

    
Comment 1 Baron Qu 2021-12-05 17:49:50 HKT
The AI snake object's coordinate has stored in an ArrayList. Original, after the snake first dies, the length would set be 3, but the remaining value stored in the ArrayList has not been clean. So when it starts again, it would be very fast to meet the original code, then die. So just initial the coordinate again is OK.
Comment 2 Baron Qu 2021-12-05 17:58:06 HKT
Created attachment 101 [details]
Related code to init coordinate