monopoly icon indicating copy to clipboard operation
monopoly copied to clipboard

AI declares false bankruptcy when left with lands with houses/hotels

Open Seniru opened this issue 7 months ago • 0 comments

AI is unable to sell houses/hotels on lands and as a result it declares in bankruptcy (while having more property to sell/mortgage)

https://github.com/intrepidcoder/monopoly/blob/master/ai.js#L177-192

I've had a quick look at the code, think this needs to be changed.

if (s.owner === p.index && !s.mortgage) {
        if (s.house === 0) {
	        mortgage(i);
	        console.log(s.name);
        } else {
                // logic to sell houses/hotels in each land consecutively as needed
        }
}

I'd love to open a PR with necessary changes if you want me to. Thanks!

Seniru avatar Jul 14 '24 07:07 Seniru