Bug 724 - changing getBoard returning a clone instead of reference break the score caluation
Summary: changing getBoard returning a clone instead of reference break the score calu...
Status: IN_PROGRESS
Alias: None
Product: Group 9
Classification: Unclassified
Component: DecisionTree (show other bugs)
Version: 1
Hardware: PC Windows
: High major
Deadline: 2022-11-30
Assignee: cklo36-c
URL:
Depends on:
Blocks:
 
Reported: 2022-11-22 22:09 HKT by cklo36-c
Modified: 2022-11-24 21:09 HKT (History)
0 users

See Also:


Attachments
invalid score (18.06 KB, image/jpeg)
2022-11-22 22:09 HKT, cklo36-c
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cklo36-c 2022-11-22 22:09:18 HKT
Created attachment 128 [details]
invalid score

After update GameBoare.getBoard() function returning a clone of board instead of reference, AiPlayer minmax() gave invalid score causing AiPlayer cannot make the right move.

Further investigation shows that it may be caused by the recursion.
Comment 1 cklo36-c 2022-11-24 21:09:00 HKT
After investing, it seems that the recursion in minmax() needs the board reference to make the algorithm work properly.

Overriding getBoard() in DefaultGameBoard to return the reference seems to solve the problem